diff --git a/algolia/ingestion/model_docker_image_type.go b/algolia/ingestion/model_docker_image_type.go deleted file mode 100644 index 345c86c0d..000000000 --- a/algolia/ingestion/model_docker_image_type.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -package ingestion - -import ( - "encoding/json" - "fmt" -) - -// DockerImageType Image type. -type DockerImageType string - -// List of DockerImageType. -const ( - DOCKER_IMAGE_TYPE_CUSTOM DockerImageType = "custom" - DOCKER_IMAGE_TYPE_AIRBYTE DockerImageType = "airbyte" -) - -// All allowed values of DockerImageType enum. -var AllowedDockerImageTypeEnumValues = []DockerImageType{ - "custom", - "airbyte", -} - -func (v *DockerImageType) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return fmt.Errorf("failed to unmarshal value '%s' for enum 'DockerImageType': %w", string(src), err) - } - enumTypeValue := DockerImageType(value) - for _, existing := range AllowedDockerImageTypeEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid DockerImageType", value) -} - -// NewDockerImageTypeFromValue returns a pointer to a valid DockerImageType -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDockerImageTypeFromValue(v string) (*DockerImageType, error) { - ev := DockerImageType(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for DockerImageType: valid values are %v", v, AllowedDockerImageTypeEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DockerImageType) IsValid() bool { - for _, existing := range AllowedDockerImageTypeEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DockerImageType value. -func (v DockerImageType) Ptr() *DockerImageType { - return &v -} diff --git a/algolia/ingestion/model_docker_registry.go b/algolia/ingestion/model_docker_registry.go deleted file mode 100644 index 4a89afbef..000000000 --- a/algolia/ingestion/model_docker_registry.go +++ /dev/null @@ -1,65 +0,0 @@ -// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT. -package ingestion - -import ( - "encoding/json" - "fmt" -) - -// DockerRegistry Container registry name from where to pull the image. -type DockerRegistry string - -// List of DockerRegistry. -const ( - DOCKER_REGISTRY_DOCKERHUB DockerRegistry = "dockerhub" - DOCKER_REGISTRY_GHCR DockerRegistry = "ghcr" -) - -// All allowed values of DockerRegistry enum. -var AllowedDockerRegistryEnumValues = []DockerRegistry{ - "dockerhub", - "ghcr", -} - -func (v *DockerRegistry) UnmarshalJSON(src []byte) error { - var value string - err := json.Unmarshal(src, &value) - if err != nil { - return fmt.Errorf("failed to unmarshal value '%s' for enum 'DockerRegistry': %w", string(src), err) - } - enumTypeValue := DockerRegistry(value) - for _, existing := range AllowedDockerRegistryEnumValues { - if existing == enumTypeValue { - *v = enumTypeValue - return nil - } - } - - return fmt.Errorf("%+v is not a valid DockerRegistry", value) -} - -// NewDockerRegistryFromValue returns a pointer to a valid DockerRegistry -// for the value passed as argument, or an error if the value passed is not allowed by the enum. -func NewDockerRegistryFromValue(v string) (*DockerRegistry, error) { - ev := DockerRegistry(v) - if ev.IsValid() { - return &ev, nil - } else { - return nil, fmt.Errorf("invalid value '%v' for DockerRegistry: valid values are %v", v, AllowedDockerRegistryEnumValues) - } -} - -// IsValid return true if the value is valid for the enum, false otherwise. -func (v DockerRegistry) IsValid() bool { - for _, existing := range AllowedDockerRegistryEnumValues { - if existing == v { - return true - } - } - return false -} - -// Ptr returns reference to DockerRegistry value. -func (v DockerRegistry) Ptr() *DockerRegistry { - return &v -} diff --git a/algolia/ingestion/model_source_docker.go b/algolia/ingestion/model_source_docker.go index 66ca834e1..055abd1a1 100644 --- a/algolia/ingestion/model_source_docker.go +++ b/algolia/ingestion/model_source_docker.go @@ -8,37 +8,20 @@ import ( // SourceDocker struct for SourceDocker. type SourceDocker struct { - ImageType DockerImageType `json:"imageType"` - Registry DockerRegistry `json:"registry"` - // Docker image name. + // Shortname of the image, as returned by the referential. Image string `json:"image"` - // Docker image version. - Version *string `json:"version,omitempty"` // Configuration of the spec. Configuration map[string]any `json:"configuration"` } -type SourceDockerOption func(f *SourceDocker) - -func WithSourceDockerVersion(val string) SourceDockerOption { - return func(f *SourceDocker) { - f.Version = &val - } -} - // NewSourceDocker instantiates a new SourceDocker object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSourceDocker(imageType DockerImageType, registry DockerRegistry, image string, configuration map[string]any, opts ...SourceDockerOption) *SourceDocker { +func NewSourceDocker(image string, configuration map[string]any) *SourceDocker { this := &SourceDocker{} - this.ImageType = imageType - this.Registry = registry this.Image = image this.Configuration = configuration - for _, opt := range opts { - opt(this) - } return this } @@ -47,56 +30,6 @@ func NewEmptySourceDocker() *SourceDocker { return &SourceDocker{} } -// GetImageType returns the ImageType field value. -func (o *SourceDocker) GetImageType() DockerImageType { - if o == nil { - var ret DockerImageType - return ret - } - - return o.ImageType -} - -// GetImageTypeOk returns a tuple with the ImageType field value -// and a boolean to check if the value has been set. -func (o *SourceDocker) GetImageTypeOk() (*DockerImageType, bool) { - if o == nil { - return nil, false - } - return &o.ImageType, true -} - -// SetImageType sets field value. -func (o *SourceDocker) SetImageType(v DockerImageType) *SourceDocker { - o.ImageType = v - return o -} - -// GetRegistry returns the Registry field value. -func (o *SourceDocker) GetRegistry() DockerRegistry { - if o == nil { - var ret DockerRegistry - return ret - } - - return o.Registry -} - -// GetRegistryOk returns a tuple with the Registry field value -// and a boolean to check if the value has been set. -func (o *SourceDocker) GetRegistryOk() (*DockerRegistry, bool) { - if o == nil { - return nil, false - } - return &o.Registry, true -} - -// SetRegistry sets field value. -func (o *SourceDocker) SetRegistry(v DockerRegistry) *SourceDocker { - o.Registry = v - return o -} - // GetImage returns the Image field value. func (o *SourceDocker) GetImage() string { if o == nil { @@ -122,39 +55,6 @@ func (o *SourceDocker) SetImage(v string) *SourceDocker { return o } -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SourceDocker) GetVersion() string { - if o == nil || o.Version == nil { - var ret string - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SourceDocker) GetVersionOk() (*string, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SourceDocker) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given string and assigns it to the Version field. -func (o *SourceDocker) SetVersion(v string) *SourceDocker { - o.Version = &v - return o -} - // GetConfiguration returns the Configuration field value. func (o *SourceDocker) GetConfiguration() map[string]any { if o == nil { @@ -182,18 +82,9 @@ func (o *SourceDocker) SetConfiguration(v map[string]any) *SourceDocker { func (o SourceDocker) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} - if true { - toSerialize["imageType"] = o.ImageType - } - if true { - toSerialize["registry"] = o.Registry - } if true { toSerialize["image"] = o.Image } - if o.Version != nil { - toSerialize["version"] = o.Version - } if true { toSerialize["configuration"] = o.Configuration } @@ -207,10 +98,7 @@ func (o SourceDocker) MarshalJSON() ([]byte, error) { func (o SourceDocker) String() string { out := "" - out += fmt.Sprintf(" imageType=%v\n", o.ImageType) - out += fmt.Sprintf(" registry=%v\n", o.Registry) out += fmt.Sprintf(" image=%v\n", o.Image) - out += fmt.Sprintf(" version=%v\n", o.Version) out += fmt.Sprintf(" configuration=%v\n", o.Configuration) return fmt.Sprintf("SourceDocker {\n%s}", out) } diff --git a/algolia/ingestion/model_source_input.go b/algolia/ingestion/model_source_input.go index 5b4962116..62051d1ab 100644 --- a/algolia/ingestion/model_source_input.go +++ b/algolia/ingestion/model_source_input.go @@ -20,17 +20,17 @@ type SourceInput struct { SourceShopify *SourceShopify } -// SourceDockerAsSourceInput is a convenience function that returns SourceDocker wrapped in SourceInput. -func SourceDockerAsSourceInput(v *SourceDocker) *SourceInput { +// SourceGA4BigQueryExportAsSourceInput is a convenience function that returns SourceGA4BigQueryExport wrapped in SourceInput. +func SourceGA4BigQueryExportAsSourceInput(v *SourceGA4BigQueryExport) *SourceInput { return &SourceInput{ - SourceDocker: v, + SourceGA4BigQueryExport: v, } } -// SourceGA4BigQueryExportAsSourceInput is a convenience function that returns SourceGA4BigQueryExport wrapped in SourceInput. -func SourceGA4BigQueryExportAsSourceInput(v *SourceGA4BigQueryExport) *SourceInput { +// SourceDockerAsSourceInput is a convenience function that returns SourceDocker wrapped in SourceInput. +func SourceDockerAsSourceInput(v *SourceDocker) *SourceInput { return &SourceInput{ - SourceGA4BigQueryExport: v, + SourceDocker: v, } } @@ -82,15 +82,6 @@ func (dst *SourceInput) UnmarshalJSON(data []byte) error { // use discriminator value to speed up the lookup if possible, if not we will try every possibility var jsonDict map[string]any _ = newStrictDecoder(data).Decode(&jsonDict) - if utils.HasKey(jsonDict, "registry") && utils.HasKey(jsonDict, "image") && utils.HasKey(jsonDict, "imageType") && utils.HasKey(jsonDict, "configuration") { - // try to unmarshal data into SourceDocker - err = newStrictDecoder(data).Decode(&dst.SourceDocker) - if err == nil && validateStruct(dst.SourceDocker) == nil { - return nil // found the correct type - } else { - dst.SourceDocker = nil - } - } if utils.HasKey(jsonDict, "projectID") && utils.HasKey(jsonDict, "datasetID") && utils.HasKey(jsonDict, "tablePrefix") { // try to unmarshal data into SourceGA4BigQueryExport err = newStrictDecoder(data).Decode(&dst.SourceGA4BigQueryExport) @@ -100,6 +91,15 @@ func (dst *SourceInput) UnmarshalJSON(data []byte) error { dst.SourceGA4BigQueryExport = nil } } + if utils.HasKey(jsonDict, "image") && utils.HasKey(jsonDict, "configuration") { + // try to unmarshal data into SourceDocker + err = newStrictDecoder(data).Decode(&dst.SourceDocker) + if err == nil && validateStruct(dst.SourceDocker) == nil { + return nil // found the correct type + } else { + dst.SourceDocker = nil + } + } if utils.HasKey(jsonDict, "projectKey") { // try to unmarshal data into SourceCommercetools err = newStrictDecoder(data).Decode(&dst.SourceCommercetools) diff --git a/algolia/ingestion/model_source_update_docker.go b/algolia/ingestion/model_source_update_docker.go index 38e732d51..d33ae81d9 100644 --- a/algolia/ingestion/model_source_update_docker.go +++ b/algolia/ingestion/model_source_update_docker.go @@ -8,45 +8,17 @@ import ( // SourceUpdateDocker struct for SourceUpdateDocker. type SourceUpdateDocker struct { - Registry *DockerRegistry `json:"registry,omitempty"` - // Docker image name. - Image *string `json:"image,omitempty"` - // Docker image version. - Version *string `json:"version,omitempty"` // Configuration of the spec. Configuration map[string]any `json:"configuration"` } -type SourceUpdateDockerOption func(f *SourceUpdateDocker) - -func WithSourceUpdateDockerRegistry(val DockerRegistry) SourceUpdateDockerOption { - return func(f *SourceUpdateDocker) { - f.Registry = &val - } -} - -func WithSourceUpdateDockerImage(val string) SourceUpdateDockerOption { - return func(f *SourceUpdateDocker) { - f.Image = &val - } -} - -func WithSourceUpdateDockerVersion(val string) SourceUpdateDockerOption { - return func(f *SourceUpdateDocker) { - f.Version = &val - } -} - // NewSourceUpdateDocker instantiates a new SourceUpdateDocker object // This constructor will assign default values to properties that have it defined, // and makes sure properties required by API are set, but the set of arguments // will change when the set of required properties is changed. -func NewSourceUpdateDocker(configuration map[string]any, opts ...SourceUpdateDockerOption) *SourceUpdateDocker { +func NewSourceUpdateDocker(configuration map[string]any) *SourceUpdateDocker { this := &SourceUpdateDocker{} this.Configuration = configuration - for _, opt := range opts { - opt(this) - } return this } @@ -55,105 +27,6 @@ func NewEmptySourceUpdateDocker() *SourceUpdateDocker { return &SourceUpdateDocker{} } -// GetRegistry returns the Registry field value if set, zero value otherwise. -func (o *SourceUpdateDocker) GetRegistry() DockerRegistry { - if o == nil || o.Registry == nil { - var ret DockerRegistry - return ret - } - return *o.Registry -} - -// GetRegistryOk returns a tuple with the Registry field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SourceUpdateDocker) GetRegistryOk() (*DockerRegistry, bool) { - if o == nil || o.Registry == nil { - return nil, false - } - return o.Registry, true -} - -// HasRegistry returns a boolean if a field has been set. -func (o *SourceUpdateDocker) HasRegistry() bool { - if o != nil && o.Registry != nil { - return true - } - - return false -} - -// SetRegistry gets a reference to the given DockerRegistry and assigns it to the Registry field. -func (o *SourceUpdateDocker) SetRegistry(v DockerRegistry) *SourceUpdateDocker { - o.Registry = &v - return o -} - -// GetImage returns the Image field value if set, zero value otherwise. -func (o *SourceUpdateDocker) GetImage() string { - if o == nil || o.Image == nil { - var ret string - return ret - } - return *o.Image -} - -// GetImageOk returns a tuple with the Image field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SourceUpdateDocker) GetImageOk() (*string, bool) { - if o == nil || o.Image == nil { - return nil, false - } - return o.Image, true -} - -// HasImage returns a boolean if a field has been set. -func (o *SourceUpdateDocker) HasImage() bool { - if o != nil && o.Image != nil { - return true - } - - return false -} - -// SetImage gets a reference to the given string and assigns it to the Image field. -func (o *SourceUpdateDocker) SetImage(v string) *SourceUpdateDocker { - o.Image = &v - return o -} - -// GetVersion returns the Version field value if set, zero value otherwise. -func (o *SourceUpdateDocker) GetVersion() string { - if o == nil || o.Version == nil { - var ret string - return ret - } - return *o.Version -} - -// GetVersionOk returns a tuple with the Version field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *SourceUpdateDocker) GetVersionOk() (*string, bool) { - if o == nil || o.Version == nil { - return nil, false - } - return o.Version, true -} - -// HasVersion returns a boolean if a field has been set. -func (o *SourceUpdateDocker) HasVersion() bool { - if o != nil && o.Version != nil { - return true - } - - return false -} - -// SetVersion gets a reference to the given string and assigns it to the Version field. -func (o *SourceUpdateDocker) SetVersion(v string) *SourceUpdateDocker { - o.Version = &v - return o -} - // GetConfiguration returns the Configuration field value. func (o *SourceUpdateDocker) GetConfiguration() map[string]any { if o == nil { @@ -181,15 +54,6 @@ func (o *SourceUpdateDocker) SetConfiguration(v map[string]any) *SourceUpdateDoc func (o SourceUpdateDocker) MarshalJSON() ([]byte, error) { toSerialize := map[string]any{} - if o.Registry != nil { - toSerialize["registry"] = o.Registry - } - if o.Image != nil { - toSerialize["image"] = o.Image - } - if o.Version != nil { - toSerialize["version"] = o.Version - } if true { toSerialize["configuration"] = o.Configuration } @@ -203,9 +67,6 @@ func (o SourceUpdateDocker) MarshalJSON() ([]byte, error) { func (o SourceUpdateDocker) String() string { out := "" - out += fmt.Sprintf(" registry=%v\n", o.Registry) - out += fmt.Sprintf(" image=%v\n", o.Image) - out += fmt.Sprintf(" version=%v\n", o.Version) out += fmt.Sprintf(" configuration=%v\n", o.Configuration) return fmt.Sprintf("SourceUpdateDocker {\n%s}", out) }