diff --git a/Makefile b/Makefile index 3a0e034497..6fb0a592e6 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ PROJECT_REPO := github.com/crossplane/$(PROJECT_NAME) PLATFORMS ?= linux_amd64 linux_arm64 CODE_GENERATOR_COMMIT ?= cac5654b7bb64c8f754ad9af01799ef70d9541b6 -GENERATED_SERVICES="apigatewayv2,cloudfront,dynamodb,efs,kafka,kms,lambda,rds,secretsmanager,servicediscovery,sfn" +GENERATED_SERVICES="apigatewayv2,cloudfront,dynamodb,efs,kafka,kms,lambda,rds,secretsmanager,servicediscovery,ses,sfn" # -include will silently skip missing files, which allows us # to load those files with a target in the Makefile. If only diff --git a/apis/aws.go b/apis/aws.go index 9e7902ce1c..ae6024b72b 100644 --- a/apis/aws.go +++ b/apis/aws.go @@ -49,6 +49,7 @@ import ( s3v1beta1 "github.com/crossplane/provider-aws/apis/s3/v1beta1" secretsmanagerv1alpha1 "github.com/crossplane/provider-aws/apis/secretsmanager/v1alpha1" servicediscoveryv1alpha1 "github.com/crossplane/provider-aws/apis/servicediscovery/v1alpha1" + sesv1alpha1 "github.com/crossplane/provider-aws/apis/ses/v1alpha1" sfnv1alpha1 "github.com/crossplane/provider-aws/apis/sfn/v1alpha1" sqsv1beta1 "github.com/crossplane/provider-aws/apis/sqs/v1beta1" awsv1alpha3 "github.com/crossplane/provider-aws/apis/v1alpha3" @@ -91,6 +92,7 @@ func init() { cloudfrontv1alpha1.SchemeBuilder.AddToScheme, route53resolveralpha1.SchemeBuilder.AddToScheme, kafkav1alpha1.SchemeBuilder.AddToScheme, + sesv1alpha1.AddToScheme, ) } diff --git a/apis/ses/v1alpha1/custom_types.go b/apis/ses/v1alpha1/custom_types.go new file mode 100644 index 0000000000..f5be272532 --- /dev/null +++ b/apis/ses/v1alpha1/custom_types.go @@ -0,0 +1,17 @@ +/* +Copyright 2021 The Crossplane Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +// CustomTemplateParameters contains the additional fields for TemplateParameters. +type CustomTemplateParameters struct{} diff --git a/apis/ses/v1alpha1/generator-config.yaml b/apis/ses/v1alpha1/generator-config.yaml new file mode 100644 index 0000000000..5d8799fd57 --- /dev/null +++ b/apis/ses/v1alpha1/generator-config.yaml @@ -0,0 +1,15 @@ +ignore: + resource_names: + - Configuration + - ConfigurationSet + - ConfigurationSetEventDestination + - CustomVerificationEmailTemplate + - ReceiptFilter + - ReceiptRule + - ReceiptRuleSet +resources: + Template: + exceptions: + errors: + 404: + code: TemplateDoesNotExist \ No newline at end of file diff --git a/apis/ses/v1alpha1/zz_doc.go b/apis/ses/v1alpha1/zz_doc.go new file mode 100644 index 0000000000..d9e07d1a6c --- /dev/null +++ b/apis/ses/v1alpha1/zz_doc.go @@ -0,0 +1,24 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +// +kubebuilder:object:generate=true +// Package v1alpha1 is the v1alpha1 version of the ses.aws.crossplane.io API. +// +groupName=ses.aws.crossplane.io +// +versionName=v1alpha1 + +package v1alpha1 diff --git a/apis/ses/v1alpha1/zz_enums.go b/apis/ses/v1alpha1/zz_enums.go new file mode 100644 index 0000000000..c2c33997e2 --- /dev/null +++ b/apis/ses/v1alpha1/zz_enums.go @@ -0,0 +1,164 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package v1alpha1 + +type BehaviorOnMXFailure string + +const ( + BehaviorOnMXFailure_UseDefaultValue BehaviorOnMXFailure = "UseDefaultValue" + BehaviorOnMXFailure_RejectMessage BehaviorOnMXFailure = "RejectMessage" +) + +type BounceType string + +const ( + BounceType_DoesNotExist BounceType = "DoesNotExist" + BounceType_MessageTooLarge BounceType = "MessageTooLarge" + BounceType_ExceededQuota BounceType = "ExceededQuota" + BounceType_ContentRejected BounceType = "ContentRejected" + BounceType_Undefined BounceType = "Undefined" + BounceType_TemporaryFailure BounceType = "TemporaryFailure" +) + +type BulkEmailStatus string + +const ( + BulkEmailStatus_Success BulkEmailStatus = "Success" + BulkEmailStatus_MessageRejected BulkEmailStatus = "MessageRejected" + BulkEmailStatus_MailFromDomainNotVerified BulkEmailStatus = "MailFromDomainNotVerified" + BulkEmailStatus_ConfigurationSetDoesNotExist BulkEmailStatus = "ConfigurationSetDoesNotExist" + BulkEmailStatus_TemplateDoesNotExist BulkEmailStatus = "TemplateDoesNotExist" + BulkEmailStatus_AccountSuspended BulkEmailStatus = "AccountSuspended" + BulkEmailStatus_AccountThrottled BulkEmailStatus = "AccountThrottled" + BulkEmailStatus_AccountDailyQuotaExceeded BulkEmailStatus = "AccountDailyQuotaExceeded" + BulkEmailStatus_InvalidSendingPoolName BulkEmailStatus = "InvalidSendingPoolName" + BulkEmailStatus_AccountSendingPaused BulkEmailStatus = "AccountSendingPaused" + BulkEmailStatus_ConfigurationSetSendingPaused BulkEmailStatus = "ConfigurationSetSendingPaused" + BulkEmailStatus_InvalidParameterValue BulkEmailStatus = "InvalidParameterValue" + BulkEmailStatus_TransientFailure BulkEmailStatus = "TransientFailure" + BulkEmailStatus_Failed BulkEmailStatus = "Failed" +) + +type ConfigurationSetAttribute string + +const ( + ConfigurationSetAttribute_eventDestinations ConfigurationSetAttribute = "eventDestinations" + ConfigurationSetAttribute_trackingOptions ConfigurationSetAttribute = "trackingOptions" + ConfigurationSetAttribute_deliveryOptions ConfigurationSetAttribute = "deliveryOptions" + ConfigurationSetAttribute_reputationOptions ConfigurationSetAttribute = "reputationOptions" +) + +type CustomMailFromStatus string + +const ( + CustomMailFromStatus_Pending CustomMailFromStatus = "Pending" + CustomMailFromStatus_Success CustomMailFromStatus = "Success" + CustomMailFromStatus_Failed CustomMailFromStatus = "Failed" + CustomMailFromStatus_TemporaryFailure CustomMailFromStatus = "TemporaryFailure" +) + +type DimensionValueSource string + +const ( + DimensionValueSource_messageTag DimensionValueSource = "messageTag" + DimensionValueSource_emailHeader DimensionValueSource = "emailHeader" + DimensionValueSource_linkTag DimensionValueSource = "linkTag" +) + +type DsnAction string + +const ( + DsnAction_failed DsnAction = "failed" + DsnAction_delayed DsnAction = "delayed" + DsnAction_delivered DsnAction = "delivered" + DsnAction_relayed DsnAction = "relayed" + DsnAction_expanded DsnAction = "expanded" +) + +type EventType string + +const ( + EventType_send EventType = "send" + EventType_reject EventType = "reject" + EventType_bounce EventType = "bounce" + EventType_complaint EventType = "complaint" + EventType_delivery EventType = "delivery" + EventType_open EventType = "open" + EventType_click EventType = "click" + EventType_renderingFailure EventType = "renderingFailure" +) + +type IDentityType string + +const ( + IDentityType_EmailAddress IDentityType = "EmailAddress" + IDentityType_Domain IDentityType = "Domain" +) + +type InvocationType string + +const ( + InvocationType_Event InvocationType = "Event" + InvocationType_RequestResponse InvocationType = "RequestResponse" +) + +type NotificationType string + +const ( + NotificationType_Bounce NotificationType = "Bounce" + NotificationType_Complaint NotificationType = "Complaint" + NotificationType_Delivery NotificationType = "Delivery" +) + +type ReceiptFilterPolicy string + +const ( + ReceiptFilterPolicy_Block ReceiptFilterPolicy = "Block" + ReceiptFilterPolicy_Allow ReceiptFilterPolicy = "Allow" +) + +type SNSActionEncoding string + +const ( + SNSActionEncoding_UTF_8 SNSActionEncoding = "UTF-8" + SNSActionEncoding_Base64 SNSActionEncoding = "Base64" +) + +type StopScope string + +const ( + StopScope_RuleSet StopScope = "RuleSet" +) + +type TLSPolicy string + +const ( + TLSPolicy_Require TLSPolicy = "Require" + TLSPolicy_Optional TLSPolicy = "Optional" +) + +type VerificationStatus string + +const ( + VerificationStatus_Pending VerificationStatus = "Pending" + VerificationStatus_Success VerificationStatus = "Success" + VerificationStatus_Failed VerificationStatus = "Failed" + VerificationStatus_TemporaryFailure VerificationStatus = "TemporaryFailure" + VerificationStatus_NotStarted VerificationStatus = "NotStarted" +) diff --git a/apis/ses/v1alpha1/zz_generated.deepcopy.go b/apis/ses/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 0000000000..b0c81332bc --- /dev/null +++ b/apis/ses/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,286 @@ +// +build !ignore_autogenerated + +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomTemplateParameters) DeepCopyInto(out *CustomTemplateParameters) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomTemplateParameters. +func (in *CustomTemplateParameters) DeepCopy() *CustomTemplateParameters { + if in == nil { + return nil + } + out := new(CustomTemplateParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *CustomVerificationEmailTemplate) DeepCopyInto(out *CustomVerificationEmailTemplate) { + *out = *in + if in.TemplateName != nil { + in, out := &in.TemplateName, &out.TemplateName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CustomVerificationEmailTemplate. +func (in *CustomVerificationEmailTemplate) DeepCopy() *CustomVerificationEmailTemplate { + if in == nil { + return nil + } + out := new(CustomVerificationEmailTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ReceiptRuleSetMetadata) DeepCopyInto(out *ReceiptRuleSetMetadata) { + *out = *in + if in.CreatedTimestamp != nil { + in, out := &in.CreatedTimestamp, &out.CreatedTimestamp + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReceiptRuleSetMetadata. +func (in *ReceiptRuleSetMetadata) DeepCopy() *ReceiptRuleSetMetadata { + if in == nil { + return nil + } + out := new(ReceiptRuleSetMetadata) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SendDataPoint) DeepCopyInto(out *SendDataPoint) { + *out = *in + if in.Timestamp != nil { + in, out := &in.Timestamp, &out.Timestamp + *out = (*in).DeepCopy() + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SendDataPoint. +func (in *SendDataPoint) DeepCopy() *SendDataPoint { + if in == nil { + return nil + } + out := new(SendDataPoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Template) DeepCopyInto(out *Template) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template. +func (in *Template) DeepCopy() *Template { + if in == nil { + return nil + } + out := new(Template) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *Template) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateList) DeepCopyInto(out *TemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]Template, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateList. +func (in *TemplateList) DeepCopy() *TemplateList { + if in == nil { + return nil + } + out := new(TemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateMetadata) DeepCopyInto(out *TemplateMetadata) { + *out = *in + if in.CreatedTimestamp != nil { + in, out := &in.CreatedTimestamp, &out.CreatedTimestamp + *out = (*in).DeepCopy() + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateMetadata. +func (in *TemplateMetadata) DeepCopy() *TemplateMetadata { + if in == nil { + return nil + } + out := new(TemplateMetadata) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateObservation) DeepCopyInto(out *TemplateObservation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateObservation. +func (in *TemplateObservation) DeepCopy() *TemplateObservation { + if in == nil { + return nil + } + out := new(TemplateObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateParameters) DeepCopyInto(out *TemplateParameters) { + *out = *in + if in.Template != nil { + in, out := &in.Template, &out.Template + *out = new(Template_SDK) + (*in).DeepCopyInto(*out) + } + out.CustomTemplateParameters = in.CustomTemplateParameters +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateParameters. +func (in *TemplateParameters) DeepCopy() *TemplateParameters { + if in == nil { + return nil + } + out := new(TemplateParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateSpec) DeepCopyInto(out *TemplateSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateSpec. +func (in *TemplateSpec) DeepCopy() *TemplateSpec { + if in == nil { + return nil + } + out := new(TemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TemplateStatus) DeepCopyInto(out *TemplateStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + out.AtProvider = in.AtProvider +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TemplateStatus. +func (in *TemplateStatus) DeepCopy() *TemplateStatus { + if in == nil { + return nil + } + out := new(TemplateStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Template_SDK) DeepCopyInto(out *Template_SDK) { + *out = *in + if in.HTMLPart != nil { + in, out := &in.HTMLPart, &out.HTMLPart + *out = new(string) + **out = **in + } + if in.SubjectPart != nil { + in, out := &in.SubjectPart, &out.SubjectPart + *out = new(string) + **out = **in + } + if in.TemplateName != nil { + in, out := &in.TemplateName, &out.TemplateName + *out = new(string) + **out = **in + } + if in.TextPart != nil { + in, out := &in.TextPart, &out.TextPart + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Template_SDK. +func (in *Template_SDK) DeepCopy() *Template_SDK { + if in == nil { + return nil + } + out := new(Template_SDK) + in.DeepCopyInto(out) + return out +} diff --git a/apis/ses/v1alpha1/zz_generated.managed.go b/apis/ses/v1alpha1/zz_generated.managed.go new file mode 100644 index 0000000000..3188300257 --- /dev/null +++ b/apis/ses/v1alpha1/zz_generated.managed.go @@ -0,0 +1,77 @@ +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + +// GetCondition of this Template. +func (mg *Template) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this Template. +func (mg *Template) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetProviderConfigReference of this Template. +func (mg *Template) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +/* +GetProviderReference of this Template. +Deprecated: Use GetProviderConfigReference. +*/ +func (mg *Template) GetProviderReference() *xpv1.Reference { + return mg.Spec.ProviderReference +} + +// GetWriteConnectionSecretToReference of this Template. +func (mg *Template) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this Template. +func (mg *Template) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this Template. +func (mg *Template) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetProviderConfigReference of this Template. +func (mg *Template) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +/* +SetProviderReference of this Template. +Deprecated: Use SetProviderConfigReference. +*/ +func (mg *Template) SetProviderReference(r *xpv1.Reference) { + mg.Spec.ProviderReference = r +} + +// SetWriteConnectionSecretToReference of this Template. +func (mg *Template) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/ses/v1alpha1/zz_generated.managedlist.go b/apis/ses/v1alpha1/zz_generated.managedlist.go new file mode 100644 index 0000000000..a28719555e --- /dev/null +++ b/apis/ses/v1alpha1/zz_generated.managedlist.go @@ -0,0 +1,30 @@ +/* +Copyright 2020 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by angryjet. DO NOT EDIT. + +package v1alpha1 + +import resource "github.com/crossplane/crossplane-runtime/pkg/resource" + +// GetItems of this TemplateList. +func (l *TemplateList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} diff --git a/apis/ses/v1alpha1/zz_groupversion_info.go b/apis/ses/v1alpha1/zz_groupversion_info.go new file mode 100644 index 0000000000..6dddc25922 --- /dev/null +++ b/apis/ses/v1alpha1/zz_groupversion_info.go @@ -0,0 +1,41 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +// Package type metadata. +const ( + Group = "ses.aws.crossplane.io" + Version = "v1alpha1" +) + +var ( + // GroupVersion is the API Group Version used to register the objects + GroupVersion = schema.GroupVersion{Group: Group, Version: Version} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/apis/ses/v1alpha1/zz_template.go b/apis/ses/v1alpha1/zz_template.go new file mode 100644 index 0000000000..0352c8a09f --- /dev/null +++ b/apis/ses/v1alpha1/zz_template.go @@ -0,0 +1,89 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package v1alpha1 + +import ( + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// TemplateParameters defines the desired state of Template +type TemplateParameters struct { + // Region is which region the Template will be created. + // +kubebuilder:validation:Required + Region string `json:"region"` + // The content of the email, composed of a subject line, an HTML part, and a + // text-only part. + // +kubebuilder:validation:Required + Template *Template_SDK `json:"template"` + CustomTemplateParameters `json:",inline"` +} + +// TemplateSpec defines the desired state of Template +type TemplateSpec struct { + xpv1.ResourceSpec `json:",inline"` + ForProvider TemplateParameters `json:"forProvider"` +} + +// TemplateObservation defines the observed state of Template +type TemplateObservation struct { +} + +// TemplateStatus defines the observed state of Template. +type TemplateStatus struct { + xpv1.ResourceStatus `json:",inline"` + AtProvider TemplateObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true + +// Template is the Schema for the Templates 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:subresource:status +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,aws} +type Template struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec TemplateSpec `json:"spec"` + Status TemplateStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// TemplateList contains a list of Templates +type TemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []Template `json:"items"` +} + +// Repository type metadata. +var ( + TemplateKind = "Template" + TemplateGroupKind = schema.GroupKind{Group: Group, Kind: TemplateKind}.String() + TemplateKindAPIVersion = TemplateKind + "." + GroupVersion.String() + TemplateGroupVersionKind = GroupVersion.WithKind(TemplateKind) +) + +func init() { + SchemeBuilder.Register(&Template{}, &TemplateList{}) +} diff --git a/apis/ses/v1alpha1/zz_types.go b/apis/ses/v1alpha1/zz_types.go new file mode 100644 index 0000000000..84edf40cd4 --- /dev/null +++ b/apis/ses/v1alpha1/zz_types.go @@ -0,0 +1,56 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// Hack to avoid import errors during build... +var ( + _ = &metav1.Time{} +) + +type CustomVerificationEmailTemplate struct { + TemplateName *string `json:"templateName,omitempty"` +} + +type ReceiptRuleSetMetadata struct { + CreatedTimestamp *metav1.Time `json:"createdTimestamp,omitempty"` +} + +type SendDataPoint struct { + Timestamp *metav1.Time `json:"timestamp,omitempty"` +} + +type TemplateMetadata struct { + CreatedTimestamp *metav1.Time `json:"createdTimestamp,omitempty"` + + Name *string `json:"name,omitempty"` +} + +type Template_SDK struct { + HTMLPart *string `json:"htmlPart,omitempty"` + + SubjectPart *string `json:"subjectPart,omitempty"` + + TemplateName *string `json:"templateName,omitempty"` + + TextPart *string `json:"textPart,omitempty"` +} diff --git a/examples/ses/template.yaml b/examples/ses/template.yaml new file mode 100644 index 0000000000..a664379ac3 --- /dev/null +++ b/examples/ses/template.yaml @@ -0,0 +1,15 @@ +--- +apiVersion: ses.aws.crossplane.io/v1alpha1 +kind: Template +metadata: + name: example +spec: + forProvider: + region: us-east-2 + template: + templateName: example + htmlPart: "

