diff --git a/api/v1alpha1/toolchainconfig_types.go b/api/v1alpha1/toolchainconfig_types.go index 3033dc00..ab5c90ee 100644 --- a/api/v1alpha1/toolchainconfig_types.go +++ b/api/v1alpha1/toolchainconfig_types.go @@ -364,12 +364,36 @@ type RegistrationServiceVerificationConfig struct { // AWSSenderID the Alphanumeric Sender ID to use, e.g. "DevSandbox" // +optional - AWSSenderID *string `json:"awsSenderId,omitempty"` + AWSSenderID *string `json:"awsSenderID,omitempty"` // AWSSMSType is the type of SMS message to send, either `Promotional` or `Transactional` // See https://docs.aws.amazon.com/sns/latest/dg/sms_publish-to-phone.html for details // +optional AWSSMSType *string `json:"awsSMSType,omitempty"` + + // TwilioSenderConfigs is an array of TwilioSenderConfig objects + // +optional + // +listType=atomic + TwilioSenderConfigs []TwilioSenderConfig `json:"twilioSenderConfigs,omitempty"` +} + +// TwilioSenderConfig is used to associate a particular sender ID (a sender ID is a text value that appears instead of +// a phone number when receiving an SMS message), for example "RED HAT", with an array of country +// code values for which the Sender ID value will be set via the Twilio API when sending a verification code to a user in +// any of the country codes specified. +// +// Since some countries are starting to block long form phone numbers (i.e. SMS messages from international phone numbers) +// the Sender ID may be an acceptable alternative to requiring the verification message to be sent from a local phone number. +// +// +k8s:openapi-gen=true +type TwilioSenderConfig struct { + // SenderID + SenderID string `json:"senderID"` + + // CountryCodes + // +optional + // +listType=set + CountryCodes []string `json:"countryCodes,omitempty"` } // Defines all secrets related to registration service verification configuration diff --git a/api/v1alpha1/zz_generated.deepcopy.go b/api/v1alpha1/zz_generated.deepcopy.go index 4d081831..73e2d14e 100644 --- a/api/v1alpha1/zz_generated.deepcopy.go +++ b/api/v1alpha1/zz_generated.deepcopy.go @@ -2034,6 +2034,13 @@ func (in *RegistrationServiceVerificationConfig) DeepCopyInto(out *RegistrationS *out = new(string) **out = **in } + if in.TwilioSenderConfigs != nil { + in, out := &in.TwilioSenderConfigs, &out.TwilioSenderConfigs + *out = make([]TwilioSenderConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RegistrationServiceVerificationConfig. @@ -3253,6 +3260,26 @@ func (in *ToolchainStatusStatus) DeepCopy() *ToolchainStatusStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TwilioSenderConfig) DeepCopyInto(out *TwilioSenderConfig) { + *out = *in + if in.CountryCodes != nil { + in, out := &in.CountryCodes, &out.CountryCodes + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TwilioSenderConfig. +func (in *TwilioSenderConfig) DeepCopy() *TwilioSenderConfig { + if in == nil { + return nil + } + out := new(TwilioSenderConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *UserAccount) DeepCopyInto(out *UserAccount) { *out = *in diff --git a/api/v1alpha1/zz_generated.openapi.go b/api/v1alpha1/zz_generated.openapi.go index ec8be80f..bbab9a41 100644 --- a/api/v1alpha1/zz_generated.openapi.go +++ b/api/v1alpha1/zz_generated.openapi.go @@ -121,6 +121,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/codeready-toolchain/api/api/v1alpha1.ToolchainStatusConfig": schema_codeready_toolchain_api_api_v1alpha1_ToolchainStatusConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.ToolchainStatusSpec": schema_codeready_toolchain_api_api_v1alpha1_ToolchainStatusSpec(ref), "github.com/codeready-toolchain/api/api/v1alpha1.ToolchainStatusStatus": schema_codeready_toolchain_api_api_v1alpha1_ToolchainStatusStatus(ref), + "github.com/codeready-toolchain/api/api/v1alpha1.TwilioSenderConfig": schema_codeready_toolchain_api_api_v1alpha1_TwilioSenderConfig(ref), "github.com/codeready-toolchain/api/api/v1alpha1.UserAccount": schema_codeready_toolchain_api_api_v1alpha1_UserAccount(ref), "github.com/codeready-toolchain/api/api/v1alpha1.UserAccountSpec": schema_codeready_toolchain_api_api_v1alpha1_UserAccountSpec(ref), "github.com/codeready-toolchain/api/api/v1alpha1.UserAccountStatus": schema_codeready_toolchain_api_api_v1alpha1_UserAccountStatus(ref), @@ -2706,7 +2707,7 @@ func schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceVerification Format: "", }, }, - "awsSenderId": { + "awsSenderID": { SchemaProps: spec.SchemaProps{ Description: "AWSSenderID the Alphanumeric Sender ID to use, e.g. \"DevSandbox\"", Type: []string{"string"}, @@ -2720,11 +2721,30 @@ func schema_codeready_toolchain_api_api_v1alpha1_RegistrationServiceVerification Format: "", }, }, + "twilioSenderConfigs": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "atomic", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "TwilioSenderConfigs is an array of TwilioSenderConfig objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/codeready-toolchain/api/api/v1alpha1.TwilioSenderConfig"), + }, + }, + }, + }, + }, }, }, }, Dependencies: []string{ - "github.com/codeready-toolchain/api/api/v1alpha1.CaptchaConfig", "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceVerificationSecret"}, + "github.com/codeready-toolchain/api/api/v1alpha1.CaptchaConfig", "github.com/codeready-toolchain/api/api/v1alpha1.RegistrationServiceVerificationSecret", "github.com/codeready-toolchain/api/api/v1alpha1.TwilioSenderConfig"}, } } @@ -4352,6 +4372,48 @@ func schema_codeready_toolchain_api_api_v1alpha1_ToolchainStatusStatus(ref commo } } +func schema_codeready_toolchain_api_api_v1alpha1_TwilioSenderConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "TwilioSenderConfig is used to associate a particular sender ID (a sender ID is a text value that appears instead of a phone number when receiving an SMS message), for example \"RED HAT\", with an array of country code values for which the Sender ID value will be set via the Twilio API when sending a verification code to a user in any of the country codes specified.\n\nSince some countries are starting to block long form phone numbers (i.e. SMS messages from international phone numbers) the Sender ID may be an acceptable alternative to requiring the verification message to be sent from a local phone number.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "senderID": { + SchemaProps: spec.SchemaProps{ + Description: "SenderID", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "countryCodes": { + VendorExtensible: spec.VendorExtensible{ + Extensions: spec.Extensions{ + "x-kubernetes-list-type": "set", + }, + }, + SchemaProps: spec.SchemaProps{ + Description: "CountryCodes", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + }, + Required: []string{"senderID"}, + }, + }, + } +} + func schema_codeready_toolchain_api_api_v1alpha1_UserAccount(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{