From 84c5911633d0951e17026c6c67afd9000096efd1 Mon Sep 17 00:00:00 2001 From: Matthias Wessendorf Date: Wed, 13 Nov 2024 11:48:22 +0100 Subject: [PATCH] Moving API to a versioned common/integration folder Signed-off-by: Matthias Wessendorf --- docs/eventing-api.md | 580 +----------------- pkg/apis/common/integration/v1alpha1/auth.go | 43 ++ pkg/apis/common/integration/v1alpha1/aws.go | 64 ++ pkg/apis/common/integration/v1alpha1/doc.go | 19 + .../v1alpha1/zz_generated.deepcopy.go | 147 +++++ .../sources/v1alpha1/integration_types.go | 82 +-- .../v1alpha1/integration_types_test.go | 19 +- .../v1alpha1/integration_validation_test.go | 81 +-- .../sources/v1alpha1/zz_generated.deepcopy.go | 134 +--- 9 files changed, 338 insertions(+), 831 deletions(-) create mode 100644 pkg/apis/common/integration/v1alpha1/auth.go create mode 100644 pkg/apis/common/integration/v1alpha1/aws.go create mode 100644 pkg/apis/common/integration/v1alpha1/doc.go create mode 100644 pkg/apis/common/integration/v1alpha1/zz_generated.deepcopy.go diff --git a/docs/eventing-api.md b/docs/eventing-api.md index 41220eef825..3f8b50e80a4 100644 --- a/docs/eventing-api.md +++ b/docs/eventing-api.md @@ -7408,512 +7408,6 @@ IntegrationSourceStatus -

AWSCommon -

-

-(Appears on:AWSDDBStreams, AWSS3, AWSSQS) -

-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-region
- -string - -
-

Auth is the S3 authentication (accessKey/secretKey) configuration.

-
-profileCredentialsName
- -string - -
-

AWS region

-
-sessionToken
- -string - -
-

Profile name for profile credentials provider

-
-uriEndpointOverride
- -string - -
-

Session token

-
-overrideEndpoint
- -bool - -
-

Override endpoint URI

-
-

AWSDDBStreams -

-

-(Appears on:Aws) -

-

-

- - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-AWSCommon
- - -AWSCommon - - -
-

-(Members of AWSCommon are embedded into this type.) -

-
-table
- -string - -
-

Embeds AWSCommon to inherit its fields in JSON

-
-streamIteratorType
- -string - -
-

The name of the DynamoDB table

-
-delay
- -int - -
-

Defines where in the DynamoDB stream to start getting records

-
-

AWSS3 -

-

-(Appears on:Aws) -

-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-AWSCommon
- - -AWSCommon - - -
-

-(Members of AWSCommon are embedded into this type.) -

-
-arn
- -string - -
-

Embeds AWSCommon to inherit its fields in JSON

-
-deleteAfterRead
- -bool - -
-

S3 ARN

-
-moveAfterRead
- -bool - -
-

Auto-delete objects after reading

-
-destinationBucket
- -string - -
-

Move objects after reading

-
-destinationBucketPrefix
- -string - -
-

Destination bucket for moved objects

-
-destinationBucketSuffix
- -string - -
-

Prefix for moved objects

-
-autoCreateBucket
- -bool - -
-

Suffix for moved objects

-
-prefix
- -string - -
-

Auto-create S3 bucket

-
-ignoreBody
- -bool - -
-

S3 bucket prefix for search

-
-forcePathStyle
- -bool - -
-

Ignore object body

-
-delay
- -int - -
-

Force path style for bucket access

-
-maxMessagesPerPoll
- -int - -
-

Delay between polls in milliseconds

-
-

AWSSQS -

-

-(Appears on:Aws) -

-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-AWSCommon
- - -AWSCommon - - -
-

-(Members of AWSCommon are embedded into this type.) -

-
-arn
- -string - -
-

Embeds AWSCommon to inherit its fields in JSON

-
-deleteAfterRead
- -bool - -
-

