From c56048578e4fa2730b22a39b4997d28cf16adfe2 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Tue, 5 Aug 2025 13:48:39 +0000 Subject: [PATCH] Generate observability --- services/observability/api_default.go | 30 +++- .../model_create_credentials_payload.go | 129 ++++++++++++++++++ .../model_create_credentials_payload_test.go | 11 ++ services/observability/model_credentials.go | 48 +++++++ .../observability/model_service_keys_list.go | 48 +++++++ ...pdate_metrics_storage_retention_payload.go | 6 +- 6 files changed, 264 insertions(+), 8 deletions(-) create mode 100644 services/observability/model_create_credentials_payload.go create mode 100644 services/observability/model_create_credentials_payload_test.go diff --git a/services/observability/api_default.go b/services/observability/api_default.go index c0c0f96a1..d70106ed3 100644 --- a/services/observability/api_default.go +++ b/services/observability/api_default.go @@ -1229,6 +1229,7 @@ type ApiCreateAlertrulesRequest interface { } type ApiCreateCredentialsRequest interface { + CreateCredentialsPayload(createCredentialsPayload CreateCredentialsPayload) ApiCreateCredentialsRequest Execute() (*CreateCredentialsResponse, error) } @@ -2104,10 +2105,16 @@ func (a *APIClient) CreateAlertrulesExecute(ctx context.Context, groupName strin } type CreateCredentialsRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + createCredentialsPayload *CreateCredentialsPayload +} + +func (r CreateCredentialsRequest) CreateCredentialsPayload(createCredentialsPayload CreateCredentialsPayload) ApiCreateCredentialsRequest { + r.createCredentialsPayload = &createCredentialsPayload + return r } func (r CreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) { @@ -2136,7 +2143,7 @@ func (r CreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) localVarFormParams := url.Values{} // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -2152,6 +2159,8 @@ func (r CreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createCredentialsPayload req, err := client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -2184,6 +2193,17 @@ func (r CreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } if localVarHTTPResponse.StatusCode == 403 { var v PermissionDenied err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) diff --git a/services/observability/model_create_credentials_payload.go b/services/observability/model_create_credentials_payload.go new file mode 100644 index 000000000..ced2d78bf --- /dev/null +++ b/services/observability/model_create_credentials_payload.go @@ -0,0 +1,129 @@ +/* +STACKIT Observability API + +API endpoints for Observability on STACKIT + +API version: 1.1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package observability + +import ( + "encoding/json" +) + +// checks if the CreateCredentialsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateCredentialsPayload{} + +/* + types and functions for description +*/ + +// isNotNullableString +type CreateCredentialsPayloadGetDescriptionAttributeType = *string + +func getCreateCredentialsPayloadGetDescriptionAttributeTypeOk(arg CreateCredentialsPayloadGetDescriptionAttributeType) (ret CreateCredentialsPayloadGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateCredentialsPayloadGetDescriptionAttributeType(arg *CreateCredentialsPayloadGetDescriptionAttributeType, val CreateCredentialsPayloadGetDescriptionRetType) { + *arg = &val +} + +type CreateCredentialsPayloadGetDescriptionArgType = string +type CreateCredentialsPayloadGetDescriptionRetType = string + +// CreateCredentialsPayload Create new credentials with (optional) description +type CreateCredentialsPayload struct { + // description + Description CreateCredentialsPayloadGetDescriptionAttributeType `json:"description,omitempty"` +} + +// NewCreateCredentialsPayload instantiates a new CreateCredentialsPayload 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 NewCreateCredentialsPayload() *CreateCredentialsPayload { + this := CreateCredentialsPayload{} + return &this +} + +// NewCreateCredentialsPayloadWithDefaults instantiates a new CreateCredentialsPayload 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 NewCreateCredentialsPayloadWithDefaults() *CreateCredentialsPayload { + this := CreateCredentialsPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateCredentialsPayload) GetDescription() (res CreateCredentialsPayloadGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *CreateCredentialsPayload) GetDescriptionOk() (ret CreateCredentialsPayloadGetDescriptionRetType, ok bool) { + return getCreateCredentialsPayloadGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateCredentialsPayload) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateCredentialsPayload) SetDescription(v CreateCredentialsPayloadGetDescriptionRetType) { + setCreateCredentialsPayloadGetDescriptionAttributeType(&o.Description, v) +} + +func (o CreateCredentialsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateCredentialsPayloadGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } + return toSerialize, nil +} + +type NullableCreateCredentialsPayload struct { + value *CreateCredentialsPayload + isSet bool +} + +func (v NullableCreateCredentialsPayload) Get() *CreateCredentialsPayload { + return v.value +} + +func (v *NullableCreateCredentialsPayload) Set(val *CreateCredentialsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateCredentialsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateCredentialsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateCredentialsPayload(val *CreateCredentialsPayload) *NullableCreateCredentialsPayload { + return &NullableCreateCredentialsPayload{value: val, isSet: true} +} + +func (v NullableCreateCredentialsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateCredentialsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_create_credentials_payload_test.go b/services/observability/model_create_credentials_payload_test.go new file mode 100644 index 000000000..ae3f559ed --- /dev/null +++ b/services/observability/model_create_credentials_payload_test.go @@ -0,0 +1,11 @@ +/* +STACKIT Observability API + +API endpoints for Observability on STACKIT + +API version: 1.1.1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package observability diff --git a/services/observability/model_credentials.go b/services/observability/model_credentials.go index c086b405b..94fe14615 100644 --- a/services/observability/model_credentials.go +++ b/services/observability/model_credentials.go @@ -17,6 +17,27 @@ import ( // checks if the Credentials type satisfies the MappedNullable interface at compile time var _ MappedNullable = &Credentials{} +/* + types and functions for description +*/ + +// isNotNullableString +type CredentialsGetDescriptionAttributeType = *string + +func getCredentialsGetDescriptionAttributeTypeOk(arg CredentialsGetDescriptionAttributeType) (ret CredentialsGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCredentialsGetDescriptionAttributeType(arg *CredentialsGetDescriptionAttributeType, val CredentialsGetDescriptionRetType) { + *arg = &val +} + +type CredentialsGetDescriptionArgType = string +type CredentialsGetDescriptionRetType = string + /* types and functions for password */ @@ -61,6 +82,7 @@ type CredentialsGetUsernameRetType = string // Credentials struct for Credentials type Credentials struct { + Description CredentialsGetDescriptionAttributeType `json:"description,omitempty"` // REQUIRED Password CredentialsGetPasswordAttributeType `json:"password" required:"true"` // REQUIRED @@ -88,6 +110,29 @@ func NewCredentialsWithDefaults() *Credentials { return &this } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *Credentials) GetDescription() (res CredentialsGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *Credentials) GetDescriptionOk() (ret CredentialsGetDescriptionRetType, ok bool) { + return getCredentialsGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *Credentials) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *Credentials) SetDescription(v CredentialsGetDescriptionRetType) { + setCredentialsGetDescriptionAttributeType(&o.Description, v) +} + // GetPassword returns the Password field value func (o *Credentials) GetPassword() (ret CredentialsGetPasswordRetType) { ret, _ = o.GetPasswordOk() @@ -124,6 +169,9 @@ func (o *Credentials) SetUsername(v CredentialsGetUsernameRetType) { func (o Credentials) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if val, ok := getCredentialsGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } if val, ok := getCredentialsGetPasswordAttributeTypeOk(o.Password); ok { toSerialize["Password"] = val } diff --git a/services/observability/model_service_keys_list.go b/services/observability/model_service_keys_list.go index 7806afb34..6cb313904 100644 --- a/services/observability/model_service_keys_list.go +++ b/services/observability/model_service_keys_list.go @@ -37,6 +37,27 @@ func setServiceKeysListGetCredentialsInfoAttributeType(arg *ServiceKeysListGetCr *arg = &val } +/* + types and functions for description +*/ + +// isNotNullableString +type ServiceKeysListGetDescriptionAttributeType = *string + +func getServiceKeysListGetDescriptionAttributeTypeOk(arg ServiceKeysListGetDescriptionAttributeType) (ret ServiceKeysListGetDescriptionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServiceKeysListGetDescriptionAttributeType(arg *ServiceKeysListGetDescriptionAttributeType, val ServiceKeysListGetDescriptionRetType) { + *arg = &val +} + +type ServiceKeysListGetDescriptionArgType = string +type ServiceKeysListGetDescriptionRetType = string + /* types and functions for id */ @@ -82,6 +103,7 @@ type ServiceKeysListGetNameRetType = string // ServiceKeysList struct for ServiceKeysList type ServiceKeysList struct { CredentialsInfo ServiceKeysListGetCredentialsInfoAttributeType `json:"credentialsInfo,omitempty"` + Description ServiceKeysListGetDescriptionAttributeType `json:"description,omitempty"` // REQUIRED Id ServiceKeysListGetIdAttributeType `json:"id" required:"true"` // REQUIRED @@ -132,6 +154,29 @@ func (o *ServiceKeysList) SetCredentialsInfo(v ServiceKeysListGetCredentialsInfo setServiceKeysListGetCredentialsInfoAttributeType(&o.CredentialsInfo, v) } +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *ServiceKeysList) GetDescription() (res ServiceKeysListGetDescriptionRetType) { + res, _ = o.GetDescriptionOk() + return +} + +// 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 *ServiceKeysList) GetDescriptionOk() (ret ServiceKeysListGetDescriptionRetType, ok bool) { + return getServiceKeysListGetDescriptionAttributeTypeOk(o.Description) +} + +// HasDescription returns a boolean if a field has been set. +func (o *ServiceKeysList) HasDescription() bool { + _, ok := o.GetDescriptionOk() + return ok +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *ServiceKeysList) SetDescription(v ServiceKeysListGetDescriptionRetType) { + setServiceKeysListGetDescriptionAttributeType(&o.Description, v) +} + // GetId returns the Id field value func (o *ServiceKeysList) GetId() (ret ServiceKeysListGetIdRetType) { ret, _ = o.GetIdOk() @@ -171,6 +216,9 @@ func (o ServiceKeysList) ToMap() (map[string]interface{}, error) { if val, ok := getServiceKeysListGetCredentialsInfoAttributeTypeOk(o.CredentialsInfo); ok { toSerialize["CredentialsInfo"] = val } + if val, ok := getServiceKeysListGetDescriptionAttributeTypeOk(o.Description); ok { + toSerialize["Description"] = val + } if val, ok := getServiceKeysListGetIdAttributeTypeOk(o.Id); ok { toSerialize["Id"] = val } diff --git a/services/observability/model_update_metrics_storage_retention_payload.go b/services/observability/model_update_metrics_storage_retention_payload.go index 50b63fbd0..7b4f3123a 100644 --- a/services/observability/model_update_metrics_storage_retention_payload.go +++ b/services/observability/model_update_metrics_storage_retention_payload.go @@ -82,13 +82,13 @@ type UpdateMetricsStorageRetentionPayloadGetMetricsRetentionTimeRawRetType = str // UpdateMetricsStorageRetentionPayload struct for UpdateMetricsStorageRetentionPayload type UpdateMetricsStorageRetentionPayload struct { - // Retention time of longtime storage of 1h sampled data. After that time the data will be deleted permanently. `Additional Validators:` * Should be a valid time string * Should not be bigger than metricsRetentionTime5m + // Retention time of longtime storage of 1h sampled data. After that time the 1h sampled data will be deleted permanently. The goal of downsampling is to get fast results for queries over long time intervals. It is recommended to set this value to be the same as metricsRetentionTimeRaw to ensure zoom-in capabilities in your dashboards. The default value is 90 days. `Additional Validators:` * Should be a valid time string (e.g. '90d'). * Should be between '10d' and '780d'. * Note: For compatibility reasons, values between '0d' and '792d' are also accepted. However, these will be automatically adjusted in the backend to the recommended range of '10d' to '780d'. // REQUIRED MetricsRetentionTime1h UpdateMetricsStorageRetentionPayloadGetMetricsRetentionTime1hAttributeType `json:"metricsRetentionTime1h" required:"true"` - // Retention time of longtime storage of 5m sampled data. After that time the data will be down sampled to 1h. `Additional Validators:` * Should be a valid time string * Should not be bigger than metricsRetentionTimeRaw + // Retention time of longtime storage of 5m sampled data. After that time the 5m sampled data will be deleted permanently. All 5m resolution metrics older than 10 days are downsampled at a 1h resolution. The goal of downsampling is to get fast results for queries over long time intervals. It is recommended to set this value to be the same as metricsRetentionTimeRaw to ensure zoom-in capabilities in your dashboards. The default value is 90 days. `Additional Validators:` * Should be a valid time string (e.g. '90d'). * Should be between '10d' and '780d'. * Note: For compatibility reasons, values between '0d' and '792d' are also accepted. However, these will be automatically adjusted in the backend to the recommended range of '10d' to '780d'. // REQUIRED MetricsRetentionTime5m UpdateMetricsStorageRetentionPayloadGetMetricsRetentionTime5mAttributeType `json:"metricsRetentionTime5m" required:"true"` - // Retention time of longtime storage of raw sampled data. After that time the data will be down sampled to 5m. Keep in mind, that the initial goal of downsampling is not saving disk or object storage space. In fact, downsampling doesn't save you any space but instead, it adds 2 more blocks for each raw block which are only slightly smaller or relatively similar size to raw block. This is done by internal downsampling implementation which to be mathematically correct holds various aggregations. This means that downsampling can increase the size of your storage a bit (~3x), if you choose to store all resolutions (recommended). The goal of downsampling is to provide an opportunity to get fast results for range queries of big time intervals like months or years. `Additional Validators:` * Should be a valid time string * Should not be bigger than 13 months + // Retention time of longtime storage of raw data. After that time the raw data will be deleted permanently. All raw resolution metrics that are older than 40 hours are downsampled at a 5m resolution. The default value is 90 days. `Additional Validators:` * Should be a valid time string (e.g. '90d'). * Should be between '2d' and '780d'. * Note: For compatibility reasons, values between '0d' and '792d' are also accepted. However, these will be automatically adjusted in the backend to the recommended range of '2d' to '780d'. // REQUIRED MetricsRetentionTimeRaw UpdateMetricsStorageRetentionPayloadGetMetricsRetentionTimeRawAttributeType `json:"metricsRetentionTimeRaw" required:"true"` }