sample html part

" + subjectPart: "sample subject part" + textPart: "sample text part" + providerConfigRef: + name: example diff --git a/package/crds/ses.aws.crossplane.io_templates.yaml b/package/crds/ses.aws.crossplane.io_templates.yaml new file mode 100644 index 0000000000..8a9d13efa5 --- /dev/null +++ b/package/crds/ses.aws.crossplane.io_templates.yaml @@ -0,0 +1,159 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.4.0 + creationTimestamp: null + name: templates.ses.aws.crossplane.io +spec: + group: ses.aws.crossplane.io + names: + categories: + - crossplane + - managed + - aws + kind: Template + listKind: TemplateList + plural: templates + singular: template + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: Template is the Schema for the Templates API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: TemplateSpec defines the desired state of Template + properties: + deletionPolicy: + default: Delete + description: DeletionPolicy specifies what will happen to the underlying external when this managed resource is deleted - either "Delete" or "Orphan" the external resource. + enum: + - Orphan + - Delete + type: string + forProvider: + description: TemplateParameters defines the desired state of Template + properties: + region: + description: Region is which region the Template will be created. + type: string + template: + description: The content of the email, composed of a subject line, an HTML part, and a text-only part. + properties: + htmlPart: + type: string + subjectPart: + type: string + templateName: + type: string + textPart: + type: string + type: object + required: + - region + - template + type: object + providerConfigRef: + default: + name: default + description: ProviderConfigReference specifies how the provider that will be used to create, observe, update, and delete this managed resource should be configured. + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + providerRef: + description: 'ProviderReference specifies the provider that will be used to create, observe, update, and delete this managed resource. Deprecated: Please use ProviderConfigReference, i.e. `providerConfigRef`' + properties: + name: + description: Name of the referenced object. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: WriteConnectionSecretToReference specifies the namespace and name of a Secret to which any connection details for this managed resource should be written. Connection details frequently include the endpoint, username, and password required to connect to the managed resource. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + status: + description: TemplateStatus defines the observed state of Template. + properties: + atProvider: + description: TemplateObservation defines the observed state of Template + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: LastTransitionTime is the last time this condition transitioned from one status to another. + format: date-time + type: string + message: + description: A Message containing details about this condition's last transition from one status to another, if any. + type: string + reason: + description: A Reason for this condition's last transition from one status to another. + type: string + status: + description: Status of this condition; is it currently True, False, or Unknown? + type: string + type: + description: Type of this condition. At most one of each condition type may apply to a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: [] + storedVersions: [] diff --git a/pkg/controller/aws.go b/pkg/controller/aws.go index 2bdf30d0b4..2c7095f773 100644 --- a/pkg/controller/aws.go +++ b/pkg/controller/aws.go @@ -94,6 +94,7 @@ import ( "github.com/crossplane/provider-aws/pkg/controller/servicediscovery/httpnamespace" "github.com/crossplane/provider-aws/pkg/controller/servicediscovery/privatednsnamespace" "github.com/crossplane/provider-aws/pkg/controller/servicediscovery/publicdnsnamespace" + "github.com/crossplane/provider-aws/pkg/controller/ses/template" "github.com/crossplane/provider-aws/pkg/controller/sfn/activity" "github.com/crossplane/provider-aws/pkg/controller/sfn/statemachine" "github.com/crossplane/provider-aws/pkg/controller/sqs/queue" @@ -175,6 +176,7 @@ func Setup(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll ti resolverendpoint.SetupResolverEndpoint, resolverrule.SetupResolverRule, kafkacluster.SetupCluster, + template.SetupTemplate, } { if err := setup(mgr, l, rl, poll); err != nil { return err diff --git a/pkg/controller/ses/template/setup.go b/pkg/controller/ses/template/setup.go new file mode 100644 index 0000000000..9e92592d15 --- /dev/null +++ b/pkg/controller/ses/template/setup.go @@ -0,0 +1,107 @@ +/* +Copyright 2021 The Crossplane Authors. +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package template + +import ( + "context" + "time" + + "github.com/google/go-cmp/cmp" + "k8s.io/client-go/util/workqueue" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/controller" + + svcsdk "github.com/aws/aws-sdk-go/service/ses" + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ses/v1alpha1" + aws "github.com/crossplane/provider-aws/pkg/clients" +) + +// SetupTemplate adds a controller that reconciles Template. +func SetupTemplate(mgr ctrl.Manager, l logging.Logger, rl workqueue.RateLimiter, poll time.Duration) error { + name := managed.ControllerName(svcapitypes.TemplateGroupKind) + opts := []option{ + func(e *external) { + e.postCreate = postCreate + e.preObserve = preObserve + e.postObserve = postObserve + e.preDelete = preDelete + e.isUpToDate = isUpToDate + + }, + } + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(controller.Options{ + RateLimiter: ratelimiter.NewDefaultManagedRateLimiter(rl), + }). + For(&svcapitypes.Template{}). + Complete(managed.NewReconciler(mgr, + resource.ManagedKind(svcapitypes.TemplateGroupVersionKind), + managed.WithInitializers(managed.NewDefaultProviderConfig(mgr.GetClient())), + managed.WithExternalConnecter(&connector{kube: mgr.GetClient(), opts: opts}), + managed.WithPollInterval(poll), + managed.WithLogger(l.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))))) +} + +func preObserve(_ context.Context, cr *svcapitypes.Template, obj *svcsdk.GetTemplateInput) error { + obj.TemplateName = aws.String(meta.GetExternalName(cr)) + return nil +} + +func postObserve(_ context.Context, cr *svcapitypes.Template, obj *svcsdk.GetTemplateOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + if err != nil { + return managed.ExternalObservation{}, err + } + cr.SetConditions(xpv1.Available()) + return obs, err +} + +func preDelete(context context.Context, cr *svcapitypes.Template, obj *svcsdk.DeleteTemplateInput) (bool, error) { + obj.TemplateName = aws.String(meta.GetExternalName(cr)) + return false, nil +} + +func postCreate(context context.Context, cr *svcapitypes.Template, obj *svcsdk.CreateTemplateOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + if err != nil { + return managed.ExternalCreation{}, err + } + meta.SetExternalName(cr, aws.StringValue(cr.Spec.ForProvider.Template.TemplateName)) + cre.ExternalNameAssigned = true + return cre, nil +} + +func isUpToDate(cr *svcapitypes.Template, obj *svcsdk.GetTemplateOutput) (bool, error) { + if !cmp.Equal(cr.Spec.ForProvider.Template.TemplateName, obj.Template.TemplateName) { + return false, nil + } + if !cmp.Equal(cr.Spec.ForProvider.Template.HTMLPart, obj.Template.HtmlPart) { + return false, nil + } + if !cmp.Equal(cr.Spec.ForProvider.Template.SubjectPart, obj.Template.SubjectPart) { + return false, nil + } + if !cmp.Equal(cr.Spec.ForProvider.Template.TextPart, obj.Template.TextPart) { + return false, nil + } + return true, nil +} diff --git a/pkg/controller/ses/template/zz_controller.go b/pkg/controller/ses/template/zz_controller.go new file mode 100644 index 0000000000..da8d5d3976 --- /dev/null +++ b/pkg/controller/ses/template/zz_controller.go @@ -0,0 +1,220 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package template + +import ( + "context" + + svcapi "github.com/aws/aws-sdk-go/service/ses" + svcsdk "github.com/aws/aws-sdk-go/service/ses" + svcsdkapi "github.com/aws/aws-sdk-go/service/ses/sesiface" + "github.com/google/go-cmp/cmp" + "github.com/pkg/errors" + "sigs.k8s.io/controller-runtime/pkg/client" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/meta" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + cpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + + svcapitypes "github.com/crossplane/provider-aws/apis/ses/v1alpha1" + awsclient "github.com/crossplane/provider-aws/pkg/clients" +) + +const ( + errUnexpectedObject = "managed resource is not an Template resource" + + errCreateSession = "cannot create a new session" + errCreate = "cannot create Template in AWS" + errUpdate = "cannot update Template in AWS" + errDescribe = "failed to describe Template" + errDelete = "failed to delete Template" +) + +type connector struct { + kube client.Client + opts []option +} + +func (c *connector) Connect(ctx context.Context, mg cpresource.Managed) (managed.ExternalClient, error) { + cr, ok := mg.(*svcapitypes.Template) + if !ok { + return nil, errors.New(errUnexpectedObject) + } + sess, err := awsclient.GetConfigV1(ctx, c.kube, mg, cr.Spec.ForProvider.Region) + if err != nil { + return nil, errors.Wrap(err, errCreateSession) + } + return newExternal(c.kube, svcapi.New(sess), c.opts), nil +} + +func (e *external) Observe(ctx context.Context, mg cpresource.Managed) (managed.ExternalObservation, error) { + cr, ok := mg.(*svcapitypes.Template) + if !ok { + return managed.ExternalObservation{}, errors.New(errUnexpectedObject) + } + if meta.GetExternalName(cr) == "" { + return managed.ExternalObservation{ + ResourceExists: false, + }, nil + } + input := GenerateGetTemplateInput(cr) + if err := e.preObserve(ctx, cr, input); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "pre-observe failed") + } + resp, err := e.client.GetTemplateWithContext(ctx, input) + if err != nil { + return managed.ExternalObservation{ResourceExists: false}, awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDescribe) + } + currentSpec := cr.Spec.ForProvider.DeepCopy() + if err := e.lateInitialize(&cr.Spec.ForProvider, resp); err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "late-init failed") + } + GenerateTemplate(resp).Status.AtProvider.DeepCopyInto(&cr.Status.AtProvider) + + upToDate, err := e.isUpToDate(cr, resp) + if err != nil { + return managed.ExternalObservation{}, errors.Wrap(err, "isUpToDate check failed") + } + return e.postObserve(ctx, cr, resp, managed.ExternalObservation{ + ResourceExists: true, + ResourceUpToDate: upToDate, + ResourceLateInitialized: !cmp.Equal(&cr.Spec.ForProvider, currentSpec), + }, nil) +} + +func (e *external) Create(ctx context.Context, mg cpresource.Managed) (managed.ExternalCreation, error) { + cr, ok := mg.(*svcapitypes.Template) + if !ok { + return managed.ExternalCreation{}, errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Creating()) + input := GenerateCreateTemplateInput(cr) + if err := e.preCreate(ctx, cr, input); err != nil { + return managed.ExternalCreation{}, errors.Wrap(err, "pre-create failed") + } + resp, err := e.client.CreateTemplateWithContext(ctx, input) + if err != nil { + return managed.ExternalCreation{}, awsclient.Wrap(err, errCreate) + } + + return e.postCreate(ctx, cr, resp, managed.ExternalCreation{}, err) +} + +func (e *external) Update(ctx context.Context, mg cpresource.Managed) (managed.ExternalUpdate, error) { + cr, ok := mg.(*svcapitypes.Template) + if !ok { + return managed.ExternalUpdate{}, errors.New(errUnexpectedObject) + } + input := GenerateUpdateTemplateInput(cr) + if err := e.preUpdate(ctx, cr, input); err != nil { + return managed.ExternalUpdate{}, errors.Wrap(err, "pre-update failed") + } + resp, err := e.client.UpdateTemplateWithContext(ctx, input) + return e.postUpdate(ctx, cr, resp, managed.ExternalUpdate{}, awsclient.Wrap(err, errUpdate)) +} + +func (e *external) Delete(ctx context.Context, mg cpresource.Managed) error { + cr, ok := mg.(*svcapitypes.Template) + if !ok { + return errors.New(errUnexpectedObject) + } + cr.Status.SetConditions(xpv1.Deleting()) + input := GenerateDeleteTemplateInput(cr) + ignore, err := e.preDelete(ctx, cr, input) + if err != nil { + return errors.Wrap(err, "pre-delete failed") + } + if ignore { + return nil + } + resp, err := e.client.DeleteTemplateWithContext(ctx, input) + return e.postDelete(ctx, cr, resp, awsclient.Wrap(cpresource.Ignore(IsNotFound, err), errDelete)) +} + +type option func(*external) + +func newExternal(kube client.Client, client svcsdkapi.SESAPI, opts []option) *external { + e := &external{ + kube: kube, + client: client, + preObserve: nopPreObserve, + postObserve: nopPostObserve, + lateInitialize: nopLateInitialize, + isUpToDate: alwaysUpToDate, + preCreate: nopPreCreate, + postCreate: nopPostCreate, + preDelete: nopPreDelete, + postDelete: nopPostDelete, + preUpdate: nopPreUpdate, + postUpdate: nopPostUpdate, + } + for _, f := range opts { + f(e) + } + return e +} + +type external struct { + kube client.Client + client svcsdkapi.SESAPI + preObserve func(context.Context, *svcapitypes.Template, *svcsdk.GetTemplateInput) error + postObserve func(context.Context, *svcapitypes.Template, *svcsdk.GetTemplateOutput, managed.ExternalObservation, error) (managed.ExternalObservation, error) + lateInitialize func(*svcapitypes.TemplateParameters, *svcsdk.GetTemplateOutput) error + isUpToDate func(*svcapitypes.Template, *svcsdk.GetTemplateOutput) (bool, error) + preCreate func(context.Context, *svcapitypes.Template, *svcsdk.CreateTemplateInput) error + postCreate func(context.Context, *svcapitypes.Template, *svcsdk.CreateTemplateOutput, managed.ExternalCreation, error) (managed.ExternalCreation, error) + preDelete func(context.Context, *svcapitypes.Template, *svcsdk.DeleteTemplateInput) (bool, error) + postDelete func(context.Context, *svcapitypes.Template, *svcsdk.DeleteTemplateOutput, error) error + preUpdate func(context.Context, *svcapitypes.Template, *svcsdk.UpdateTemplateInput) error + postUpdate func(context.Context, *svcapitypes.Template, *svcsdk.UpdateTemplateOutput, managed.ExternalUpdate, error) (managed.ExternalUpdate, error) +} + +func nopPreObserve(context.Context, *svcapitypes.Template, *svcsdk.GetTemplateInput) error { + return nil +} + +func nopPostObserve(_ context.Context, _ *svcapitypes.Template, _ *svcsdk.GetTemplateOutput, obs managed.ExternalObservation, err error) (managed.ExternalObservation, error) { + return obs, err +} +func nopLateInitialize(*svcapitypes.TemplateParameters, *svcsdk.GetTemplateOutput) error { + return nil +} +func alwaysUpToDate(*svcapitypes.Template, *svcsdk.GetTemplateOutput) (bool, error) { + return true, nil +} + +func nopPreCreate(context.Context, *svcapitypes.Template, *svcsdk.CreateTemplateInput) error { + return nil +} +func nopPostCreate(_ context.Context, _ *svcapitypes.Template, _ *svcsdk.CreateTemplateOutput, cre managed.ExternalCreation, err error) (managed.ExternalCreation, error) { + return cre, err +} +func nopPreDelete(context.Context, *svcapitypes.Template, *svcsdk.DeleteTemplateInput) (bool, error) { + return false, nil +} +func nopPostDelete(_ context.Context, _ *svcapitypes.Template, _ *svcsdk.DeleteTemplateOutput, err error) error { + return err +} +func nopPreUpdate(context.Context, *svcapitypes.Template, *svcsdk.UpdateTemplateInput) error { + return nil +} +func nopPostUpdate(_ context.Context, _ *svcapitypes.Template, _ *svcsdk.UpdateTemplateOutput, upd managed.ExternalUpdate, err error) (managed.ExternalUpdate, error) { + return upd, err +} diff --git a/pkg/controller/ses/template/zz_conversions.go b/pkg/controller/ses/template/zz_conversions.go new file mode 100644 index 0000000000..82774d2fb7 --- /dev/null +++ b/pkg/controller/ses/template/zz_conversions.go @@ -0,0 +1,105 @@ +/* +Copyright 2021 The Crossplane Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by ack-generate. DO NOT EDIT. + +package template + +import ( + "github.com/aws/aws-sdk-go/aws/awserr" + svcsdk "github.com/aws/aws-sdk-go/service/ses" + + svcapitypes "github.com/crossplane/provider-aws/apis/ses/v1alpha1" +) + +// NOTE(muvaf): We return pointers in case the function needs to start with an +// empty object, hence need to return a new pointer. + +// GenerateGetTemplateInput returns input for read +// operation. +func GenerateGetTemplateInput(cr *svcapitypes.Template) *svcsdk.GetTemplateInput { + res := &svcsdk.GetTemplateInput{} + + return res +} + +// GenerateTemplate returns the current state in the form of *svcapitypes.Template. +func GenerateTemplate(resp *svcsdk.GetTemplateOutput) *svcapitypes.Template { + cr := &svcapitypes.Template{} + + return cr +} + +// GenerateCreateTemplateInput returns a create input. +func GenerateCreateTemplateInput(cr *svcapitypes.Template) *svcsdk.CreateTemplateInput { + res := &svcsdk.CreateTemplateInput{} + + if cr.Spec.ForProvider.Template != nil { + f0 := &svcsdk.Template{} + if cr.Spec.ForProvider.Template.HTMLPart != nil { + f0.SetHtmlPart(*cr.Spec.ForProvider.Template.HTMLPart) + } + if cr.Spec.ForProvider.Template.SubjectPart != nil { + f0.SetSubjectPart(*cr.Spec.ForProvider.Template.SubjectPart) + } + if cr.Spec.ForProvider.Template.TemplateName != nil { + f0.SetTemplateName(*cr.Spec.ForProvider.Template.TemplateName) + } + if cr.Spec.ForProvider.Template.TextPart != nil { + f0.SetTextPart(*cr.Spec.ForProvider.Template.TextPart) + } + res.SetTemplate(f0) + } + + return res +} + +// GenerateUpdateTemplateInput returns an update input. +func GenerateUpdateTemplateInput(cr *svcapitypes.Template) *svcsdk.UpdateTemplateInput { + res := &svcsdk.UpdateTemplateInput{} + + if cr.Spec.ForProvider.Template != nil { + f0 := &svcsdk.Template{} + if cr.Spec.ForProvider.Template.HTMLPart != nil { + f0.SetHtmlPart(*cr.Spec.ForProvider.Template.HTMLPart) + } + if cr.Spec.ForProvider.Template.SubjectPart != nil { + f0.SetSubjectPart(*cr.Spec.ForProvider.Template.SubjectPart) + } + if cr.Spec.ForProvider.Template.TemplateName != nil { + f0.SetTemplateName(*cr.Spec.ForProvider.Template.TemplateName) + } + if cr.Spec.ForProvider.Template.TextPart != nil { + f0.SetTextPart(*cr.Spec.ForProvider.Template.TextPart) + } + res.SetTemplate(f0) + } + + return res +} + +// GenerateDeleteTemplateInput returns a deletion input. +func GenerateDeleteTemplateInput(cr *svcapitypes.Template) *svcsdk.DeleteTemplateInput { + res := &svcsdk.DeleteTemplateInput{} + + return res +} + +// IsNotFound returns whether the given error is of type NotFound or not. +func IsNotFound(err error) bool { + awsErr, ok := err.(awserr.Error) + return ok && awsErr.Code() == "TemplateDoesNotExist" +}