SQS ARN

-
-autoCreateQueue
- -bool - -
-

Auto-delete messages after reading

-
-host
- -string - -
-

Auto-create SQS queue

-
-protocol
- -string - -
-

AWS host

-
-queueURL
- -string - -
-

Communication protocol (http/https)

-
-greedy
- -bool - -
-

Full SQS queue URL

-
-delay
- -int - -
-

Greedy scheduler

-
-maxMessagesPerPoll
- -int - -
-

Delay between polls in milliseconds

-
-waitTimeSeconds
- -int - -
-

Max messages to return (1-10)

-
-visibilityTimeout
- -int - -
-

Wait time for messages

-
-

Auth -

-

-(Appears on:Aws) -

-

-

- - - - - - - - - - - - - - - - - - - - - -
FieldDescription
-secret
- - -Secret - - -
-

Auth Secret

-
-accessKey
- -string - -
-

AccessKey is the AWS access key ID.

-
-secretKey
- -string - -
-

SecretKey is the AWS secret access key.

-

Aws

@@ -7933,9 +7427,7 @@ string s3
- -AWSS3 - +knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSS3 @@ -7945,9 +7437,7 @@ AWSS3 sqs
- -AWSSQS - +knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSSQS @@ -7958,9 +7448,7 @@ AWSSQS ddbStreams
- -AWSDDBStreams - +knative.dev/eventing/pkg/apis/common/integration/v1alpha1.AWSDDBStreams @@ -7971,9 +7459,7 @@ AWSDDBStreams auth
- -Auth - +knative.dev/eventing/pkg/apis/common/integration/v1alpha1.Auth @@ -8085,64 +7571,6 @@ Source.

-

Secret -

-

-(Appears on:Auth) -

-

-

- - - - - - - - - - - - - -
FieldDescription
-ref
- - -SecretReference - - -
-

Secret reference for SASL and SSL configurations.

-
-

SecretReference -

-

-(Appears on:Secret) -

-

-

- - - - - - - - - - - - - -
FieldDescription
-name
- -string - -
-

Secret name.

-

Timer

