diff --git a/CHANGELOG.md b/CHANGELOG.md index 40d3a3d36..99648a5ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ ## Release (2024-XX-XX) +- `serverbackup`: [v0.4.0](services/serverbackup/CHANGELOG.md#v040-2024-11-26) + - **Feature:** Add support for managing `BackupPolicy` resources - `serverupdate`: [v0.2.0](services/serverupdate/CHANGELOG.md#v020-2024-11-26) - **Feature:** Add support for managing `UpdatePolicy` resources - `dns`: [v0.12.0](services/dns/CHANGELOG.md#v0120-2024-11-20) diff --git a/services/serverbackup/CHANGELOG.md b/services/serverbackup/CHANGELOG.md index 8d351d9d1..c7dbb6cb5 100644 --- a/services/serverbackup/CHANGELOG.md +++ b/services/serverbackup/CHANGELOG.md @@ -1,3 +1,7 @@ +## v0.4.0 (2024-11-26) + +- **Feature:** Add support for managing `BackupPolicy` resources + ## v0.3.0 (2024-11-20) - **Breaking changes**: diff --git a/services/serverbackup/api_default.go b/services/serverbackup/api_default.go index 048afb1c0..20a82327a 100644 --- a/services/serverbackup/api_default.go +++ b/services/serverbackup/api_default.go @@ -1336,6 +1336,121 @@ func (a *APIClient) GetBackupScheduleExecute(ctx context.Context, projectId stri return r.Execute() } +type ApiListBackupPoliciesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ApiListBackupPoliciesRequest) Execute() (*GetBackupPoliciesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetBackupPoliciesResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListBackupPolicies") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/backup-policies" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListBackupPolicies: get list of backup policies + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId project id + @return ApiListBackupPoliciesRequest +*/ +func (a *APIClient) ListBackupPolicies(ctx context.Context, projectId string) ApiListBackupPoliciesRequest { + return ApiListBackupPoliciesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListBackupPoliciesExecute(ctx context.Context, projectId string) (*GetBackupPoliciesResponse, error) { + r := ApiListBackupPoliciesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + type ApiListBackupSchedulesRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/serverbackup/api_default_test.go b/services/serverbackup/api_default_test.go index 639e571e8..563dc8905 100644 --- a/services/serverbackup/api_default_test.go +++ b/services/serverbackup/api_default_test.go @@ -604,6 +604,58 @@ func Test_serverbackup_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService ListBackupPolicies", func(t *testing.T) { + path := "/v1/projects/{projectId}/backup-policies" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetBackupPoliciesResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for serverbackup_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListBackupPolicies(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListBackupSchedules", func(t *testing.T) { path := "/v1/projects/{projectId}/servers/{serverId}/backup-schedules" projectIdValue := "projectId" diff --git a/services/serverbackup/model_backup_policy.go b/services/serverbackup/model_backup_policy.go new file mode 100644 index 000000000..3b02ecc45 --- /dev/null +++ b/services/serverbackup/model_backup_policy.go @@ -0,0 +1,332 @@ +/* +STACKIT Server Backup Management API + +API endpoints for Server Backup Operations on STACKIT Servers. + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serverbackup + +import ( + "encoding/json" +) + +// checks if the BackupPolicy type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupPolicy{} + +// BackupPolicy struct for BackupPolicy +type BackupPolicy struct { + BackupProperties *BackupPolicyBackupProperties `json:"backupProperties,omitempty"` + Default *bool `json:"default,omitempty"` + Description *string `json:"description,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Rrule *string `json:"rrule,omitempty"` +} + +// NewBackupPolicy instantiates a new BackupPolicy 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 NewBackupPolicy() *BackupPolicy { + this := BackupPolicy{} + return &this +} + +// NewBackupPolicyWithDefaults instantiates a new BackupPolicy object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupPolicyWithDefaults() *BackupPolicy { + this := BackupPolicy{} + return &this +} + +// GetBackupProperties returns the BackupProperties field value if set, zero value otherwise. +func (o *BackupPolicy) GetBackupProperties() *BackupPolicyBackupProperties { + if o == nil || IsNil(o.BackupProperties) { + var ret *BackupPolicyBackupProperties + return ret + } + return o.BackupProperties +} + +// GetBackupPropertiesOk returns a tuple with the BackupProperties field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetBackupPropertiesOk() (*BackupPolicyBackupProperties, bool) { + if o == nil || IsNil(o.BackupProperties) { + return nil, false + } + return o.BackupProperties, true +} + +// HasBackupProperties returns a boolean if a field has been set. +func (o *BackupPolicy) HasBackupProperties() bool { + if o != nil && !IsNil(o.BackupProperties) { + return true + } + + return false +} + +// SetBackupProperties gets a reference to the given BackupPolicyBackupProperties and assigns it to the BackupProperties field. +func (o *BackupPolicy) SetBackupProperties(v *BackupPolicyBackupProperties) { + o.BackupProperties = v +} + +// GetDefault returns the Default field value if set, zero value otherwise. +func (o *BackupPolicy) GetDefault() *bool { + if o == nil || IsNil(o.Default) { + var ret *bool + return ret + } + return o.Default +} + +// GetDefaultOk returns a tuple with the Default field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetDefaultOk() (*bool, bool) { + if o == nil || IsNil(o.Default) { + return nil, false + } + return o.Default, true +} + +// HasDefault returns a boolean if a field has been set. +func (o *BackupPolicy) HasDefault() bool { + if o != nil && !IsNil(o.Default) { + return true + } + + return false +} + +// SetDefault gets a reference to the given bool and assigns it to the Default field. +func (o *BackupPolicy) SetDefault(v *bool) { + o.Default = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *BackupPolicy) GetDescription() *string { + if o == nil || IsNil(o.Description) { + var ret *string + return ret + } + return o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *BackupPolicy) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *BackupPolicy) SetDescription(v *string) { + o.Description = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *BackupPolicy) GetEnabled() *bool { + if o == nil || IsNil(o.Enabled) { + var ret *bool + return ret + } + return o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *BackupPolicy) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *BackupPolicy) SetEnabled(v *bool) { + o.Enabled = v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *BackupPolicy) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetIdOk() (*string, bool) { + if o == nil || IsNil(o.Id) { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *BackupPolicy) HasId() bool { + if o != nil && !IsNil(o.Id) { + return true + } + + return false +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *BackupPolicy) SetId(v *string) { + o.Id = v +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BackupPolicy) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BackupPolicy) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BackupPolicy) SetName(v *string) { + o.Name = v +} + +// GetRrule returns the Rrule field value if set, zero value otherwise. +func (o *BackupPolicy) GetRrule() *string { + if o == nil || IsNil(o.Rrule) { + var ret *string + return ret + } + return o.Rrule +} + +// GetRruleOk returns a tuple with the Rrule field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicy) GetRruleOk() (*string, bool) { + if o == nil || IsNil(o.Rrule) { + return nil, false + } + return o.Rrule, true +} + +// HasRrule returns a boolean if a field has been set. +func (o *BackupPolicy) HasRrule() bool { + if o != nil && !IsNil(o.Rrule) { + return true + } + + return false +} + +// SetRrule gets a reference to the given string and assigns it to the Rrule field. +func (o *BackupPolicy) SetRrule(v *string) { + o.Rrule = v +} + +func (o BackupPolicy) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.BackupProperties) { + toSerialize["backupProperties"] = o.BackupProperties + } + if !IsNil(o.Default) { + toSerialize["default"] = o.Default + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + if !IsNil(o.Id) { + toSerialize["id"] = o.Id + } + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Rrule) { + toSerialize["rrule"] = o.Rrule + } + return toSerialize, nil +} + +type NullableBackupPolicy struct { + value *BackupPolicy + isSet bool +} + +func (v NullableBackupPolicy) Get() *BackupPolicy { + return v.value +} + +func (v *NullableBackupPolicy) Set(val *BackupPolicy) { + v.value = val + v.isSet = true +} + +func (v NullableBackupPolicy) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupPolicy) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupPolicy(val *BackupPolicy) *NullableBackupPolicy { + return &NullableBackupPolicy{value: val, isSet: true} +} + +func (v NullableBackupPolicy) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupPolicy) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serverbackup/model_backup_policy_backup_properties.go b/services/serverbackup/model_backup_policy_backup_properties.go new file mode 100644 index 000000000..74cdddddd --- /dev/null +++ b/services/serverbackup/model_backup_policy_backup_properties.go @@ -0,0 +1,152 @@ +/* +STACKIT Server Backup Management API + +API endpoints for Server Backup Operations on STACKIT Servers. + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serverbackup + +import ( + "encoding/json" +) + +// checks if the BackupPolicyBackupProperties type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &BackupPolicyBackupProperties{} + +// BackupPolicyBackupProperties struct for BackupPolicyBackupProperties +type BackupPolicyBackupProperties struct { + Name *string `json:"name,omitempty"` + RetentionPeriod *int64 `json:"retentionPeriod,omitempty"` +} + +// NewBackupPolicyBackupProperties instantiates a new BackupPolicyBackupProperties 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 NewBackupPolicyBackupProperties() *BackupPolicyBackupProperties { + this := BackupPolicyBackupProperties{} + return &this +} + +// NewBackupPolicyBackupPropertiesWithDefaults instantiates a new BackupPolicyBackupProperties object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewBackupPolicyBackupPropertiesWithDefaults() *BackupPolicyBackupProperties { + this := BackupPolicyBackupProperties{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *BackupPolicyBackupProperties) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicyBackupProperties) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *BackupPolicyBackupProperties) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *BackupPolicyBackupProperties) SetName(v *string) { + o.Name = v +} + +// GetRetentionPeriod returns the RetentionPeriod field value if set, zero value otherwise. +func (o *BackupPolicyBackupProperties) GetRetentionPeriod() *int64 { + if o == nil || IsNil(o.RetentionPeriod) { + var ret *int64 + return ret + } + return o.RetentionPeriod +} + +// GetRetentionPeriodOk returns a tuple with the RetentionPeriod field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *BackupPolicyBackupProperties) GetRetentionPeriodOk() (*int64, bool) { + if o == nil || IsNil(o.RetentionPeriod) { + return nil, false + } + return o.RetentionPeriod, true +} + +// HasRetentionPeriod returns a boolean if a field has been set. +func (o *BackupPolicyBackupProperties) HasRetentionPeriod() bool { + if o != nil && !IsNil(o.RetentionPeriod) { + return true + } + + return false +} + +// SetRetentionPeriod gets a reference to the given int64 and assigns it to the RetentionPeriod field. +func (o *BackupPolicyBackupProperties) SetRetentionPeriod(v *int64) { + o.RetentionPeriod = v +} + +func (o BackupPolicyBackupProperties) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.RetentionPeriod) { + toSerialize["retentionPeriod"] = o.RetentionPeriod + } + return toSerialize, nil +} + +type NullableBackupPolicyBackupProperties struct { + value *BackupPolicyBackupProperties + isSet bool +} + +func (v NullableBackupPolicyBackupProperties) Get() *BackupPolicyBackupProperties { + return v.value +} + +func (v *NullableBackupPolicyBackupProperties) Set(val *BackupPolicyBackupProperties) { + v.value = val + v.isSet = true +} + +func (v NullableBackupPolicyBackupProperties) IsSet() bool { + return v.isSet +} + +func (v *NullableBackupPolicyBackupProperties) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBackupPolicyBackupProperties(val *BackupPolicyBackupProperties) *NullableBackupPolicyBackupProperties { + return &NullableBackupPolicyBackupProperties{value: val, isSet: true} +} + +func (v NullableBackupPolicyBackupProperties) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBackupPolicyBackupProperties) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/serverbackup/model_get_backup_policies_response.go b/services/serverbackup/model_get_backup_policies_response.go new file mode 100644 index 000000000..d10d7bc8e --- /dev/null +++ b/services/serverbackup/model_get_backup_policies_response.go @@ -0,0 +1,116 @@ +/* +STACKIT Server Backup Management API + +API endpoints for Server Backup Operations on STACKIT Servers. + +API version: 1.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package serverbackup + +import ( + "encoding/json" +) + +// checks if the GetBackupPoliciesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetBackupPoliciesResponse{} + +// GetBackupPoliciesResponse struct for GetBackupPoliciesResponse +type GetBackupPoliciesResponse struct { + Items *[]BackupPolicy `json:"items,omitempty"` +} + +// NewGetBackupPoliciesResponse instantiates a new GetBackupPoliciesResponse 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 NewGetBackupPoliciesResponse() *GetBackupPoliciesResponse { + this := GetBackupPoliciesResponse{} + return &this +} + +// NewGetBackupPoliciesResponseWithDefaults instantiates a new GetBackupPoliciesResponse object +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set +func NewGetBackupPoliciesResponseWithDefaults() *GetBackupPoliciesResponse { + this := GetBackupPoliciesResponse{} + return &this +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *GetBackupPoliciesResponse) GetItems() *[]BackupPolicy { + if o == nil || IsNil(o.Items) { + var ret *[]BackupPolicy + return ret + } + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GetBackupPoliciesResponse) GetItemsOk() (*[]BackupPolicy, bool) { + if o == nil || IsNil(o.Items) { + return nil, false + } + return o.Items, true +} + +// HasItems returns a boolean if a field has been set. +func (o *GetBackupPoliciesResponse) HasItems() bool { + if o != nil && !IsNil(o.Items) { + return true + } + + return false +} + +// SetItems gets a reference to the given []BackupPolicy and assigns it to the Items field. +func (o *GetBackupPoliciesResponse) SetItems(v *[]BackupPolicy) { + o.Items = v +} + +func (o GetBackupPoliciesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Items) { + toSerialize["items"] = o.Items + } + return toSerialize, nil +} + +type NullableGetBackupPoliciesResponse struct { + value *GetBackupPoliciesResponse + isSet bool +} + +func (v NullableGetBackupPoliciesResponse) Get() *GetBackupPoliciesResponse { + return v.value +} + +func (v *NullableGetBackupPoliciesResponse) Set(val *GetBackupPoliciesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetBackupPoliciesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetBackupPoliciesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetBackupPoliciesResponse(val *GetBackupPoliciesResponse) *NullableGetBackupPoliciesResponse { + return &NullableGetBackupPoliciesResponse{value: val, isSet: true} +} + +func (v NullableGetBackupPoliciesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetBackupPoliciesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +}