From 8be1d24f07faf21794e33eb55b2b617e5d823eae Mon Sep 17 00:00:00 2001 From: unasra Date: Thu, 19 Sep 2024 23:34:53 +0530 Subject: [PATCH 1/3] Modified attributes in Providers endpoint --- clouddiscovery/api/openapi.yaml | 7 ++ clouddiscovery/docs/DiscoveryConfig.md | 36 ++----- clouddiscovery/docs/ProvidersAPI.md | 4 +- clouddiscovery/model_discovery_config.go | 132 +++++++++-------------- 4 files changed, 67 insertions(+), 112 deletions(-) diff --git a/clouddiscovery/api/openapi.yaml b/clouddiscovery/api/openapi.yaml index a7bb103..1887c8d 100644 --- a/clouddiscovery/api/openapi.yaml +++ b/clouddiscovery/api/openapi.yaml @@ -901,6 +901,7 @@ components: last_sync: description: Last sync timestamp. format: date-time + readOnly: true type: string name: description: Name of the discovery config. @@ -919,9 +920,11 @@ components: Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. + readOnly: true type: string status_message: description: Aggregate status message of the sync operation. + readOnly: true type: string sync_interval: title: "Time between sync jobs in minutes. Default is \"Auto\". Other supported\ @@ -937,7 +940,11 @@ components: readOnly: true type: string required: + - account_preference + - credential_preference - name + - provider_type + - source_configs title: DiscoveryConfig type: object ddidnsrickettsIPAMConfig: diff --git a/clouddiscovery/docs/DiscoveryConfig.md b/clouddiscovery/docs/DiscoveryConfig.md index c2eea83..8fd953a 100644 --- a/clouddiscovery/docs/DiscoveryConfig.md +++ b/clouddiscovery/docs/DiscoveryConfig.md @@ -4,22 +4,22 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**AccountPreference** | Pointer to **string** | Account preference. For ex.: single, multiple, auto-discover-multiple. | [optional] +**AccountPreference** | **string** | Account preference. For ex.: single, multiple, auto-discover-multiple. | **AdditionalConfig** | Pointer to [**AdditionalConfig**](AdditionalConfig.md) | Additional configuration. Ex.: '{ \"excluded_object_types\": [], \"exclusion_account_list\": [], \"zone_forwarding\": \"true\" or \"false\" }'. | [optional] **CreatedAt** | Pointer to **time.Time** | Timestamp when the object has been created. | [optional] [readonly] -**CredentialPreference** | Pointer to [**CredentialPreference**](CredentialPreference.md) | Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. | [optional] +**CredentialPreference** | [**CredentialPreference**](CredentialPreference.md) | Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. | **DeletedAt** | Pointer to **time.Time** | Timestamp when the object has been deleted. | [optional] [readonly] **Description** | Pointer to **string** | Description of the discovery config. Optional. | [optional] **DesiredState** | Pointer to **string** | Desired state. Default is \"enabled\". | [optional] **DestinationTypesEnabled** | Pointer to **[]string** | Destinations types enabled: Ex.: DNS, IPAM and ACCOUNT. | [optional] **Destinations** | Pointer to [**[]Destination**](Destination.md) | Destinations. | [optional] **Id** | Pointer to **string** | Auto-generated unique discovery config ID. Format BloxID. | [optional] [readonly] -**LastSync** | Pointer to **time.Time** | Last sync timestamp. | [optional] +**LastSync** | Pointer to **time.Time** | Last sync timestamp. | [optional] [readonly] **Name** | **string** | Name of the discovery config. | -**ProviderType** | Pointer to **string** | Provider type. Ex.: Amazon Web Services, Google Cloud Platform, Microsoft Azure. | [optional] -**SourceConfigs** | Pointer to [**[]SourceConfig**](SourceConfig.md) | Source configs. | [optional] -**Status** | Pointer to **string** | Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. | [optional] -**StatusMessage** | Pointer to **string** | Aggregate status message of the sync operation. | [optional] +**ProviderType** | **string** | Provider type. Ex.: Amazon Web Services, Google Cloud Platform, Microsoft Azure. | +**SourceConfigs** | [**[]SourceConfig**](SourceConfig.md) | Source configs. | +**Status** | Pointer to **string** | Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. | [optional] [readonly] +**StatusMessage** | Pointer to **string** | Aggregate status message of the sync operation. | [optional] [readonly] **SyncInterval** | Pointer to **string** | | [optional] **Tags** | Pointer to **map[string]interface{}** | Tagging specifics. | [optional] **UpdatedAt** | Pointer to **time.Time** | Timestamp when the object has been updated. | [optional] [readonly] @@ -28,7 +28,7 @@ Name | Type | Description | Notes ### NewDiscoveryConfig -`func NewDiscoveryConfig(name string, ) *DiscoveryConfig` +`func NewDiscoveryConfig(accountPreference string, credentialPreference CredentialPreference, name string, providerType string, sourceConfigs []SourceConfig, ) *DiscoveryConfig` NewDiscoveryConfig instantiates a new DiscoveryConfig object This constructor will assign default values to properties that have it defined, @@ -62,11 +62,6 @@ and a boolean to check if the value has been set. SetAccountPreference sets AccountPreference field to given value. -### HasAccountPreference - -`func (o *DiscoveryConfig) HasAccountPreference() bool` - -HasAccountPreference returns a boolean if a field has been set. ### GetAdditionalConfig @@ -137,11 +132,6 @@ and a boolean to check if the value has been set. SetCredentialPreference sets CredentialPreference field to given value. -### HasCredentialPreference - -`func (o *DiscoveryConfig) HasCredentialPreference() bool` - -HasCredentialPreference returns a boolean if a field has been set. ### GetDeletedAt @@ -357,11 +347,6 @@ and a boolean to check if the value has been set. SetProviderType sets ProviderType field to given value. -### HasProviderType - -`func (o *DiscoveryConfig) HasProviderType() bool` - -HasProviderType returns a boolean if a field has been set. ### GetSourceConfigs @@ -382,11 +367,6 @@ and a boolean to check if the value has been set. SetSourceConfigs sets SourceConfigs field to given value. -### HasSourceConfigs - -`func (o *DiscoveryConfig) HasSourceConfigs() bool` - -HasSourceConfigs returns a boolean if a field has been set. ### GetStatus diff --git a/clouddiscovery/docs/ProvidersAPI.md b/clouddiscovery/docs/ProvidersAPI.md index 6e13e1a..ad036dd 100644 --- a/clouddiscovery/docs/ProvidersAPI.md +++ b/clouddiscovery/docs/ProvidersAPI.md @@ -34,7 +34,7 @@ import ( ) func main() { - body := *clouddiscovery.NewDiscoveryConfig("Name_example") // DiscoveryConfig | + body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", *clouddiscovery.NewCredentialPreference(), "Name_example", "ProviderType_example", []clouddiscovery.SourceConfig{*clouddiscovery.NewSourceConfig()}) // DiscoveryConfig | apiClient := clouddiscovery.NewAPIClient() resp, r, err := apiClient.ProvidersAPI.Create(context.Background()).Body(body).Execute() @@ -310,7 +310,7 @@ import ( func main() { id := "a5183192-1e00-475f-b334-38e1f0bb1bc7" // string | Auto-generated unique discovery config ID. Format BloxID. - body := *clouddiscovery.NewDiscoveryConfig("Name_example") // DiscoveryConfig | + body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", *clouddiscovery.NewCredentialPreference(), "Name_example", "ProviderType_example", []clouddiscovery.SourceConfig{*clouddiscovery.NewSourceConfig()}) // DiscoveryConfig | apiClient := clouddiscovery.NewAPIClient() resp, r, err := apiClient.ProvidersAPI.Update(context.Background(), id).Body(body).Execute() diff --git a/clouddiscovery/model_discovery_config.go b/clouddiscovery/model_discovery_config.go index d9a6f0f..44340a2 100644 --- a/clouddiscovery/model_discovery_config.go +++ b/clouddiscovery/model_discovery_config.go @@ -22,13 +22,13 @@ var _ MappedNullable = &DiscoveryConfig{} // DiscoveryConfig Discovery configuration type DiscoveryConfig struct { // Account preference. For ex.: single, multiple, auto-discover-multiple. - AccountPreference *string `json:"account_preference,omitempty"` + AccountPreference string `json:"account_preference"` // Additional configuration. Ex.: '{ \"excluded_object_types\": [], \"exclusion_account_list\": [], \"zone_forwarding\": \"true\" or \"false\" }'. AdditionalConfig *AdditionalConfig `json:"additional_config,omitempty"` // Timestamp when the object has been created. CreatedAt *time.Time `json:"created_at,omitempty"` // Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. - CredentialPreference *CredentialPreference `json:"credential_preference,omitempty"` + CredentialPreference CredentialPreference `json:"credential_preference"` // Timestamp when the object has been deleted. DeletedAt *time.Time `json:"deleted_at,omitempty"` // Description of the discovery config. Optional. @@ -46,9 +46,9 @@ type DiscoveryConfig struct { // Name of the discovery config. Name string `json:"name"` // Provider type. Ex.: Amazon Web Services, Google Cloud Platform, Microsoft Azure. - ProviderType *string `json:"provider_type,omitempty"` + ProviderType string `json:"provider_type"` // Source configs. - SourceConfigs []SourceConfig `json:"source_configs,omitempty"` + SourceConfigs []SourceConfig `json:"source_configs"` // Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. Status *string `json:"status,omitempty"` // Aggregate status message of the sync operation. @@ -67,9 +67,13 @@ type _DiscoveryConfig DiscoveryConfig // 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 NewDiscoveryConfig(name string) *DiscoveryConfig { +func NewDiscoveryConfig(accountPreference string, credentialPreference CredentialPreference, name string, providerType string, sourceConfigs []SourceConfig) *DiscoveryConfig { this := DiscoveryConfig{} + this.AccountPreference = accountPreference + this.CredentialPreference = credentialPreference this.Name = name + this.ProviderType = providerType + this.SourceConfigs = sourceConfigs return &this } @@ -81,36 +85,28 @@ func NewDiscoveryConfigWithDefaults() *DiscoveryConfig { return &this } -// GetAccountPreference returns the AccountPreference field value if set, zero value otherwise. +// GetAccountPreference returns the AccountPreference field value func (o *DiscoveryConfig) GetAccountPreference() string { - if o == nil || IsNil(o.AccountPreference) { + if o == nil { var ret string return ret } - return *o.AccountPreference + + return o.AccountPreference } -// GetAccountPreferenceOk returns a tuple with the AccountPreference field value if set, nil otherwise +// GetAccountPreferenceOk returns a tuple with the AccountPreference field value // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetAccountPreferenceOk() (*string, bool) { - if o == nil || IsNil(o.AccountPreference) { + if o == nil { return nil, false } - return o.AccountPreference, true -} - -// HasAccountPreference returns a boolean if a field has been set. -func (o *DiscoveryConfig) HasAccountPreference() bool { - if o != nil && !IsNil(o.AccountPreference) { - return true - } - - return false + return &o.AccountPreference, true } -// SetAccountPreference gets a reference to the given string and assigns it to the AccountPreference field. +// SetAccountPreference sets field value func (o *DiscoveryConfig) SetAccountPreference(v string) { - o.AccountPreference = &v + o.AccountPreference = v } // GetAdditionalConfig returns the AdditionalConfig field value if set, zero value otherwise. @@ -177,36 +173,28 @@ func (o *DiscoveryConfig) SetCreatedAt(v time.Time) { o.CreatedAt = &v } -// GetCredentialPreference returns the CredentialPreference field value if set, zero value otherwise. +// GetCredentialPreference returns the CredentialPreference field value func (o *DiscoveryConfig) GetCredentialPreference() CredentialPreference { - if o == nil || IsNil(o.CredentialPreference) { + if o == nil { var ret CredentialPreference return ret } - return *o.CredentialPreference + + return o.CredentialPreference } -// GetCredentialPreferenceOk returns a tuple with the CredentialPreference field value if set, nil otherwise +// GetCredentialPreferenceOk returns a tuple with the CredentialPreference field value // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetCredentialPreferenceOk() (*CredentialPreference, bool) { - if o == nil || IsNil(o.CredentialPreference) { + if o == nil { return nil, false } - return o.CredentialPreference, true -} - -// HasCredentialPreference returns a boolean if a field has been set. -func (o *DiscoveryConfig) HasCredentialPreference() bool { - if o != nil && !IsNil(o.CredentialPreference) { - return true - } - - return false + return &o.CredentialPreference, true } -// SetCredentialPreference gets a reference to the given CredentialPreference and assigns it to the CredentialPreference field. +// SetCredentialPreference sets field value func (o *DiscoveryConfig) SetCredentialPreference(v CredentialPreference) { - o.CredentialPreference = &v + o.CredentialPreference = v } // GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. @@ -457,66 +445,50 @@ func (o *DiscoveryConfig) SetName(v string) { o.Name = v } -// GetProviderType returns the ProviderType field value if set, zero value otherwise. +// GetProviderType returns the ProviderType field value func (o *DiscoveryConfig) GetProviderType() string { - if o == nil || IsNil(o.ProviderType) { + if o == nil { var ret string return ret } - return *o.ProviderType + + return o.ProviderType } -// GetProviderTypeOk returns a tuple with the ProviderType field value if set, nil otherwise +// GetProviderTypeOk returns a tuple with the ProviderType field value // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetProviderTypeOk() (*string, bool) { - if o == nil || IsNil(o.ProviderType) { + if o == nil { return nil, false } - return o.ProviderType, true -} - -// HasProviderType returns a boolean if a field has been set. -func (o *DiscoveryConfig) HasProviderType() bool { - if o != nil && !IsNil(o.ProviderType) { - return true - } - - return false + return &o.ProviderType, true } -// SetProviderType gets a reference to the given string and assigns it to the ProviderType field. +// SetProviderType sets field value func (o *DiscoveryConfig) SetProviderType(v string) { - o.ProviderType = &v + o.ProviderType = v } -// GetSourceConfigs returns the SourceConfigs field value if set, zero value otherwise. +// GetSourceConfigs returns the SourceConfigs field value func (o *DiscoveryConfig) GetSourceConfigs() []SourceConfig { - if o == nil || IsNil(o.SourceConfigs) { + if o == nil { var ret []SourceConfig return ret } + return o.SourceConfigs } -// GetSourceConfigsOk returns a tuple with the SourceConfigs field value if set, nil otherwise +// GetSourceConfigsOk returns a tuple with the SourceConfigs field value // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetSourceConfigsOk() ([]SourceConfig, bool) { - if o == nil || IsNil(o.SourceConfigs) { + if o == nil { return nil, false } return o.SourceConfigs, true } -// HasSourceConfigs returns a boolean if a field has been set. -func (o *DiscoveryConfig) HasSourceConfigs() bool { - if o != nil && !IsNil(o.SourceConfigs) { - return true - } - - return false -} - -// SetSourceConfigs gets a reference to the given []SourceConfig and assigns it to the SourceConfigs field. +// SetSourceConfigs sets field value func (o *DiscoveryConfig) SetSourceConfigs(v []SourceConfig) { o.SourceConfigs = v } @@ -691,18 +663,14 @@ func (o DiscoveryConfig) MarshalJSON() ([]byte, error) { func (o DiscoveryConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} - if !IsNil(o.AccountPreference) { - toSerialize["account_preference"] = o.AccountPreference - } + toSerialize["account_preference"] = o.AccountPreference if !IsNil(o.AdditionalConfig) { toSerialize["additional_config"] = o.AdditionalConfig } if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - if !IsNil(o.CredentialPreference) { - toSerialize["credential_preference"] = o.CredentialPreference - } + toSerialize["credential_preference"] = o.CredentialPreference if !IsNil(o.DeletedAt) { toSerialize["deleted_at"] = o.DeletedAt } @@ -725,12 +693,8 @@ func (o DiscoveryConfig) ToMap() (map[string]interface{}, error) { toSerialize["last_sync"] = o.LastSync } toSerialize["name"] = o.Name - if !IsNil(o.ProviderType) { - toSerialize["provider_type"] = o.ProviderType - } - if !IsNil(o.SourceConfigs) { - toSerialize["source_configs"] = o.SourceConfigs - } + toSerialize["provider_type"] = o.ProviderType + toSerialize["source_configs"] = o.SourceConfigs if !IsNil(o.Status) { toSerialize["status"] = o.Status } @@ -759,7 +723,11 @@ func (o *DiscoveryConfig) UnmarshalJSON(data []byte) (err error) { // by unmarshalling the object into a generic map with string keys and checking // that every required field exists as a key in the generic map. requiredProperties := []string{ + "account_preference", + "credential_preference", "name", + "provider_type", + "source_configs", } allProperties := make(map[string]interface{}) From 59b93411cd51d9166e630db7b3ff32f064400eac Mon Sep 17 00:00:00 2001 From: unasra Date: Fri, 20 Sep 2024 00:36:40 +0530 Subject: [PATCH 2/3] reverted fields back to optional --- clouddiscovery/api/openapi.yaml | 2 - clouddiscovery/docs/DiscoveryConfig.md | 16 +++++- clouddiscovery/docs/ProvidersAPI.md | 4 +- clouddiscovery/model_discovery_config.go | 64 +++++++++++++-------- clouddiscovery/test/api_providers_test.go | 68 +++++++++-------------- 5 files changed, 82 insertions(+), 72 deletions(-) diff --git a/clouddiscovery/api/openapi.yaml b/clouddiscovery/api/openapi.yaml index 1887c8d..16903ca 100644 --- a/clouddiscovery/api/openapi.yaml +++ b/clouddiscovery/api/openapi.yaml @@ -941,10 +941,8 @@ components: type: string required: - account_preference - - credential_preference - name - provider_type - - source_configs title: DiscoveryConfig type: object ddidnsrickettsIPAMConfig: diff --git a/clouddiscovery/docs/DiscoveryConfig.md b/clouddiscovery/docs/DiscoveryConfig.md index 8fd953a..59efe68 100644 --- a/clouddiscovery/docs/DiscoveryConfig.md +++ b/clouddiscovery/docs/DiscoveryConfig.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **AccountPreference** | **string** | Account preference. For ex.: single, multiple, auto-discover-multiple. | **AdditionalConfig** | Pointer to [**AdditionalConfig**](AdditionalConfig.md) | Additional configuration. Ex.: '{ \"excluded_object_types\": [], \"exclusion_account_list\": [], \"zone_forwarding\": \"true\" or \"false\" }'. | [optional] **CreatedAt** | Pointer to **time.Time** | Timestamp when the object has been created. | [optional] [readonly] -**CredentialPreference** | [**CredentialPreference**](CredentialPreference.md) | Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. | +**CredentialPreference** | Pointer to [**CredentialPreference**](CredentialPreference.md) | Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. | [optional] **DeletedAt** | Pointer to **time.Time** | Timestamp when the object has been deleted. | [optional] [readonly] **Description** | Pointer to **string** | Description of the discovery config. Optional. | [optional] **DesiredState** | Pointer to **string** | Desired state. Default is \"enabled\". | [optional] @@ -17,7 +17,7 @@ Name | Type | Description | Notes **LastSync** | Pointer to **time.Time** | Last sync timestamp. | [optional] [readonly] **Name** | **string** | Name of the discovery config. | **ProviderType** | **string** | Provider type. Ex.: Amazon Web Services, Google Cloud Platform, Microsoft Azure. | -**SourceConfigs** | [**[]SourceConfig**](SourceConfig.md) | Source configs. | +**SourceConfigs** | Pointer to [**[]SourceConfig**](SourceConfig.md) | Source configs. | [optional] **Status** | Pointer to **string** | Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. | [optional] [readonly] **StatusMessage** | Pointer to **string** | Aggregate status message of the sync operation. | [optional] [readonly] **SyncInterval** | Pointer to **string** | | [optional] @@ -28,7 +28,7 @@ Name | Type | Description | Notes ### NewDiscoveryConfig -`func NewDiscoveryConfig(accountPreference string, credentialPreference CredentialPreference, name string, providerType string, sourceConfigs []SourceConfig, ) *DiscoveryConfig` +`func NewDiscoveryConfig(accountPreference string, name string, providerType string, ) *DiscoveryConfig` NewDiscoveryConfig instantiates a new DiscoveryConfig object This constructor will assign default values to properties that have it defined, @@ -132,6 +132,11 @@ and a boolean to check if the value has been set. SetCredentialPreference sets CredentialPreference field to given value. +### HasCredentialPreference + +`func (o *DiscoveryConfig) HasCredentialPreference() bool` + +HasCredentialPreference returns a boolean if a field has been set. ### GetDeletedAt @@ -367,6 +372,11 @@ and a boolean to check if the value has been set. SetSourceConfigs sets SourceConfigs field to given value. +### HasSourceConfigs + +`func (o *DiscoveryConfig) HasSourceConfigs() bool` + +HasSourceConfigs returns a boolean if a field has been set. ### GetStatus diff --git a/clouddiscovery/docs/ProvidersAPI.md b/clouddiscovery/docs/ProvidersAPI.md index ad036dd..877e9f6 100644 --- a/clouddiscovery/docs/ProvidersAPI.md +++ b/clouddiscovery/docs/ProvidersAPI.md @@ -34,7 +34,7 @@ import ( ) func main() { - body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", *clouddiscovery.NewCredentialPreference(), "Name_example", "ProviderType_example", []clouddiscovery.SourceConfig{*clouddiscovery.NewSourceConfig()}) // DiscoveryConfig | + body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", "Name_example", "ProviderType_example") // DiscoveryConfig | apiClient := clouddiscovery.NewAPIClient() resp, r, err := apiClient.ProvidersAPI.Create(context.Background()).Body(body).Execute() @@ -310,7 +310,7 @@ import ( func main() { id := "a5183192-1e00-475f-b334-38e1f0bb1bc7" // string | Auto-generated unique discovery config ID. Format BloxID. - body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", *clouddiscovery.NewCredentialPreference(), "Name_example", "ProviderType_example", []clouddiscovery.SourceConfig{*clouddiscovery.NewSourceConfig()}) // DiscoveryConfig | + body := *clouddiscovery.NewDiscoveryConfig("AccountPreference_example", "Name_example", "ProviderType_example") // DiscoveryConfig | apiClient := clouddiscovery.NewAPIClient() resp, r, err := apiClient.ProvidersAPI.Update(context.Background(), id).Body(body).Execute() diff --git a/clouddiscovery/model_discovery_config.go b/clouddiscovery/model_discovery_config.go index 44340a2..21236ab 100644 --- a/clouddiscovery/model_discovery_config.go +++ b/clouddiscovery/model_discovery_config.go @@ -28,7 +28,7 @@ type DiscoveryConfig struct { // Timestamp when the object has been created. CreatedAt *time.Time `json:"created_at,omitempty"` // Credential preference. Ex.: '{ \"type\": \"static\" or \"delegated\", \"access_identifier_type\": \"role_arn\" or \"tenant_id\" or \"project_id\" }'. - CredentialPreference CredentialPreference `json:"credential_preference"` + CredentialPreference *CredentialPreference `json:"credential_preference,omitempty"` // Timestamp when the object has been deleted. DeletedAt *time.Time `json:"deleted_at,omitempty"` // Description of the discovery config. Optional. @@ -48,7 +48,7 @@ type DiscoveryConfig struct { // Provider type. Ex.: Amazon Web Services, Google Cloud Platform, Microsoft Azure. ProviderType string `json:"provider_type"` // Source configs. - SourceConfigs []SourceConfig `json:"source_configs"` + SourceConfigs []SourceConfig `json:"source_configs,omitempty"` // Status of the sync operation. In single account case, Its the combined status of account & all the destinations statuses In auto discover case, Its the status of the account discovery only. Status *string `json:"status,omitempty"` // Aggregate status message of the sync operation. @@ -67,13 +67,11 @@ type _DiscoveryConfig DiscoveryConfig // 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 NewDiscoveryConfig(accountPreference string, credentialPreference CredentialPreference, name string, providerType string, sourceConfigs []SourceConfig) *DiscoveryConfig { +func NewDiscoveryConfig(accountPreference string, name string, providerType string) *DiscoveryConfig { this := DiscoveryConfig{} this.AccountPreference = accountPreference - this.CredentialPreference = credentialPreference this.Name = name this.ProviderType = providerType - this.SourceConfigs = sourceConfigs return &this } @@ -173,28 +171,36 @@ func (o *DiscoveryConfig) SetCreatedAt(v time.Time) { o.CreatedAt = &v } -// GetCredentialPreference returns the CredentialPreference field value +// GetCredentialPreference returns the CredentialPreference field value if set, zero value otherwise. func (o *DiscoveryConfig) GetCredentialPreference() CredentialPreference { - if o == nil { + if o == nil || IsNil(o.CredentialPreference) { var ret CredentialPreference return ret } - - return o.CredentialPreference + return *o.CredentialPreference } -// GetCredentialPreferenceOk returns a tuple with the CredentialPreference field value +// GetCredentialPreferenceOk returns a tuple with the CredentialPreference field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetCredentialPreferenceOk() (*CredentialPreference, bool) { - if o == nil { + if o == nil || IsNil(o.CredentialPreference) { return nil, false } - return &o.CredentialPreference, true + return o.CredentialPreference, true +} + +// HasCredentialPreference returns a boolean if a field has been set. +func (o *DiscoveryConfig) HasCredentialPreference() bool { + if o != nil && !IsNil(o.CredentialPreference) { + return true + } + + return false } -// SetCredentialPreference sets field value +// SetCredentialPreference gets a reference to the given CredentialPreference and assigns it to the CredentialPreference field. func (o *DiscoveryConfig) SetCredentialPreference(v CredentialPreference) { - o.CredentialPreference = v + o.CredentialPreference = &v } // GetDeletedAt returns the DeletedAt field value if set, zero value otherwise. @@ -469,26 +475,34 @@ func (o *DiscoveryConfig) SetProviderType(v string) { o.ProviderType = v } -// GetSourceConfigs returns the SourceConfigs field value +// GetSourceConfigs returns the SourceConfigs field value if set, zero value otherwise. func (o *DiscoveryConfig) GetSourceConfigs() []SourceConfig { - if o == nil { + if o == nil || IsNil(o.SourceConfigs) { var ret []SourceConfig return ret } - return o.SourceConfigs } -// GetSourceConfigsOk returns a tuple with the SourceConfigs field value +// GetSourceConfigsOk returns a tuple with the SourceConfigs field value if set, nil otherwise // and a boolean to check if the value has been set. func (o *DiscoveryConfig) GetSourceConfigsOk() ([]SourceConfig, bool) { - if o == nil { + if o == nil || IsNil(o.SourceConfigs) { return nil, false } return o.SourceConfigs, true } -// SetSourceConfigs sets field value +// HasSourceConfigs returns a boolean if a field has been set. +func (o *DiscoveryConfig) HasSourceConfigs() bool { + if o != nil && !IsNil(o.SourceConfigs) { + return true + } + + return false +} + +// SetSourceConfigs gets a reference to the given []SourceConfig and assigns it to the SourceConfigs field. func (o *DiscoveryConfig) SetSourceConfigs(v []SourceConfig) { o.SourceConfigs = v } @@ -670,7 +684,9 @@ func (o DiscoveryConfig) ToMap() (map[string]interface{}, error) { if !IsNil(o.CreatedAt) { toSerialize["created_at"] = o.CreatedAt } - toSerialize["credential_preference"] = o.CredentialPreference + if !IsNil(o.CredentialPreference) { + toSerialize["credential_preference"] = o.CredentialPreference + } if !IsNil(o.DeletedAt) { toSerialize["deleted_at"] = o.DeletedAt } @@ -694,7 +710,9 @@ func (o DiscoveryConfig) ToMap() (map[string]interface{}, error) { } toSerialize["name"] = o.Name toSerialize["provider_type"] = o.ProviderType - toSerialize["source_configs"] = o.SourceConfigs + if !IsNil(o.SourceConfigs) { + toSerialize["source_configs"] = o.SourceConfigs + } if !IsNil(o.Status) { toSerialize["status"] = o.Status } @@ -724,10 +742,8 @@ func (o *DiscoveryConfig) UnmarshalJSON(data []byte) (err error) { // that every required field exists as a key in the generic map. requiredProperties := []string{ "account_preference", - "credential_preference", "name", "provider_type", - "source_configs", } allProperties := make(map[string]interface{}) diff --git a/clouddiscovery/test/api_providers_test.go b/clouddiscovery/test/api_providers_test.go index ae06683..9fc7ce2 100644 --- a/clouddiscovery/test/api_providers_test.go +++ b/clouddiscovery/test/api_providers_test.go @@ -29,18 +29,18 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create AWS Provider", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test awsresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), + AccountPreference: "single", CredentialPreference: &clouddiscovery.CredentialPreference{ AccessIdentifierType: clouddiscovery.PtrString("role_arn"), CredentialType: clouddiscovery.PtrString("dynamic"), }, Description: clouddiscovery.PtrString("AWS Discovery"), Name: "TestSyncAWS1", - ProviderType: clouddiscovery.PtrString("Amazon Web Services"), + ProviderType: "Amazon Web Services", SourceConfigs: []clouddiscovery.SourceConfig{ { CredentialConfig: &clouddiscovery.CredentialConfig{ @@ -63,11 +63,11 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create Azure Provider", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test azureresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), + AccountPreference: "single", CredentialPreference: &clouddiscovery.CredentialPreference{ AccessIdentifierType: clouddiscovery.PtrString("tenant_id"), CredentialType: clouddiscovery.PtrString("dynamic"), @@ -75,7 +75,7 @@ func TestProvidersAPIService(t *testing.T) { }, Description: clouddiscovery.PtrString("Azure Discovery"), Name: "TestSyncAzure", - ProviderType: clouddiscovery.PtrString("Microsoft Azure"), + ProviderType: "Microsoft Azure", SourceConfigs: []clouddiscovery.SourceConfig{ { CredentialConfig: &clouddiscovery.CredentialConfig{ @@ -103,11 +103,11 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create GCP Provider", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test gcpresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), + AccountPreference: "single", CredentialPreference: &clouddiscovery.CredentialPreference{ AccessIdentifierType: clouddiscovery.PtrString("project_id"), CredentialType: clouddiscovery.PtrString("dynamic"), @@ -115,7 +115,7 @@ func TestProvidersAPIService(t *testing.T) { }, Description: clouddiscovery.PtrString("GCP Discovery"), Name: "TestSyncGCP", - ProviderType: clouddiscovery.PtrString("Google Cloud Platform"), + ProviderType: "Google Cloud Platform", SourceConfigs: []clouddiscovery.SourceConfig{ { CredentialConfig: &clouddiscovery.CredentialConfig{ @@ -140,7 +140,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService List", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.List(context.Background()).Execute() @@ -155,7 +155,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Read", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Read(context.Background(), *gcpId).Execute() @@ -167,30 +167,16 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Update", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Update(context.Background(), *awsId). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), - CredentialPreference: &clouddiscovery.CredentialPreference{ - AccessIdentifierType: clouddiscovery.PtrString("role_arn"), - CredentialType: clouddiscovery.PtrString("dynamic"), - AdditionalProperties: nil, - }, - Description: clouddiscovery.PtrString("AWS Discovery"), - Name: "TestSyncAWS", - ProviderType: clouddiscovery.PtrString("Amazon Web Services"), - SourceConfigs: []clouddiscovery.SourceConfig{ - { - //Id: az, - CredentialConfig: &clouddiscovery.CredentialConfig{ - AccessIdentifier: clouddiscovery.PtrString("arn:aws:iam::111111111111:role/infoblox_discovery"), - }, - AdditionalProperties: nil, - }, - }, - SyncInterval: clouddiscovery.PtrString("Auto"), - Tags: nil, + AccountPreference: "single", + Description: clouddiscovery.PtrString("AWS Discovery Update"), + Name: "TestSyncAWS1", + ProviderType: "Amazon Web Services", + SyncInterval: clouddiscovery.PtrString("Auto"), + Tags: nil, }). Execute() @@ -205,14 +191,14 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Azure Update", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Update(context.Background(), *azureId). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), - Description: clouddiscovery.PtrString("Azure Discovery meow"), + AccountPreference: "single", + Description: clouddiscovery.PtrString("Azure Discovery Update"), Name: "TestSyncAzure", - ProviderType: clouddiscovery.PtrString("Microsoft Azure"), + ProviderType: "Microsoft Azure", SyncInterval: clouddiscovery.PtrString("Auto"), Tags: nil, }). @@ -233,10 +219,10 @@ func TestProvidersAPIService(t *testing.T) { gcpresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Update(context.Background(), *gcpId). Body(clouddiscovery.DiscoveryConfig{ - AccountPreference: clouddiscovery.PtrString("single"), + AccountPreference: "single", Description: clouddiscovery.PtrString("GCP Discovery update"), Name: "TestSyncGCP", - ProviderType: clouddiscovery.PtrString("Google Cloud Platform"), + ProviderType: "Google Cloud Platform", }). Execute() @@ -252,7 +238,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService AWS Delete", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *awsId).Execute() @@ -263,7 +249,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Azure Delete", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *azureId).Execute() @@ -274,7 +260,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService GCP Delete", func(t *testing.T) { - t.Skip("skip test") // remove to run test + //t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *gcpId).Execute() From 5ca02dc3e75cce313f634ab346c3099069ba5bff Mon Sep 17 00:00:00 2001 From: unasra Date: Fri, 20 Sep 2024 00:45:00 +0530 Subject: [PATCH 3/3] Skipped tests --- clouddiscovery/test/api_providers_test.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/clouddiscovery/test/api_providers_test.go b/clouddiscovery/test/api_providers_test.go index 9fc7ce2..35c35e3 100644 --- a/clouddiscovery/test/api_providers_test.go +++ b/clouddiscovery/test/api_providers_test.go @@ -29,7 +29,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create AWS Provider", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test awsresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ @@ -63,7 +63,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create Azure Provider", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test azureresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ @@ -103,7 +103,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Create GCP Provider", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test gcpresp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Create(context.Background()). Body(clouddiscovery.DiscoveryConfig{ @@ -140,7 +140,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService List", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.List(context.Background()).Execute() @@ -155,7 +155,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Read", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Read(context.Background(), *gcpId).Execute() @@ -167,7 +167,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Update", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Update(context.Background(), *awsId). Body(clouddiscovery.DiscoveryConfig{ @@ -191,7 +191,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Azure Update", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test resp, httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Update(context.Background(), *azureId). Body(clouddiscovery.DiscoveryConfig{ @@ -238,7 +238,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService AWS Delete", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *awsId).Execute() @@ -249,7 +249,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService Azure Delete", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *azureId).Execute() @@ -260,7 +260,7 @@ func TestProvidersAPIService(t *testing.T) { t.Run("Test ProvidersAPIService GCP Delete", func(t *testing.T) { - //t.Skip("skip test") // remove to run test + t.Skip("skip test") // remove to run test httpRes, err := apiClient.DiscoveryConfigurationAPIV2.ProvidersAPI.Delete(context.Background(), *gcpId).Execute()