diff --git a/pkg/apis/common/integration/v1alpha1/auth.go b/pkg/apis/common/integration/v1alpha1/auth.go new file mode 100644 index 00000000000..8f815119bc9 --- /dev/null +++ b/pkg/apis/common/integration/v1alpha1/auth.go @@ -0,0 +1,43 @@ +/* +Copyright 2024 The Knative 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 + +type Auth struct { + // Auth Secret + Secret *Secret `json:"secret,omitempty"` + + // AccessKey is the AWS access key ID. + AccessKey string `json:"accessKey,omitempty"` + + // SecretKey is the AWS secret access key. + SecretKey string `json:"secretKey,omitempty"` +} + +func (a *Auth) HasAuth() bool { + return a != nil && a.Secret != nil && + a.Secret.Ref != nil && a.Secret.Ref.Name != "" +} + +type Secret struct { + // Secret reference for SASL and SSL configurations. + Ref *SecretReference `json:"ref,omitempty"` +} + +type SecretReference struct { + // Secret name. + Name string `json:"name"` +} diff --git a/pkg/apis/common/integration/v1alpha1/aws.go b/pkg/apis/common/integration/v1alpha1/aws.go new file mode 100644 index 00000000000..056ef5b4ea3 --- /dev/null +++ b/pkg/apis/common/integration/v1alpha1/aws.go @@ -0,0 +1,64 @@ +/* +Copyright 2024 The Knative 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 + +type AWSCommon struct { + // Auth is the S3 authentication (accessKey/secretKey) configuration. + Region string `json:"region,omitempty"` // AWS region + ProfileCredentialsName string `json:"profileCredentialsName,omitempty"` // Profile name for profile credentials provider + SessionToken string `json:"sessionToken,omitempty"` // Session token + URIEndpointOverride string `json:"uriEndpointOverride,omitempty"` // Override endpoint URI + OverrideEndpoint bool `json:"overrideEndpoint" default:"false"` // Override endpoint flag +} + +type AWSS3 struct { + AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON + Arn string `json:"arn,omitempty" camel:"CAMEL_KAMELET_AWS_S3_SOURCE_BUCKETNAMEORARN"` // S3 ARN + DeleteAfterRead bool `json:"deleteAfterRead" default:"true"` // Auto-delete objects after reading + MoveAfterRead bool `json:"moveAfterRead" default:"false"` // Move objects after reading + DestinationBucket string `json:"destinationBucket,omitempty"` // Destination bucket for moved objects + DestinationBucketPrefix string `json:"destinationBucketPrefix,omitempty"` // Prefix for moved objects + DestinationBucketSuffix string `json:"destinationBucketSuffix,omitempty"` // Suffix for moved objects + AutoCreateBucket bool `json:"autoCreateBucket" default:"false"` // Auto-create S3 bucket + Prefix string `json:"prefix,omitempty"` // S3 bucket prefix for search + IgnoreBody bool `json:"ignoreBody" default:"false"` // Ignore object body + ForcePathStyle bool `json:"forcePathStyle" default:"false"` // Force path style for bucket access + Delay int `json:"delay" default:"500"` // Delay between polls in milliseconds + MaxMessagesPerPoll int `json:"maxMessagesPerPoll" default:"10"` // Max messages to poll per request +} + +type AWSSQS struct { + AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON + Arn string `json:"arn,omitempty" camel:"CAMEL_KAMELET_AWS_SQS_SOURCE_QUEUENAMEORARN"` // SQS ARN + DeleteAfterRead bool `json:"deleteAfterRead" default:"true"` // Auto-delete messages after reading + AutoCreateQueue bool `json:"autoCreateQueue" default:"false"` // Auto-create SQS queue + Host string `json:"host" camel:"CAMEL_KAMELET_AWS_SQS_SOURCE_AMAZONAWSHOST" default:"amazonaws.com"` // AWS host + Protocol string `json:"protocol" default:"https"` // Communication protocol (http/https) + QueueURL string `json:"queueURL,omitempty"` // Full SQS queue URL + Greedy bool `json:"greedy" default:"false"` // Greedy scheduler + Delay int `json:"delay" default:"500"` // Delay between polls in milliseconds + MaxMessagesPerPoll int `json:"maxMessagesPerPoll" default:"1"` // Max messages to return (1-10) + WaitTimeSeconds int `json:"waitTimeSeconds,omitempty"` // Wait time for messages + VisibilityTimeout int `json:"visibilityTimeout,omitempty"` // Visibility timeout in seconds +} + +type AWSDDBStreams struct { + AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON + Table string `json:"table,omitempty"` // The name of the DynamoDB table + StreamIteratorType string `json:"streamIteratorType,omitempty" default:"FROM_LATEST"` // Defines where in the DynamoDB stream to start getting records + Delay int `json:"delay,omitempty" default:"500"` // Delay in milliseconds before the next poll from the database +} diff --git a/pkg/apis/common/integration/v1alpha1/doc.go b/pkg/apis/common/integration/v1alpha1/doc.go new file mode 100644 index 00000000000..3366df6745c --- /dev/null +++ b/pkg/apis/common/integration/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2024 The Knative 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. +*/ + +// +k8s:deepcopy-gen=package + +package v1alpha1 diff --git a/pkg/apis/common/integration/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/common/integration/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..5d0f7dde59c --- /dev/null +++ b/pkg/apis/common/integration/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,147 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2021 The Knative 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 deepcopy-gen. DO NOT EDIT. + +package v1alpha1 + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSCommon) DeepCopyInto(out *AWSCommon) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSCommon. +func (in *AWSCommon) DeepCopy() *AWSCommon { + if in == nil { + return nil + } + out := new(AWSCommon) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSDDBStreams) DeepCopyInto(out *AWSDDBStreams) { + *out = *in + out.AWSCommon = in.AWSCommon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSDDBStreams. +func (in *AWSDDBStreams) DeepCopy() *AWSDDBStreams { + if in == nil { + return nil + } + out := new(AWSDDBStreams) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSS3) DeepCopyInto(out *AWSS3) { + *out = *in + out.AWSCommon = in.AWSCommon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSS3. +func (in *AWSS3) DeepCopy() *AWSS3 { + if in == nil { + return nil + } + out := new(AWSS3) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AWSSQS) DeepCopyInto(out *AWSSQS) { + *out = *in + out.AWSCommon = in.AWSCommon + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSSQS. +func (in *AWSSQS) DeepCopy() *AWSSQS { + if in == nil { + return nil + } + out := new(AWSSQS) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Auth) DeepCopyInto(out *Auth) { + *out = *in + if in.Secret != nil { + in, out := &in.Secret, &out.Secret + *out = new(Secret) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Auth. +func (in *Auth) DeepCopy() *Auth { + if in == nil { + return nil + } + out := new(Auth) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Secret) DeepCopyInto(out *Secret) { + *out = *in + if in.Ref != nil { + in, out := &in.Ref, &out.Ref + *out = new(SecretReference) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret. +func (in *Secret) DeepCopy() *Secret { + if in == nil { + return nil + } + out := new(Secret) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SecretReference) DeepCopyInto(out *SecretReference) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. +func (in *SecretReference) DeepCopy() *SecretReference { + if in == nil { + return nil + } + out := new(SecretReference) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/apis/sources/v1alpha1/integration_types.go b/pkg/apis/sources/v1alpha1/integration_types.go index 1db79bc8096..2eec773bcb5 100644 --- a/pkg/apis/sources/v1alpha1/integration_types.go +++ b/pkg/apis/sources/v1alpha1/integration_types.go @@ -20,6 +20,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" "knative.dev/pkg/apis" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/kmeta" @@ -68,84 +69,11 @@ type Timer struct { RepeatCount int `json:"repeatCount,omitempty"` // Max number of fires (optional) } -type AWSCommon struct { - // Auth is the S3 authentication (accessKey/secretKey) configuration. - Region string `json:"region,omitempty"` // AWS region - ProfileCredentialsName string `json:"profileCredentialsName,omitempty"` // Profile name for profile credentials provider - SessionToken string `json:"sessionToken,omitempty"` // Session token - URIEndpointOverride string `json:"uriEndpointOverride,omitempty"` // Override endpoint URI - OverrideEndpoint bool `json:"overrideEndpoint" default:"false"` // Override endpoint flag -} - -type AWSS3 struct { - AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON - Arn string `json:"arn,omitempty" camel:"CAMEL_KAMELET_AWS_S3_SOURCE_BUCKETNAMEORARN"` // S3 ARN - DeleteAfterRead bool `json:"deleteAfterRead" default:"true"` // Auto-delete objects after reading - MoveAfterRead bool `json:"moveAfterRead" default:"false"` // Move objects after reading - DestinationBucket string `json:"destinationBucket,omitempty"` // Destination bucket for moved objects - DestinationBucketPrefix string `json:"destinationBucketPrefix,omitempty"` // Prefix for moved objects - DestinationBucketSuffix string `json:"destinationBucketSuffix,omitempty"` // Suffix for moved objects - AutoCreateBucket bool `json:"autoCreateBucket" default:"false"` // Auto-create S3 bucket - Prefix string `json:"prefix,omitempty"` // S3 bucket prefix for search - IgnoreBody bool `json:"ignoreBody" default:"false"` // Ignore object body - ForcePathStyle bool `json:"forcePathStyle" default:"false"` // Force path style for bucket access - Delay int `json:"delay" default:"500"` // Delay between polls in milliseconds - MaxMessagesPerPoll int `json:"maxMessagesPerPoll" default:"10"` // Max messages to poll per request -} - -type AWSSQS struct { - AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON - Arn string `json:"arn,omitempty" camel:"CAMEL_KAMELET_AWS_SQS_SOURCE_QUEUENAMEORARN"` // SQS ARN - DeleteAfterRead bool `json:"deleteAfterRead" default:"true"` // Auto-delete messages after reading - AutoCreateQueue bool `json:"autoCreateQueue" default:"false"` // Auto-create SQS queue - Host string `json:"host" camel:"CAMEL_KAMELET_AWS_SQS_SOURCE_AMAZONAWSHOST" default:"amazonaws.com"` // AWS host - Protocol string `json:"protocol" default:"https"` // Communication protocol (http/https) - QueueURL string `json:"queueURL,omitempty"` // Full SQS queue URL - Greedy bool `json:"greedy" default:"false"` // Greedy scheduler - Delay int `json:"delay" default:"500"` // Delay between polls in milliseconds - MaxMessagesPerPoll int `json:"maxMessagesPerPoll" default:"1"` // Max messages to return (1-10) - WaitTimeSeconds int `json:"waitTimeSeconds,omitempty"` // Wait time for messages - VisibilityTimeout int `json:"visibilityTimeout,omitempty"` // Visibility timeout in seconds -} - -type AWSDDBStreams struct { - AWSCommon `json:",inline"` // Embeds AWSCommon to inherit its fields in JSON - Table string `json:"table,omitempty"` // The name of the DynamoDB table - StreamIteratorType string `json:"streamIteratorType,omitempty" default:"FROM_LATEST"` // Defines where in the DynamoDB stream to start getting records - Delay int `json:"delay,omitempty" default:"500"` // Delay in milliseconds before the next poll from the database -} - type Aws struct { - S3 *AWSS3 `json:"s3,omitempty"` // S3 source configuration - SQS *AWSSQS `json:"sqs,omitempty"` // SQS source configuration - DDBStreams *AWSDDBStreams `json:"ddbStreams,omitempty"` // DynamoDB Streams source configuration - Auth *Auth `json:"auth,omitempty"` -} - -type Auth struct { - // Auth Secret - Secret *Secret `json:"secret,omitempty"` - - // AccessKey is the AWS access key ID. - AccessKey string `json:"accessKey,omitempty"` - - // SecretKey is the AWS secret access key. - SecretKey string `json:"secretKey,omitempty"` -} - -func (a *Auth) HasAuth() bool { - return a != nil && a.Secret != nil && - a.Secret.Ref != nil && a.Secret.Ref.Name != "" -} - -type Secret struct { - // Secret reference for SASL and SSL configurations. - Ref *SecretReference `json:"ref,omitempty"` -} - -type SecretReference struct { - // Secret name. - Name string `json:"name"` + S3 *v1alpha1.AWSS3 `json:"s3,omitempty"` // S3 source configuration + SQS *v1alpha1.AWSSQS `json:"sqs,omitempty"` // SQS source configuration + DDBStreams *v1alpha1.AWSDDBStreams `json:"ddbStreams,omitempty"` // DynamoDB Streams source configuration + Auth *v1alpha1.Auth `json:"auth,omitempty"` } // GetGroupVersionKind returns the GroupVersionKind. diff --git a/pkg/apis/sources/v1alpha1/integration_types_test.go b/pkg/apis/sources/v1alpha1/integration_types_test.go index 7a0d9f35479..4dfd20ea801 100644 --- a/pkg/apis/sources/v1alpha1/integration_types_test.go +++ b/pkg/apis/sources/v1alpha1/integration_types_test.go @@ -17,6 +17,7 @@ limitations under the License. package v1alpha1 import ( + "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" "testing" ) @@ -53,8 +54,8 @@ func TestTimer(t *testing.T) { } func TestAWS(t *testing.T) { - s3 := AWSS3{ - AWSCommon: AWSCommon{ + s3 := v1alpha1.AWSS3{ + AWSCommon: v1alpha1.AWSCommon{ Region: "eu-north-1", }, Arn: "example-bucket", @@ -64,8 +65,8 @@ func TestAWS(t *testing.T) { t.Errorf("AWSS3.Region = %v, want 'eu-north-1'", s3.Region) } - sqs := AWSSQS{ - AWSCommon: AWSCommon{ + sqs := v1alpha1.AWSSQS{ + AWSCommon: v1alpha1.AWSCommon{ Region: "eu-north-1", }, Arn: "example-queue", @@ -75,8 +76,8 @@ func TestAWS(t *testing.T) { t.Errorf("AWSSQS.Region = %v, want 'eu-north-1'", sqs.Region) } - ddbStreams := AWSDDBStreams{ - AWSCommon: AWSCommon{ + ddbStreams := v1alpha1.AWSDDBStreams{ + AWSCommon: v1alpha1.AWSCommon{ Region: "eu-north-1", }, Table: "example-table", @@ -89,9 +90,9 @@ func TestAWS(t *testing.T) { // TestAuthFieldAccess tests the HasAuth method and field access in Auth struct func TestAuthFieldAccess(t *testing.T) { - auth := Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + auth := v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, diff --git a/pkg/apis/sources/v1alpha1/integration_validation_test.go b/pkg/apis/sources/v1alpha1/integration_validation_test.go index c2a932af3d2..3281b3940fb 100644 --- a/pkg/apis/sources/v1alpha1/integration_validation_test.go +++ b/pkg/apis/sources/v1alpha1/integration_validation_test.go @@ -18,6 +18,7 @@ package v1alpha1 import ( "context" + "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" "testing" "github.com/google/go-cmp/cmp" @@ -45,15 +46,15 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "valid AWS S3 source with auth and region", spec: IntegrationSourceSpec{ Aws: &Aws{ - S3: &AWSS3{ - AWSCommon: AWSCommon{ + S3: &v1alpha1.AWSS3{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-bucket", }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -66,15 +67,15 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "valid AWS SQS source with auth and region", spec: IntegrationSourceSpec{ Aws: &Aws{ - SQS: &AWSSQS{ - AWSCommon: AWSCommon{ + SQS: &v1alpha1.AWSSQS{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-queue", }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -87,15 +88,15 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "valid AWS DDBStreams source with auth and region", spec: IntegrationSourceSpec{ Aws: &Aws{ - DDBStreams: &AWSDDBStreams{ - AWSCommon: AWSCommon{ + DDBStreams: &v1alpha1.AWSDDBStreams{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Table: "example-table", }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -113,8 +114,8 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { ContentType: "text/plain", }, Aws: &Aws{ - S3: &AWSS3{ - AWSCommon: AWSCommon{ + S3: &v1alpha1.AWSS3{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-bucket", @@ -127,21 +128,21 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "multiple AWS sources set (invalid)", spec: IntegrationSourceSpec{ Aws: &Aws{ - S3: &AWSS3{ - AWSCommon: AWSCommon{ + S3: &v1alpha1.AWSS3{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-bucket", }, - SQS: &AWSSQS{ - AWSCommon: AWSCommon{ + SQS: &v1alpha1.AWSSQS{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-queue", }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -154,14 +155,14 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "AWS SQS source without QueueNameOrArn (invalid)", spec: IntegrationSourceSpec{ Aws: &Aws{ - SQS: &AWSSQS{ - AWSCommon: AWSCommon{ + SQS: &v1alpha1.AWSSQS{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -174,14 +175,14 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "AWS DDBStreams source without Table (invalid)", spec: IntegrationSourceSpec{ Aws: &Aws{ - DDBStreams: &AWSDDBStreams{ - AWSCommon: AWSCommon{ + DDBStreams: &v1alpha1.AWSDDBStreams{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, @@ -199,8 +200,8 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "AWS source without auth (invalid)", spec: IntegrationSourceSpec{ Aws: &Aws{ - S3: &AWSS3{ - AWSCommon: AWSCommon{ + S3: &v1alpha1.AWSS3{ + AWSCommon: v1alpha1.AWSCommon{ Region: "us-east-1", }, Arn: "example-bucket", @@ -213,12 +214,12 @@ func TestIntegrationSourceSpecValidation(t *testing.T) { name: "AWS S3 source without region (invalid)", spec: IntegrationSourceSpec{ Aws: &Aws{ - S3: &AWSS3{ + S3: &v1alpha1.AWSS3{ Arn: "example-bucket", }, - Auth: &Auth{ - Secret: &Secret{ - Ref: &SecretReference{ + Auth: &v1alpha1.Auth{ + Secret: &v1alpha1.Secret{ + Ref: &v1alpha1.SecretReference{ Name: "aws-secret", }, }, diff --git a/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go index 5fe9cf729af..7e2857fded5 100644 --- a/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/sources/v1alpha1/zz_generated.deepcopy.go @@ -23,117 +23,30 @@ package v1alpha1 import ( runtime "k8s.io/apimachinery/pkg/runtime" + integrationv1alpha1 "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" ) -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSCommon) DeepCopyInto(out *AWSCommon) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSCommon. -func (in *AWSCommon) DeepCopy() *AWSCommon { - if in == nil { - return nil - } - out := new(AWSCommon) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSDDBStreams) DeepCopyInto(out *AWSDDBStreams) { - *out = *in - out.AWSCommon = in.AWSCommon - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSDDBStreams. -func (in *AWSDDBStreams) DeepCopy() *AWSDDBStreams { - if in == nil { - return nil - } - out := new(AWSDDBStreams) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSS3) DeepCopyInto(out *AWSS3) { - *out = *in - out.AWSCommon = in.AWSCommon - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSS3. -func (in *AWSS3) DeepCopy() *AWSS3 { - if in == nil { - return nil - } - out := new(AWSS3) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *AWSSQS) DeepCopyInto(out *AWSSQS) { - *out = *in - out.AWSCommon = in.AWSCommon - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSSQS. -func (in *AWSSQS) DeepCopy() *AWSSQS { - if in == nil { - return nil - } - out := new(AWSSQS) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Auth) DeepCopyInto(out *Auth) { - *out = *in - if in.Secret != nil { - in, out := &in.Secret, &out.Secret - *out = new(Secret) - (*in).DeepCopyInto(*out) - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Auth. -func (in *Auth) DeepCopy() *Auth { - if in == nil { - return nil - } - out := new(Auth) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Aws) DeepCopyInto(out *Aws) { *out = *in if in.S3 != nil { in, out := &in.S3, &out.S3 - *out = new(AWSS3) + *out = new(integrationv1alpha1.AWSS3) **out = **in } if in.SQS != nil { in, out := &in.SQS, &out.SQS - *out = new(AWSSQS) + *out = new(integrationv1alpha1.AWSSQS) **out = **in } if in.DDBStreams != nil { in, out := &in.DDBStreams, &out.DDBStreams - *out = new(AWSDDBStreams) + *out = new(integrationv1alpha1.AWSDDBStreams) **out = **in } if in.Auth != nil { in, out := &in.Auth, &out.Auth - *out = new(Auth) + *out = new(integrationv1alpha1.Auth) (*in).DeepCopyInto(*out) } return @@ -254,43 +167,6 @@ func (in *IntegrationSourceStatus) DeepCopy() *IntegrationSourceStatus { return out } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *Secret) DeepCopyInto(out *Secret) { - *out = *in - if in.Ref != nil { - in, out := &in.Ref, &out.Ref - *out = new(SecretReference) - **out = **in - } - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Secret. -func (in *Secret) DeepCopy() *Secret { - if in == nil { - return nil - } - out := new(Secret) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *SecretReference) DeepCopyInto(out *SecretReference) { - *out = *in - return -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference. -func (in *SecretReference) DeepCopy() *SecretReference { - if in == nil { - return nil - } - out := new(SecretReference) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Timer) DeepCopyInto(out *Timer) { *out = *in