From 4c9f58eeea1a5dd19880c7affcbaf9f606bb9164 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 27 Mar 2025 08:05:44 +0000 Subject: [PATCH 1/2] Generate observability --- services/observability/api_default.go | 3059 +++++++++++++---- services/observability/api_default_test.go | 989 +++++- services/observability/model_alert_group.go | 219 ++ .../model_alert_group_response.go | 169 + .../model_alert_groups_response.go | 169 + services/observability/model_alert_rule.go | 314 ++ .../observability/model_alert_rule_record.go | 364 ++ .../model_alert_rules_response.go | 169 + .../model_create_alertgroups_payload.go | 222 ++ .../model_create_alertrules_payload.go | 319 ++ .../model_update_alertgroup_payload.go | 177 + .../model_update_alertgroups_request_inner.go | 222 ++ ...e_alertgroups_request_inner_rules_inner.go | 319 ++ 13 files changed, 5952 insertions(+), 759 deletions(-) create mode 100644 services/observability/model_alert_group.go create mode 100644 services/observability/model_alert_group_response.go create mode 100644 services/observability/model_alert_groups_response.go create mode 100644 services/observability/model_alert_rule.go create mode 100644 services/observability/model_alert_rule_record.go create mode 100644 services/observability/model_alert_rules_response.go create mode 100644 services/observability/model_create_alertgroups_payload.go create mode 100644 services/observability/model_create_alertrules_payload.go create mode 100644 services/observability/model_update_alertgroup_payload.go create mode 100644 services/observability/model_update_alertgroups_request_inner.go create mode 100644 services/observability/model_update_alertgroups_request_inner_rules_inner.go diff --git a/services/observability/api_default.go b/services/observability/api_default.go index c2a9821f7..6cdd9dda2 100644 --- a/services/observability/api_default.go +++ b/services/observability/api_default.go @@ -334,36 +334,45 @@ func (a *APIClient) CreateAlertConfigRouteExecute(ctx context.Context, instanceI return r.Execute() } -type ApiCreateCredentialsRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string +type ApiCreateAlertgroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + createAlertgroupsPayload *CreateAlertgroupsPayload } -func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) { +func (r ApiCreateAlertgroupsRequest) CreateAlertgroupsPayload(createAlertgroupsPayload CreateAlertgroupsPayload) ApiCreateAlertgroupsRequest { + r.createAlertgroupsPayload = &createAlertgroupsPayload + return r +} + +func (r ApiCreateAlertgroupsRequest) Execute() (*AlertGroupsResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *CreateCredentialsResponse + localVarReturnValue *AlertGroupsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCredentials") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAlertgroups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.createAlertgroupsPayload == nil { + return localVarReturnValue, fmt.Errorf("createAlertgroupsPayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -379,6 +388,8 @@ func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, erro if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createAlertgroupsPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -411,6 +422,17 @@ func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, erro Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -438,17 +460,17 @@ func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, erro } /* -CreateCredentials: Method for CreateCredentials +CreateAlertgroups: Method for CreateAlertgroups -Create technical user credentials. +Create alert group. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiCreateCredentialsRequest + @return ApiCreateAlertgroupsRequest */ -func (a *APIClient) CreateCredentials(ctx context.Context, instanceId string, projectId string) ApiCreateCredentialsRequest { - return ApiCreateCredentialsRequest{ +func (a *APIClient) CreateAlertgroups(ctx context.Context, instanceId string, projectId string) ApiCreateAlertgroupsRequest { + return ApiCreateAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -456,8 +478,8 @@ func (a *APIClient) CreateCredentials(ctx context.Context, instanceId string, pr } } -func (a *APIClient) CreateCredentialsExecute(ctx context.Context, instanceId string, projectId string) (*CreateCredentialsResponse, error) { - r := ApiCreateCredentialsRequest{ +func (a *APIClient) CreateAlertgroupsExecute(ctx context.Context, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiCreateAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -466,39 +488,43 @@ func (a *APIClient) CreateCredentialsExecute(ctx context.Context, instanceId str return r.Execute() } -type ApiCreateInstanceRequest struct { - ctx context.Context - apiService *DefaultApiService - projectId string - createInstancePayload *CreateInstancePayload +type ApiCreateAlertrulesRequest struct { + ctx context.Context + apiService *DefaultApiService + groupName string + instanceId string + projectId string + createAlertrulesPayload *CreateAlertrulesPayload } -func (r ApiCreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { - r.createInstancePayload = &createInstancePayload +func (r ApiCreateAlertrulesRequest) CreateAlertrulesPayload(createAlertrulesPayload CreateAlertrulesPayload) ApiCreateAlertrulesRequest { + r.createAlertrulesPayload = &createAlertrulesPayload return r } -func (r ApiCreateInstanceRequest) Execute() (*CreateInstanceResponse, error) { +func (r ApiCreateAlertrulesRequest) Execute() (*AlertRulesResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *CreateInstanceResponse + localVarReturnValue *AlertRulesResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateInstance") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateAlertrules") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.createInstancePayload == nil { - return localVarReturnValue, fmt.Errorf("createInstancePayload is required and must be specified") + if r.createAlertrulesPayload == nil { + return localVarReturnValue, fmt.Errorf("createAlertrulesPayload is required and must be specified") } // to determine the Content-Type header @@ -519,7 +545,7 @@ func (r ApiCreateInstanceRequest) Execute() (*CreateInstanceResponse, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.createInstancePayload + localVarPostBody = r.createAlertrulesPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -590,70 +616,67 @@ func (r ApiCreateInstanceRequest) Execute() (*CreateInstanceResponse, error) { } /* -CreateInstance: Method for CreateInstance +CreateAlertrules: Method for CreateAlertrules -Create new instance. +Create alert rule. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName + @param instanceId @param projectId - @return ApiCreateInstanceRequest + @return ApiCreateAlertrulesRequest */ -func (a *APIClient) CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest { - return ApiCreateInstanceRequest{ +func (a *APIClient) CreateAlertrules(ctx context.Context, groupName string, instanceId string, projectId string) ApiCreateAlertrulesRequest { + return ApiCreateAlertrulesRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, + instanceId: instanceId, projectId: projectId, } } -func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) (*CreateInstanceResponse, error) { - r := ApiCreateInstanceRequest{ +func (a *APIClient) CreateAlertrulesExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertRulesResponse, error) { + r := ApiCreateAlertrulesRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, + instanceId: instanceId, projectId: projectId, } return r.Execute() } -type ApiCreateScrapeConfigRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - createScrapeConfigPayload *CreateScrapeConfigPayload -} - -func (r ApiCreateScrapeConfigRequest) CreateScrapeConfigPayload(createScrapeConfigPayload CreateScrapeConfigPayload) ApiCreateScrapeConfigRequest { - r.createScrapeConfigPayload = &createScrapeConfigPayload - return r +type ApiCreateCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string } -func (r ApiCreateScrapeConfigRequest) Execute() (*ScrapeConfigsResponse, error) { +func (r ApiCreateCredentialsRequest) Execute() (*CreateCredentialsResponse, error) { var ( localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ScrapeConfigsResponse + localVarReturnValue *CreateCredentialsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateScrapeConfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateCredentials") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.createScrapeConfigPayload == nil { - return localVarReturnValue, fmt.Errorf("createScrapeConfigPayload is required and must be specified") - } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json"} + localVarHTTPContentTypes := []string{} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -669,8 +692,6 @@ func (r ApiCreateScrapeConfigRequest) Execute() (*ScrapeConfigsResponse, error) if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } - // body params - localVarPostBody = r.createScrapeConfigPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -703,17 +724,6 @@ func (r ApiCreateScrapeConfigRequest) Execute() (*ScrapeConfigsResponse, error) Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -741,17 +751,17 @@ func (r ApiCreateScrapeConfigRequest) Execute() (*ScrapeConfigsResponse, error) } /* -CreateScrapeConfig: Method for CreateScrapeConfig +CreateCredentials: Method for CreateCredentials -Create scrape config. +Create technical user credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiCreateScrapeConfigRequest + @return ApiCreateCredentialsRequest */ -func (a *APIClient) CreateScrapeConfig(ctx context.Context, instanceId string, projectId string) ApiCreateScrapeConfigRequest { - return ApiCreateScrapeConfigRequest{ +func (a *APIClient) CreateCredentials(ctx context.Context, instanceId string, projectId string) ApiCreateCredentialsRequest { + return ApiCreateCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -759,8 +769,8 @@ func (a *APIClient) CreateScrapeConfig(ctx context.Context, instanceId string, p } } -func (a *APIClient) CreateScrapeConfigExecute(ctx context.Context, instanceId string, projectId string) (*ScrapeConfigsResponse, error) { - r := ApiCreateScrapeConfigRequest{ +func (a *APIClient) CreateCredentialsExecute(ctx context.Context, instanceId string, projectId string) (*CreateCredentialsResponse, error) { + r := ApiCreateCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -769,38 +779,43 @@ func (a *APIClient) CreateScrapeConfigExecute(ctx context.Context, instanceId st return r.Execute() } -type ApiDeleteAlertConfigReceiverRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - receiver string +type ApiCreateInstanceRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createInstancePayload *CreateInstancePayload } -func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversResponse, error) { +func (r ApiCreateInstanceRequest) CreateInstancePayload(createInstancePayload CreateInstancePayload) ApiCreateInstanceRequest { + r.createInstancePayload = &createInstancePayload + return r +} + +func (r ApiCreateInstanceRequest) Execute() (*CreateInstanceResponse, error) { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigReceiversResponse + localVarReturnValue *CreateInstanceResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertConfigReceiver") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateInstance") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" - localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath := localBasePath + "/v1/projects/{projectId}/instances" localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.createInstancePayload == nil { + return localVarReturnValue, fmt.Errorf("createInstancePayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -816,6 +831,8 @@ func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createInstancePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -848,8 +865,8 @@ func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 403 { - var v PermissionDenied + if localVarHTTPResponse.StatusCode == 400 { + var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -859,8 +876,8 @@ func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Message + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -886,69 +903,70 @@ func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes } /* -DeleteAlertConfigReceiver: Method for DeleteAlertConfigReceiver +CreateInstance: Method for CreateInstance -Delete alert config receiver. +Create new instance. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). - @param instanceId @param projectId - @param receiver - @return ApiDeleteAlertConfigReceiverRequest + @return ApiCreateInstanceRequest */ -func (a *APIClient) DeleteAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiDeleteAlertConfigReceiverRequest { - return ApiDeleteAlertConfigReceiverRequest{ +func (a *APIClient) CreateInstance(ctx context.Context, projectId string) ApiCreateInstanceRequest { + return ApiCreateInstanceRequest{ apiService: a.defaultApi, ctx: ctx, - instanceId: instanceId, projectId: projectId, - receiver: receiver, } } -func (a *APIClient) DeleteAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigReceiversResponse, error) { - r := ApiDeleteAlertConfigReceiverRequest{ +func (a *APIClient) CreateInstanceExecute(ctx context.Context, projectId string) (*CreateInstanceResponse, error) { + r := ApiCreateInstanceRequest{ apiService: a.defaultApi, ctx: ctx, - instanceId: instanceId, projectId: projectId, - receiver: receiver, } return r.Execute() } -type ApiDeleteAlertConfigRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - receiver string +type ApiCreateScrapeConfigRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + createScrapeConfigPayload *CreateScrapeConfigPayload } -func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { +func (r ApiCreateScrapeConfigRequest) CreateScrapeConfigPayload(createScrapeConfigPayload CreateScrapeConfigPayload) ApiCreateScrapeConfigRequest { + r.createScrapeConfigPayload = &createScrapeConfigPayload + return r +} + +func (r ApiCreateScrapeConfigRequest) Execute() (*ScrapeConfigsResponse, error) { var ( - localVarHTTPMethod = http.MethodDelete + localVarHTTPMethod = http.MethodPost localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigRouteResponse + localVarReturnValue *ScrapeConfigsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertConfigRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateScrapeConfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.createScrapeConfigPayload == nil { + return localVarReturnValue, fmt.Errorf("createScrapeConfigPayload is required and must be specified") + } // to determine the Content-Type header - localVarHTTPContentTypes := []string{} + localVarHTTPContentTypes := []string{"application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -964,6 +982,8 @@ func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, if localVarHTTPHeaderAccept != "" { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } + // body params + localVarPostBody = r.createScrapeConfigPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -996,8 +1016,8 @@ func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 403 { - var v PermissionDenied + if localVarHTTPResponse.StatusCode == 400 { + var v Error err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -1007,8 +1027,8 @@ func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, newErr.Model = v return localVarReturnValue, newErr } - if localVarHTTPResponse.StatusCode == 404 { - var v Message + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -1034,62 +1054,59 @@ func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, } /* -DeleteAlertConfigRoute: Method for DeleteAlertConfigRoute +CreateScrapeConfig: Method for CreateScrapeConfig -Delete alert receiver for route. +Create scrape config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param receiver - @return ApiDeleteAlertConfigRouteRequest + @return ApiCreateScrapeConfigRequest */ -func (a *APIClient) DeleteAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiDeleteAlertConfigRouteRequest { - return ApiDeleteAlertConfigRouteRequest{ +func (a *APIClient) CreateScrapeConfig(ctx context.Context, instanceId string, projectId string) ApiCreateScrapeConfigRequest { + return ApiCreateScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, } } -func (a *APIClient) DeleteAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { - r := ApiDeleteAlertConfigRouteRequest{ +func (a *APIClient) CreateScrapeConfigExecute(ctx context.Context, instanceId string, projectId string) (*ScrapeConfigsResponse, error) { + r := ApiCreateScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, } return r.Execute() } -type ApiDeleteCredentialsRequest struct { +type ApiDeleteAlertConfigReceiverRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string - username string + receiver string } -func (r ApiDeleteCredentialsRequest) Execute() (*Message, error) { +func (r ApiDeleteAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversResponse, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Message + localVarReturnValue *AlertConfigReceiversResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCredentials") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertConfigReceiver") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1164,17 +1181,6 @@ func (r ApiDeleteCredentialsRequest) Execute() (*Message, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 500 { - var v Message - err = a.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 } @@ -1193,62 +1199,62 @@ func (r ApiDeleteCredentialsRequest) Execute() (*Message, error) { } /* -DeleteCredentials: Method for DeleteCredentials +DeleteAlertConfigReceiver: Method for DeleteAlertConfigReceiver -Delete technical credentials. +Delete alert config receiver. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param username - @return ApiDeleteCredentialsRequest + @param receiver + @return ApiDeleteAlertConfigReceiverRequest */ -func (a *APIClient) DeleteCredentials(ctx context.Context, instanceId string, projectId string, username string) ApiDeleteCredentialsRequest { - return ApiDeleteCredentialsRequest{ +func (a *APIClient) DeleteAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiDeleteAlertConfigReceiverRequest { + return ApiDeleteAlertConfigReceiverRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, + receiver: receiver, } } -func (a *APIClient) DeleteCredentialsExecute(ctx context.Context, instanceId string, projectId string, username string) (*Message, error) { - r := ApiDeleteCredentialsRequest{ +func (a *APIClient) DeleteAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigReceiversResponse, error) { + r := ApiDeleteAlertConfigReceiverRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, + receiver: receiver, } return r.Execute() } -type ApiDeleteCredentialsRemoteWriteConfigRequest struct { +type ApiDeleteAlertConfigRouteRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string - username string + receiver string } -func (r ApiDeleteCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemoteWriteDeleteResponse, error) { +func (r ApiDeleteAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *CredentialsRemoteWriteDeleteResponse + localVarReturnValue *AlertConfigRouteResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCredentialsRemoteWriteConfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertConfigRoute") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1303,17 +1309,6 @@ func (r ApiDeleteCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRem Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } - if localVarHTTPResponse.StatusCode == 400 { - var v Error - err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1334,17 +1329,6 @@ func (r ApiDeleteCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRem } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 502 { - var v Message - err = a.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 } @@ -1363,58 +1347,60 @@ func (r ApiDeleteCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRem } /* -DeleteCredentialsRemoteWriteConfig: Method for DeleteCredentialsRemoteWriteConfig +DeleteAlertConfigRoute: Method for DeleteAlertConfigRoute -Delete remote write config for credentials. +Delete alert receiver for route. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param username - @return ApiDeleteCredentialsRemoteWriteConfigRequest + @param receiver + @return ApiDeleteAlertConfigRouteRequest */ -func (a *APIClient) DeleteCredentialsRemoteWriteConfig(ctx context.Context, instanceId string, projectId string, username string) ApiDeleteCredentialsRemoteWriteConfigRequest { - return ApiDeleteCredentialsRemoteWriteConfigRequest{ +func (a *APIClient) DeleteAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiDeleteAlertConfigRouteRequest { + return ApiDeleteAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, + receiver: receiver, } } -func (a *APIClient) DeleteCredentialsRemoteWriteConfigExecute(ctx context.Context, instanceId string, projectId string, username string) (*CredentialsRemoteWriteDeleteResponse, error) { - r := ApiDeleteCredentialsRemoteWriteConfigRequest{ +func (a *APIClient) DeleteAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { + r := ApiDeleteAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, + receiver: receiver, } return r.Execute() } -type ApiDeleteInstanceRequest struct { +type ApiDeleteAlertgroupRequest struct { ctx context.Context apiService *DefaultApiService + groupName string instanceId string projectId string } -func (r ApiDeleteInstanceRequest) Execute() (*InstanceResponse, error) { +func (r ApiDeleteAlertgroupRequest) Execute() (*AlertGroupsResponse, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *InstanceResponse + localVarReturnValue *AlertGroupsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertgroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) @@ -1471,6 +1457,17 @@ func (r ApiDeleteInstanceRequest) Execute() (*InstanceResponse, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Message + err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -1480,6 +1477,17 @@ func (r ApiDeleteInstanceRequest) Execute() (*InstanceResponse, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 } @@ -1498,64 +1506,77 @@ func (r ApiDeleteInstanceRequest) Execute() (*InstanceResponse, error) { } /* -DeleteInstance: Method for DeleteInstance +DeleteAlertgroup: Method for DeleteAlertgroup -Delete instance. +Delete alert group config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName @param instanceId @param projectId - @return ApiDeleteInstanceRequest + @return ApiDeleteAlertgroupRequest */ -func (a *APIClient) DeleteInstance(ctx context.Context, instanceId string, projectId string) ApiDeleteInstanceRequest { - return ApiDeleteInstanceRequest{ +func (a *APIClient) DeleteAlertgroup(ctx context.Context, groupName string, instanceId string, projectId string) ApiDeleteAlertgroupRequest { + return ApiDeleteAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, } } -func (a *APIClient) DeleteInstanceExecute(ctx context.Context, instanceId string, projectId string) (*InstanceResponse, error) { - r := ApiDeleteInstanceRequest{ +func (a *APIClient) DeleteAlertgroupExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiDeleteAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, } return r.Execute() } -type ApiDeleteScrapeConfigRequest struct { +type ApiDeleteAlertgroupsRequest struct { ctx context.Context apiService *DefaultApiService instanceId string - jobName string projectId string + groupName *[]string } -func (r ApiDeleteScrapeConfigRequest) Execute() (*DeleteScrapeConfigResponse, error) { +// Name of the groups that should be deleted + +func (r ApiDeleteAlertgroupsRequest) GroupName(groupName []string) ApiDeleteAlertgroupsRequest { + r.groupName = &groupName + return r +} + +func (r ApiDeleteAlertgroupsRequest) Execute() (*AlertGroupsResponse, error) { var ( localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *DeleteScrapeConfigResponse + localVarReturnValue *AlertGroupsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteScrapeConfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertgroups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(r.jobName, "jobName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.groupName == nil { + return localVarReturnValue, fmt.Errorf("groupName is required and must be specified") + } + parameterAddToHeaderOrQuery(localVarQueryParams, "groupName", r.groupName, "csv") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1614,17 +1635,6 @@ func (r ApiDeleteScrapeConfigRequest) Execute() (*DeleteScrapeConfigResponse, er } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Message - err = a.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 } @@ -1643,67 +1653,76 @@ func (r ApiDeleteScrapeConfigRequest) Execute() (*DeleteScrapeConfigResponse, er } /* -DeleteScrapeConfig: Method for DeleteScrapeConfig +DeleteAlertgroups: Method for DeleteAlertgroups -Delete scrape config. +Delete alert groups. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId - @param jobName @param projectId - @return ApiDeleteScrapeConfigRequest + @return ApiDeleteAlertgroupsRequest */ -func (a *APIClient) DeleteScrapeConfig(ctx context.Context, instanceId string, jobName string, projectId string) ApiDeleteScrapeConfigRequest { - return ApiDeleteScrapeConfigRequest{ +func (a *APIClient) DeleteAlertgroups(ctx context.Context, instanceId string, projectId string) ApiDeleteAlertgroupsRequest { + return ApiDeleteAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, - jobName: jobName, projectId: projectId, } } -func (a *APIClient) DeleteScrapeConfigExecute(ctx context.Context, instanceId string, jobName string, projectId string) (*DeleteScrapeConfigResponse, error) { - r := ApiDeleteScrapeConfigRequest{ +func (a *APIClient) DeleteAlertgroupsExecute(ctx context.Context, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiDeleteAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, - jobName: jobName, projectId: projectId, } return r.Execute() } -type ApiGetAlertConfigReceiverRequest struct { +type ApiDeleteAlertrulesRequest struct { ctx context.Context apiService *DefaultApiService + groupName string instanceId string projectId string - receiver string + alertName *[]string } -func (r ApiGetAlertConfigReceiverRequest) Execute() (*Receiver, error) { +// Name of the alert rules that should be deleted + +func (r ApiDeleteAlertrulesRequest) AlertName(alertName []string) ApiDeleteAlertrulesRequest { + r.alertName = &alertName + return r +} + +func (r ApiDeleteAlertrulesRequest) Execute() (*AlertRulesResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Receiver + localVarReturnValue *AlertRulesResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigReceiver") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteAlertrules") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.alertName == nil { + return localVarReturnValue, fmt.Errorf("alertName is required and must be specified") + } + parameterAddToHeaderOrQuery(localVarQueryParams, "alertName", r.alertName, "csv") // to determine the Content-Type header localVarHTTPContentTypes := []string{} @@ -1762,17 +1781,6 @@ func (r ApiGetAlertConfigReceiverRequest) Execute() (*Receiver, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Message - err = a.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 } @@ -1791,62 +1799,62 @@ func (r ApiGetAlertConfigReceiverRequest) Execute() (*Receiver, error) { } /* -GetAlertConfigReceiver: Method for GetAlertConfigReceiver +DeleteAlertrules: Method for DeleteAlertrules -Get alert config receivers. +Delete alert rules. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName @param instanceId @param projectId - @param receiver - @return ApiGetAlertConfigReceiverRequest + @return ApiDeleteAlertrulesRequest */ -func (a *APIClient) GetAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiGetAlertConfigReceiverRequest { - return ApiGetAlertConfigReceiverRequest{ +func (a *APIClient) DeleteAlertrules(ctx context.Context, groupName string, instanceId string, projectId string) ApiDeleteAlertrulesRequest { + return ApiDeleteAlertrulesRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, - receiver: receiver, } } -func (a *APIClient) GetAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*Receiver, error) { - r := ApiGetAlertConfigReceiverRequest{ +func (a *APIClient) DeleteAlertrulesExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertRulesResponse, error) { + r := ApiDeleteAlertrulesRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, - receiver: receiver, } return r.Execute() } -type ApiGetAlertConfigRouteRequest struct { +type ApiDeleteCredentialsRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string - receiver string + username string } -func (r ApiGetAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { +func (r ApiDeleteCredentialsRequest) Execute() (*Message, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigRouteResponse + localVarReturnValue *Message ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCredentials") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -1910,6 +1918,28 @@ func (r ApiGetAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, err } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 == 500 { + var v Message + err = a.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 } @@ -1928,60 +1958,62 @@ func (r ApiGetAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, err } /* -GetAlertConfigRoute: Method for GetAlertConfigRoute +DeleteCredentials: Method for DeleteCredentials -Get alert receiver for route. +Delete technical credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param receiver - @return ApiGetAlertConfigRouteRequest + @param username + @return ApiDeleteCredentialsRequest */ -func (a *APIClient) GetAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiGetAlertConfigRouteRequest { - return ApiGetAlertConfigRouteRequest{ +func (a *APIClient) DeleteCredentials(ctx context.Context, instanceId string, projectId string, username string) ApiDeleteCredentialsRequest { + return ApiDeleteCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, + username: username, } } -func (a *APIClient) GetAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { - r := ApiGetAlertConfigRouteRequest{ +func (a *APIClient) DeleteCredentialsExecute(ctx context.Context, instanceId string, projectId string, username string) (*Message, error) { + r := ApiDeleteCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, + username: username, } return r.Execute() } -type ApiGetAlertConfigsRequest struct { +type ApiDeleteCredentialsRemoteWriteConfigRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string + username string } -func (r ApiGetAlertConfigsRequest) Execute() (*GetAlertConfigsResponse, error) { +func (r ApiDeleteCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemoteWriteDeleteResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetAlertConfigsResponse + localVarReturnValue *CredentialsRemoteWriteDeleteResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCredentialsRemoteWriteConfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2036,6 +2068,17 @@ func (r ApiGetAlertConfigsRequest) Execute() (*GetAlertConfigsResponse, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2045,6 +2088,28 @@ func (r ApiGetAlertConfigsRequest) Execute() (*GetAlertConfigsResponse, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 == 502 { + var v Message + err = a.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 } @@ -2063,59 +2128,60 @@ func (r ApiGetAlertConfigsRequest) Execute() (*GetAlertConfigsResponse, error) { } /* -GetAlertConfigs: Method for GetAlertConfigs +DeleteCredentialsRemoteWriteConfig: Method for DeleteCredentialsRemoteWriteConfig -Get alert config. +Delete remote write config for credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiGetAlertConfigsRequest + @param username + @return ApiDeleteCredentialsRemoteWriteConfigRequest */ -func (a *APIClient) GetAlertConfigs(ctx context.Context, instanceId string, projectId string) ApiGetAlertConfigsRequest { - return ApiGetAlertConfigsRequest{ +func (a *APIClient) DeleteCredentialsRemoteWriteConfig(ctx context.Context, instanceId string, projectId string, username string) ApiDeleteCredentialsRemoteWriteConfigRequest { + return ApiDeleteCredentialsRemoteWriteConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } } -func (a *APIClient) GetAlertConfigsExecute(ctx context.Context, instanceId string, projectId string) (*GetAlertConfigsResponse, error) { - r := ApiGetAlertConfigsRequest{ +func (a *APIClient) DeleteCredentialsRemoteWriteConfigExecute(ctx context.Context, instanceId string, projectId string, username string) (*CredentialsRemoteWriteDeleteResponse, error) { + r := ApiDeleteCredentialsRemoteWriteConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } return r.Execute() } -type ApiGetCredentialsRequest struct { +type ApiDeleteInstanceRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string - username string } -func (r ApiGetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { +func (r ApiDeleteInstanceRequest) Execute() (*InstanceResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetCredentialsResponse + localVarReturnValue *InstanceResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentials") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteInstance") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2179,17 +2245,6 @@ func (r ApiGetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Message - err = a.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 } @@ -2208,62 +2263,59 @@ func (r ApiGetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { } /* -GetCredentials: Method for GetCredentials +DeleteInstance: Method for DeleteInstance -Get single technical credentials. +Delete instance. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param username - @return ApiGetCredentialsRequest + @return ApiDeleteInstanceRequest */ -func (a *APIClient) GetCredentials(ctx context.Context, instanceId string, projectId string, username string) ApiGetCredentialsRequest { - return ApiGetCredentialsRequest{ +func (a *APIClient) DeleteInstance(ctx context.Context, instanceId string, projectId string) ApiDeleteInstanceRequest { + return ApiDeleteInstanceRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, } } -func (a *APIClient) GetCredentialsExecute(ctx context.Context, instanceId string, projectId string, username string) (*GetCredentialsResponse, error) { - r := ApiGetCredentialsRequest{ +func (a *APIClient) DeleteInstanceExecute(ctx context.Context, instanceId string, projectId string) (*InstanceResponse, error) { + r := ApiDeleteInstanceRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - username: username, } return r.Execute() } -type ApiGetCredentialsRemoteWriteConfigRequest struct { +type ApiDeleteScrapeConfigRequest struct { ctx context.Context apiService *DefaultApiService instanceId string + jobName string projectId string - username string } -func (r ApiGetCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemoteWriteConfig, error) { +func (r ApiDeleteScrapeConfigRequest) Execute() (*DeleteScrapeConfigResponse, error) { var ( - localVarHTTPMethod = http.MethodGet + localVarHTTPMethod = http.MethodDelete localVarPostBody interface{} formFiles []formFile - localVarReturnValue *CredentialsRemoteWriteConfig + localVarReturnValue *DeleteScrapeConfigResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentialsRemoteWriteConfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteScrapeConfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(r.jobName, "jobName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2338,17 +2390,6 @@ func (r ApiGetCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemote } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 502 { - var v Message - err = a.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 } @@ -2367,60 +2408,62 @@ func (r ApiGetCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemote } /* -GetCredentialsRemoteWriteConfig: Method for GetCredentialsRemoteWriteConfig +DeleteScrapeConfig: Method for DeleteScrapeConfig -Get remote write config. +Delete scrape config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId + @param jobName @param projectId - @param username - @return ApiGetCredentialsRemoteWriteConfigRequest + @return ApiDeleteScrapeConfigRequest */ -func (a *APIClient) GetCredentialsRemoteWriteConfig(ctx context.Context, instanceId string, projectId string, username string) ApiGetCredentialsRemoteWriteConfigRequest { - return ApiGetCredentialsRemoteWriteConfigRequest{ +func (a *APIClient) DeleteScrapeConfig(ctx context.Context, instanceId string, jobName string, projectId string) ApiDeleteScrapeConfigRequest { + return ApiDeleteScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, + jobName: jobName, projectId: projectId, - username: username, } } -func (a *APIClient) GetCredentialsRemoteWriteConfigExecute(ctx context.Context, instanceId string, projectId string, username string) (*CredentialsRemoteWriteConfig, error) { - r := ApiGetCredentialsRemoteWriteConfigRequest{ +func (a *APIClient) DeleteScrapeConfigExecute(ctx context.Context, instanceId string, jobName string, projectId string) (*DeleteScrapeConfigResponse, error) { + r := ApiDeleteScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, + jobName: jobName, projectId: projectId, - username: username, } return r.Execute() } -type ApiGetGrafanaConfigsRequest struct { +type ApiGetAlertConfigReceiverRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string + receiver string } -func (r ApiGetGrafanaConfigsRequest) Execute() (*GrafanaConfigs, error) { +func (r ApiGetAlertConfigReceiverRequest) Execute() (*Receiver, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GrafanaConfigs + localVarReturnValue *Receiver ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetGrafanaConfigs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigReceiver") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2484,6 +2527,17 @@ func (r ApiGetGrafanaConfigsRequest) Execute() (*GrafanaConfigs, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 } @@ -2502,57 +2556,62 @@ func (r ApiGetGrafanaConfigsRequest) Execute() (*GrafanaConfigs, error) { } /* -GetGrafanaConfigs: Method for GetGrafanaConfigs +GetAlertConfigReceiver: Method for GetAlertConfigReceiver -Get grafana config. +Get alert config receivers. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiGetGrafanaConfigsRequest + @param receiver + @return ApiGetAlertConfigReceiverRequest */ -func (a *APIClient) GetGrafanaConfigs(ctx context.Context, instanceId string, projectId string) ApiGetGrafanaConfigsRequest { - return ApiGetGrafanaConfigsRequest{ +func (a *APIClient) GetAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiGetAlertConfigReceiverRequest { + return ApiGetAlertConfigReceiverRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } } -func (a *APIClient) GetGrafanaConfigsExecute(ctx context.Context, instanceId string, projectId string) (*GrafanaConfigs, error) { - r := ApiGetGrafanaConfigsRequest{ +func (a *APIClient) GetAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*Receiver, error) { + r := ApiGetAlertConfigReceiverRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } return r.Execute() } -type ApiGetInstanceRequest struct { +type ApiGetAlertConfigRouteRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string + receiver string } -func (r ApiGetInstanceRequest) Execute() (*GetInstanceResponse, error) { +func (r ApiGetAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetInstanceResponse + localVarReturnValue *AlertConfigRouteResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigRoute") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -2634,55 +2693,58 @@ func (r ApiGetInstanceRequest) Execute() (*GetInstanceResponse, error) { } /* -GetInstance: Method for GetInstance +GetAlertConfigRoute: Method for GetAlertConfigRoute -Get instance information. +Get alert receiver for route. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiGetInstanceRequest + @param receiver + @return ApiGetAlertConfigRouteRequest */ -func (a *APIClient) GetInstance(ctx context.Context, instanceId string, projectId string) ApiGetInstanceRequest { - return ApiGetInstanceRequest{ +func (a *APIClient) GetAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiGetAlertConfigRouteRequest { + return ApiGetAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } } -func (a *APIClient) GetInstanceExecute(ctx context.Context, instanceId string, projectId string) (*GetInstanceResponse, error) { - r := ApiGetInstanceRequest{ +func (a *APIClient) GetAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { + r := ApiGetAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } return r.Execute() } -type ApiGetMetricsStorageRetentionRequest struct { +type ApiGetAlertConfigsRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string } -func (r ApiGetMetricsStorageRetentionRequest) Execute() (*GetMetricsStorageRetentionResponse, error) { +func (r ApiGetAlertConfigsRequest) Execute() (*GetAlertConfigsResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetMetricsStorageRetentionResponse + localVarReturnValue *GetAlertConfigsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMetricsStorageRetention") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertConfigs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) @@ -2766,17 +2828,17 @@ func (r ApiGetMetricsStorageRetentionRequest) Execute() (*GetMetricsStorageReten } /* -GetMetricsStorageRetention: Method for GetMetricsStorageRetention +GetAlertConfigs: Method for GetAlertConfigs -Get metric storage retention time. +Get alert config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiGetMetricsStorageRetentionRequest + @return ApiGetAlertConfigsRequest */ -func (a *APIClient) GetMetricsStorageRetention(ctx context.Context, instanceId string, projectId string) ApiGetMetricsStorageRetentionRequest { - return ApiGetMetricsStorageRetentionRequest{ +func (a *APIClient) GetAlertConfigs(ctx context.Context, instanceId string, projectId string) ApiGetAlertConfigsRequest { + return ApiGetAlertConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -2784,8 +2846,8 @@ func (a *APIClient) GetMetricsStorageRetention(ctx context.Context, instanceId s } } -func (a *APIClient) GetMetricsStorageRetentionExecute(ctx context.Context, instanceId string, projectId string) (*GetMetricsStorageRetentionResponse, error) { - r := ApiGetMetricsStorageRetentionRequest{ +func (a *APIClient) GetAlertConfigsExecute(ctx context.Context, instanceId string, projectId string) (*GetAlertConfigsResponse, error) { + r := ApiGetAlertConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -2794,30 +2856,30 @@ func (a *APIClient) GetMetricsStorageRetentionExecute(ctx context.Context, insta return r.Execute() } -type ApiGetScrapeConfigRequest struct { +type ApiGetAlertgroupRequest struct { ctx context.Context apiService *DefaultApiService + groupName string instanceId string - jobName string projectId string } -func (r ApiGetScrapeConfigRequest) Execute() (*GetScrapeConfigResponse, error) { +func (r ApiGetAlertgroupRequest) Execute() (*AlertGroupResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *GetScrapeConfigResponse + localVarReturnValue *AlertGroupResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetScrapeConfig") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetAlertgroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(r.jobName, "jobName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -2873,6 +2935,17 @@ func (r ApiGetScrapeConfigRequest) Execute() (*GetScrapeConfigResponse, error) { Body: localVarBody, ErrorMessage: localVarHTTPResponse.Status, } + if localVarHTTPResponse.StatusCode == 400 { + var v Message + err = a.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 = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) @@ -2882,11 +2955,22 @@ func (r ApiGetScrapeConfigRequest) Execute() (*GetScrapeConfigResponse, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr } - return localVarReturnValue, newErr - } - - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr := &oapierror.GenericOpenAPIError{ StatusCode: localVarHTTPResponse.StatusCode, @@ -2900,60 +2984,62 @@ func (r ApiGetScrapeConfigRequest) Execute() (*GetScrapeConfigResponse, error) { } /* -GetScrapeConfig: Method for GetScrapeConfig +GetAlertgroup: Method for GetAlertgroup -Get scrape config. +Get alert group. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName @param instanceId - @param jobName @param projectId - @return ApiGetScrapeConfigRequest + @return ApiGetAlertgroupRequest */ -func (a *APIClient) GetScrapeConfig(ctx context.Context, instanceId string, jobName string, projectId string) ApiGetScrapeConfigRequest { - return ApiGetScrapeConfigRequest{ +func (a *APIClient) GetAlertgroup(ctx context.Context, groupName string, instanceId string, projectId string) ApiGetAlertgroupRequest { + return ApiGetAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, - jobName: jobName, projectId: projectId, } } -func (a *APIClient) GetScrapeConfigExecute(ctx context.Context, instanceId string, jobName string, projectId string) (*GetScrapeConfigResponse, error) { - r := ApiGetScrapeConfigRequest{ +func (a *APIClient) GetAlertgroupExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertGroupResponse, error) { + r := ApiGetAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, - jobName: jobName, projectId: projectId, } return r.Execute() } -type ApiListACLRequest struct { +type ApiGetCredentialsRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string + username string } -func (r ApiListACLRequest) Execute() (*ListACLResponse, error) { +func (r ApiGetCredentialsRequest) Execute() (*GetCredentialsResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListACLResponse + localVarReturnValue *GetCredentialsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListACL") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentials") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/acl" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3017,6 +3103,17 @@ func (r ApiListACLRequest) Execute() (*ListACLResponse, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 } @@ -3035,57 +3132,62 @@ func (r ApiListACLRequest) Execute() (*ListACLResponse, error) { } /* -ListACL: Method for ListACL +GetCredentials: Method for GetCredentials -Get acl for instance. +Get single technical credentials. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiListACLRequest + @param username + @return ApiGetCredentialsRequest */ -func (a *APIClient) ListACL(ctx context.Context, instanceId string, projectId string) ApiListACLRequest { - return ApiListACLRequest{ +func (a *APIClient) GetCredentials(ctx context.Context, instanceId string, projectId string, username string) ApiGetCredentialsRequest { + return ApiGetCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } } -func (a *APIClient) ListACLExecute(ctx context.Context, instanceId string, projectId string) (*ListACLResponse, error) { - r := ApiListACLRequest{ +func (a *APIClient) GetCredentialsExecute(ctx context.Context, instanceId string, projectId string, username string) (*GetCredentialsResponse, error) { + r := ApiGetCredentialsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } return r.Execute() } -type ApiListAlertConfigReceiversRequest struct { +type ApiGetCredentialsRemoteWriteConfigRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string + username string } -func (r ApiListAlertConfigReceiversRequest) Execute() (*AlertConfigReceiversResponse, error) { +func (r ApiGetCredentialsRemoteWriteConfigRequest) Execute() (*CredentialsRemoteWriteConfig, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigReceiversResponse + localVarReturnValue *CredentialsRemoteWriteConfig ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertConfigReceivers") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCredentialsRemoteWriteConfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(r.username, "username")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} @@ -3149,6 +3251,28 @@ func (r ApiListAlertConfigReceiversRequest) Execute() (*AlertConfigReceiversResp } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 == 502 { + var v Message + err = a.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 } @@ -3167,55 +3291,58 @@ func (r ApiListAlertConfigReceiversRequest) Execute() (*AlertConfigReceiversResp } /* -ListAlertConfigReceivers: Method for ListAlertConfigReceivers +GetCredentialsRemoteWriteConfig: Method for GetCredentialsRemoteWriteConfig -Get alert config receivers. +Get remote write config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiListAlertConfigReceiversRequest + @param username + @return ApiGetCredentialsRemoteWriteConfigRequest */ -func (a *APIClient) ListAlertConfigReceivers(ctx context.Context, instanceId string, projectId string) ApiListAlertConfigReceiversRequest { - return ApiListAlertConfigReceiversRequest{ +func (a *APIClient) GetCredentialsRemoteWriteConfig(ctx context.Context, instanceId string, projectId string, username string) ApiGetCredentialsRemoteWriteConfigRequest { + return ApiGetCredentialsRemoteWriteConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } } -func (a *APIClient) ListAlertConfigReceiversExecute(ctx context.Context, instanceId string, projectId string) (*AlertConfigReceiversResponse, error) { - r := ApiListAlertConfigReceiversRequest{ +func (a *APIClient) GetCredentialsRemoteWriteConfigExecute(ctx context.Context, instanceId string, projectId string, username string) (*CredentialsRemoteWriteConfig, error) { + r := ApiGetCredentialsRemoteWriteConfigRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + username: username, } return r.Execute() } -type ApiListAlertConfigRoutesRequest struct { +type ApiGetGrafanaConfigsRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string } -func (r ApiListAlertConfigRoutesRequest) Execute() (*AlertConfigRouteResponse, error) { +func (r ApiGetGrafanaConfigsRequest) Execute() (*GrafanaConfigs, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigRouteResponse + localVarReturnValue *GrafanaConfigs ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertConfigRoutes") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetGrafanaConfigs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) @@ -3299,17 +3426,17 @@ func (r ApiListAlertConfigRoutesRequest) Execute() (*AlertConfigRouteResponse, e } /* -ListAlertConfigRoutes: Method for ListAlertConfigRoutes +GetGrafanaConfigs: Method for GetGrafanaConfigs -Get alert config route. +Get grafana config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiListAlertConfigRoutesRequest + @return ApiGetGrafanaConfigsRequest */ -func (a *APIClient) ListAlertConfigRoutes(ctx context.Context, instanceId string, projectId string) ApiListAlertConfigRoutesRequest { - return ApiListAlertConfigRoutesRequest{ +func (a *APIClient) GetGrafanaConfigs(ctx context.Context, instanceId string, projectId string) ApiGetGrafanaConfigsRequest { + return ApiGetGrafanaConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3317,8 +3444,8 @@ func (a *APIClient) ListAlertConfigRoutes(ctx context.Context, instanceId string } } -func (a *APIClient) ListAlertConfigRoutesExecute(ctx context.Context, instanceId string, projectId string) (*AlertConfigRouteResponse, error) { - r := ApiListAlertConfigRoutesRequest{ +func (a *APIClient) GetGrafanaConfigsExecute(ctx context.Context, instanceId string, projectId string) (*GrafanaConfigs, error) { + r := ApiGetGrafanaConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3327,27 +3454,27 @@ func (a *APIClient) ListAlertConfigRoutesExecute(ctx context.Context, instanceId return r.Execute() } -type ApiListCredentialsRequest struct { +type ApiGetInstanceRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string } -func (r ApiListCredentialsRequest) Execute() (*ListCredentialsResponse, error) { +func (r ApiGetInstanceRequest) Execute() (*GetInstanceResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListCredentialsResponse + localVarReturnValue *GetInstanceResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCredentials") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetInstance") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) @@ -3431,17 +3558,17 @@ func (r ApiListCredentialsRequest) Execute() (*ListCredentialsResponse, error) { } /* -ListCredentials: Method for ListCredentials +GetInstance: Method for GetInstance -Get all technical user credentials. +Get instance information. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiListCredentialsRequest + @return ApiGetInstanceRequest */ -func (a *APIClient) ListCredentials(ctx context.Context, instanceId string, projectId string) ApiListCredentialsRequest { - return ApiListCredentialsRequest{ +func (a *APIClient) GetInstance(ctx context.Context, instanceId string, projectId string) ApiGetInstanceRequest { + return ApiGetInstanceRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3449,8 +3576,8 @@ func (a *APIClient) ListCredentials(ctx context.Context, instanceId string, proj } } -func (a *APIClient) ListCredentialsExecute(ctx context.Context, instanceId string, projectId string) (*ListCredentialsResponse, error) { - r := ApiListCredentialsRequest{ +func (a *APIClient) GetInstanceExecute(ctx context.Context, instanceId string, projectId string) (*GetInstanceResponse, error) { + r := ApiGetInstanceRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3459,26 +3586,28 @@ func (a *APIClient) ListCredentialsExecute(ctx context.Context, instanceId strin return r.Execute() } -type ApiListInstancesRequest struct { +type ApiGetMetricsStorageRetentionRequest struct { ctx context.Context apiService *DefaultApiService + instanceId string projectId string } -func (r ApiListInstancesRequest) Execute() (*ListInstancesResponse, error) { +func (r ApiGetMetricsStorageRetentionRequest) Execute() (*GetMetricsStorageRetentionResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListInstancesResponse + localVarReturnValue *GetMetricsStorageRetentionResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListInstances") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetMetricsStorageRetention") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -3561,51 +3690,58 @@ func (r ApiListInstancesRequest) Execute() (*ListInstancesResponse, error) { } /* -ListInstances: Method for ListInstances +GetMetricsStorageRetention: Method for GetMetricsStorageRetention -Get all instances for a project. +Get metric storage retention time. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId @param projectId - @return ApiListInstancesRequest + @return ApiGetMetricsStorageRetentionRequest */ -func (a *APIClient) ListInstances(ctx context.Context, projectId string) ApiListInstancesRequest { - return ApiListInstancesRequest{ +func (a *APIClient) GetMetricsStorageRetention(ctx context.Context, instanceId string, projectId string) ApiGetMetricsStorageRetentionRequest { + return ApiGetMetricsStorageRetentionRequest{ apiService: a.defaultApi, ctx: ctx, + instanceId: instanceId, projectId: projectId, } } -func (a *APIClient) ListInstancesExecute(ctx context.Context, projectId string) (*ListInstancesResponse, error) { - r := ApiListInstancesRequest{ +func (a *APIClient) GetMetricsStorageRetentionExecute(ctx context.Context, instanceId string, projectId string) (*GetMetricsStorageRetentionResponse, error) { + r := ApiGetMetricsStorageRetentionRequest{ apiService: a.defaultApi, ctx: ctx, + instanceId: instanceId, projectId: projectId, } return r.Execute() } -type ApiListPlansRequest struct { +type ApiGetScrapeConfigRequest struct { ctx context.Context apiService *DefaultApiService + instanceId string + jobName string projectId string } -func (r ApiListPlansRequest) Execute() (*PlansResponse, error) { +func (r ApiGetScrapeConfigRequest) Execute() (*GetScrapeConfigResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *PlansResponse + localVarReturnValue *GetScrapeConfigResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlans") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetScrapeConfig") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/plans" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(r.jobName, "jobName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) @@ -3688,52 +3824,58 @@ func (r ApiListPlansRequest) Execute() (*PlansResponse, error) { } /* -ListPlans: Method for ListPlans +GetScrapeConfig: Method for GetScrapeConfig -Get all plans. +Get scrape config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param jobName @param projectId - @return ApiListPlansRequest + @return ApiGetScrapeConfigRequest */ -func (a *APIClient) ListPlans(ctx context.Context, projectId string) ApiListPlansRequest { - return ApiListPlansRequest{ +func (a *APIClient) GetScrapeConfig(ctx context.Context, instanceId string, jobName string, projectId string) ApiGetScrapeConfigRequest { + return ApiGetScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, + instanceId: instanceId, + jobName: jobName, projectId: projectId, } } -func (a *APIClient) ListPlansExecute(ctx context.Context, projectId string) (*PlansResponse, error) { - r := ApiListPlansRequest{ +func (a *APIClient) GetScrapeConfigExecute(ctx context.Context, instanceId string, jobName string, projectId string) (*GetScrapeConfigResponse, error) { + r := ApiGetScrapeConfigRequest{ apiService: a.defaultApi, ctx: ctx, + instanceId: instanceId, + jobName: jobName, projectId: projectId, } return r.Execute() } -type ApiListScrapeConfigsRequest struct { +type ApiListACLRequest struct { ctx context.Context apiService *DefaultApiService instanceId string projectId string } -func (r ApiListScrapeConfigsRequest) Execute() (*ListScrapeConfigsResponse, error) { +func (r ApiListACLRequest) Execute() (*ListACLResponse, error) { var ( localVarHTTPMethod = http.MethodGet localVarPostBody interface{} formFiles []formFile - localVarReturnValue *ListScrapeConfigsResponse + localVarReturnValue *ListACLResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListScrapeConfigs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListACL") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/acl" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) @@ -3817,17 +3959,17 @@ func (r ApiListScrapeConfigsRequest) Execute() (*ListScrapeConfigsResponse, erro } /* -ListScrapeConfigs: Method for ListScrapeConfigs +ListACL: Method for ListACL -Get scrape configs. +Get acl for instance. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiListScrapeConfigsRequest + @return ApiListACLRequest */ -func (a *APIClient) ListScrapeConfigs(ctx context.Context, instanceId string, projectId string) ApiListScrapeConfigsRequest { - return ApiListScrapeConfigsRequest{ +func (a *APIClient) ListACL(ctx context.Context, instanceId string, projectId string) ApiListACLRequest { + return ApiListACLRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3835,8 +3977,8 @@ func (a *APIClient) ListScrapeConfigs(ctx context.Context, instanceId string, pr } } -func (a *APIClient) ListScrapeConfigsExecute(ctx context.Context, instanceId string, projectId string) (*ListScrapeConfigsResponse, error) { - r := ApiListScrapeConfigsRequest{ +func (a *APIClient) ListACLExecute(ctx context.Context, instanceId string, projectId string) (*ListACLResponse, error) { + r := ApiListACLRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -3845,39 +3987,1740 @@ func (a *APIClient) ListScrapeConfigsExecute(ctx context.Context, instanceId str return r.Execute() } -type ApiUpdateACLRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - updateACLPayload *UpdateACLPayload +type ApiListAlertConfigReceiversRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string +} + +func (r ApiListAlertConfigReceiversRequest) Execute() (*AlertConfigReceiversResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertConfigReceiversResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertConfigReceivers") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListAlertConfigReceivers: Method for ListAlertConfigReceivers + +Get alert config receivers. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiListAlertConfigReceiversRequest +*/ +func (a *APIClient) ListAlertConfigReceivers(ctx context.Context, instanceId string, projectId string) ApiListAlertConfigReceiversRequest { + return ApiListAlertConfigReceiversRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListAlertConfigReceiversExecute(ctx context.Context, instanceId string, projectId string) (*AlertConfigReceiversResponse, error) { + r := ApiListAlertConfigReceiversRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiListAlertConfigRoutesRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string +} + +func (r ApiListAlertConfigRoutesRequest) Execute() (*AlertConfigRouteResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertConfigRouteResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertConfigRoutes") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListAlertConfigRoutes: Method for ListAlertConfigRoutes + +Get alert config route. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiListAlertConfigRoutesRequest +*/ +func (a *APIClient) ListAlertConfigRoutes(ctx context.Context, instanceId string, projectId string) ApiListAlertConfigRoutesRequest { + return ApiListAlertConfigRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListAlertConfigRoutesExecute(ctx context.Context, instanceId string, projectId string) (*AlertConfigRouteResponse, error) { + r := ApiListAlertConfigRoutesRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiListAlertgroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string +} + +func (r ApiListAlertgroupsRequest) Execute() (*AlertGroupsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertGroupsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertgroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.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 + } + + 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 +} + +/* +ListAlertgroups: Method for ListAlertgroups + +Get alert groups. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiListAlertgroupsRequest +*/ +func (a *APIClient) ListAlertgroups(ctx context.Context, instanceId string, projectId string) ApiListAlertgroupsRequest { + return ApiListAlertgroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListAlertgroupsExecute(ctx context.Context, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiListAlertgroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiListAlertrulesRequest struct { + ctx context.Context + apiService *DefaultApiService + groupName string + instanceId string + projectId string +} + +func (r ApiListAlertrulesRequest) Execute() (*AlertRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertRulesResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListAlertrules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListAlertrules: Method for ListAlertrules + +Get alert rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName + @param instanceId + @param projectId + @return ApiListAlertrulesRequest +*/ +func (a *APIClient) ListAlertrules(ctx context.Context, groupName string, instanceId string, projectId string) ApiListAlertrulesRequest { + return ApiListAlertrulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + groupName: groupName, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListAlertrulesExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertRulesResponse, error) { + r := ApiListAlertrulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + groupName: groupName, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiListCredentialsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string +} + +func (r ApiListCredentialsRequest) Execute() (*ListCredentialsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListCredentialsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListCredentials") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/credentials" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListCredentials: Method for ListCredentials + +Get all technical user credentials. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiListCredentialsRequest +*/ +func (a *APIClient) ListCredentials(ctx context.Context, instanceId string, projectId string) ApiListCredentialsRequest { + return ApiListCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListCredentialsExecute(ctx context.Context, instanceId string, projectId string) (*ListCredentialsResponse, error) { + r := ApiListCredentialsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiListInstancesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ApiListInstancesRequest) Execute() (*ListInstancesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListInstancesResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListInstances") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances" + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListInstances: Method for ListInstances + +Get all instances for a project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @return ApiListInstancesRequest +*/ +func (a *APIClient) ListInstances(ctx context.Context, projectId string) ApiListInstancesRequest { + return ApiListInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListInstancesExecute(ctx context.Context, projectId string) (*ListInstancesResponse, error) { + r := ApiListInstancesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListPlansRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string +} + +func (r ApiListPlansRequest) Execute() (*PlansResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PlansResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPlans") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/plans" + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListPlans: Method for ListPlans + +Get all plans. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId + @return ApiListPlansRequest +*/ +func (a *APIClient) ListPlans(ctx context.Context, projectId string) ApiListPlansRequest { + return ApiListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListPlansExecute(ctx context.Context, projectId string) (*PlansResponse, error) { + r := ApiListPlansRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiListScrapeConfigsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string +} + +func (r ApiListScrapeConfigsRequest) Execute() (*ListScrapeConfigsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListScrapeConfigsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListScrapeConfigs") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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, + } + if localVarHTTPResponse.StatusCode == 403 { + var v PermissionDenied + err = a.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 + } + + 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 +} + +/* +ListScrapeConfigs: Method for ListScrapeConfigs + +Get scrape configs. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiListScrapeConfigsRequest +*/ +func (a *APIClient) ListScrapeConfigs(ctx context.Context, instanceId string, projectId string) ApiListScrapeConfigsRequest { + return ApiListScrapeConfigsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) ListScrapeConfigsExecute(ctx context.Context, instanceId string, projectId string) (*ListScrapeConfigsResponse, error) { + r := ApiListScrapeConfigsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiPartialUpdateAlertgroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + updateAlertgroupsRequestInner *[]UpdateAlertgroupsRequestInner +} + +func (r ApiPartialUpdateAlertgroupsRequest) UpdateAlertgroupsRequestInner(updateAlertgroupsRequestInner []UpdateAlertgroupsRequestInner) ApiPartialUpdateAlertgroupsRequest { + r.updateAlertgroupsRequestInner = &updateAlertgroupsRequestInner + return r +} + +func (r ApiPartialUpdateAlertgroupsRequest) Execute() (*AlertGroupsResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertGroupsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateAlertgroups") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAlertgroupsRequestInner == nil { + return localVarReturnValue, fmt.Errorf("updateAlertgroupsRequestInner is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = r.updateAlertgroupsRequestInner + 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.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 + } + + 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 +} + +/* +PartialUpdateAlertgroups: Method for PartialUpdateAlertgroups + +Patch alert groups. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiPartialUpdateAlertgroupsRequest +*/ +func (a *APIClient) PartialUpdateAlertgroups(ctx context.Context, instanceId string, projectId string) ApiPartialUpdateAlertgroupsRequest { + return ApiPartialUpdateAlertgroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) PartialUpdateAlertgroupsExecute(ctx context.Context, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiPartialUpdateAlertgroupsRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiPartialUpdateAlertrulesRequest struct { + ctx context.Context + apiService *DefaultApiService + groupName string + instanceId string + projectId string + updateAlertgroupsRequestInnerRulesInner *[]UpdateAlertgroupsRequestInnerRulesInner +} + +func (r ApiPartialUpdateAlertrulesRequest) UpdateAlertgroupsRequestInnerRulesInner(updateAlertgroupsRequestInnerRulesInner []UpdateAlertgroupsRequestInnerRulesInner) ApiPartialUpdateAlertrulesRequest { + r.updateAlertgroupsRequestInnerRulesInner = &updateAlertgroupsRequestInnerRulesInner + return r +} + +func (r ApiPartialUpdateAlertrulesRequest) Execute() (*AlertRulesResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertRulesResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PartialUpdateAlertrules") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAlertgroupsRequestInnerRulesInner == nil { + return localVarReturnValue, fmt.Errorf("updateAlertgroupsRequestInnerRulesInner is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = r.updateAlertgroupsRequestInnerRulesInner + 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.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 + } + + 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 +} + +/* +PartialUpdateAlertrules: Method for PartialUpdateAlertrules + +Patch alert rules. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName + @param instanceId + @param projectId + @return ApiPartialUpdateAlertrulesRequest +*/ +func (a *APIClient) PartialUpdateAlertrules(ctx context.Context, groupName string, instanceId string, projectId string) ApiPartialUpdateAlertrulesRequest { + return ApiPartialUpdateAlertrulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + groupName: groupName, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) PartialUpdateAlertrulesExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertRulesResponse, error) { + r := ApiPartialUpdateAlertrulesRequest{ + apiService: a.defaultApi, + ctx: ctx, + groupName: groupName, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiUpdateACLRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + updateACLPayload *UpdateACLPayload +} + +func (r ApiUpdateACLRequest) UpdateACLPayload(updateACLPayload UpdateACLPayload) ApiUpdateACLRequest { + r.updateACLPayload = &updateACLPayload + return r +} + +func (r ApiUpdateACLRequest) Execute() (*Message, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Message + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateACL") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/acl" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + 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{"application/json"} + + // 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 + } + // body params + localVarPostBody = r.updateACLPayload + 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.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 + } + + 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 +} + +/* +UpdateACL: Method for UpdateACL + +Update acl config. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @return ApiUpdateACLRequest +*/ +func (a *APIClient) UpdateACL(ctx context.Context, instanceId string, projectId string) ApiUpdateACLRequest { + return ApiUpdateACLRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } +} + +func (a *APIClient) UpdateACLExecute(ctx context.Context, instanceId string, projectId string) (*Message, error) { + r := ApiUpdateACLRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + } + return r.Execute() +} + +type ApiUpdateAlertConfigReceiverRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + receiver string + updateAlertConfigReceiverPayload *UpdateAlertConfigReceiverPayload +} + +func (r ApiUpdateAlertConfigReceiverRequest) UpdateAlertConfigReceiverPayload(updateAlertConfigReceiverPayload UpdateAlertConfigReceiverPayload) ApiUpdateAlertConfigReceiverRequest { + r.updateAlertConfigReceiverPayload = &updateAlertConfigReceiverPayload + return r +} + +func (r ApiUpdateAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AlertConfigReceiversResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigReceiver") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAlertConfigReceiverPayload == nil { + return localVarReturnValue, fmt.Errorf("updateAlertConfigReceiverPayload is required and must be specified") + } + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // 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 + } + // body params + localVarPostBody = r.updateAlertConfigReceiverPayload + 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, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.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 = a.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 == 404 { + var v Message + err = a.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 + } + + 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 } -func (r ApiUpdateACLRequest) UpdateACLPayload(updateACLPayload UpdateACLPayload) ApiUpdateACLRequest { - r.updateACLPayload = &updateACLPayload +/* +UpdateAlertConfigReceiver: Method for UpdateAlertConfigReceiver + +Update alert config receiver. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param instanceId + @param projectId + @param receiver + @return ApiUpdateAlertConfigReceiverRequest +*/ +func (a *APIClient) UpdateAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiUpdateAlertConfigReceiverRequest { + return ApiUpdateAlertConfigReceiverRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + receiver: receiver, + } +} + +func (a *APIClient) UpdateAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigReceiversResponse, error) { + r := ApiUpdateAlertConfigReceiverRequest{ + apiService: a.defaultApi, + ctx: ctx, + instanceId: instanceId, + projectId: projectId, + receiver: receiver, + } + return r.Execute() +} + +type ApiUpdateAlertConfigRouteRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + receiver string + updateAlertConfigRoutePayload *UpdateAlertConfigRoutePayload +} + +func (r ApiUpdateAlertConfigRouteRequest) UpdateAlertConfigRoutePayload(updateAlertConfigRoutePayload UpdateAlertConfigRoutePayload) ApiUpdateAlertConfigRouteRequest { + r.updateAlertConfigRoutePayload = &updateAlertConfigRoutePayload return r } -func (r ApiUpdateACLRequest) Execute() (*Message, error) { +func (r ApiUpdateAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *Message + localVarReturnValue *AlertConfigRouteResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateACL") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigRoute") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/acl" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} + if r.updateAlertConfigRoutePayload == nil { + return localVarReturnValue, fmt.Errorf("updateAlertConfigRoutePayload is required and must be specified") + } // to determine the Content-Type header localVarHTTPContentTypes := []string{"application/json"} @@ -3897,7 +5740,7 @@ func (r ApiUpdateACLRequest) Execute() (*Message, error) { localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateACLPayload + localVarPostBody = r.updateAlertConfigRoutePayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -3950,6 +5793,17 @@ func (r ApiUpdateACLRequest) Execute() (*Message, error) { } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Message + err = a.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 } @@ -3968,71 +5822,72 @@ func (r ApiUpdateACLRequest) Execute() (*Message, error) { } /* -UpdateACL: Method for UpdateACL +UpdateAlertConfigRoute: Method for UpdateAlertConfigRoute -Update acl config. +Update alert receiver for route. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiUpdateACLRequest + @param receiver + @return ApiUpdateAlertConfigRouteRequest */ -func (a *APIClient) UpdateACL(ctx context.Context, instanceId string, projectId string) ApiUpdateACLRequest { - return ApiUpdateACLRequest{ +func (a *APIClient) UpdateAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiUpdateAlertConfigRouteRequest { + return ApiUpdateAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } } -func (a *APIClient) UpdateACLExecute(ctx context.Context, instanceId string, projectId string) (*Message, error) { - r := ApiUpdateACLRequest{ +func (a *APIClient) UpdateAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { + r := ApiUpdateAlertConfigRouteRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, + receiver: receiver, } return r.Execute() } -type ApiUpdateAlertConfigReceiverRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - receiver string - updateAlertConfigReceiverPayload *UpdateAlertConfigReceiverPayload +type ApiUpdateAlertConfigsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + updateAlertConfigsPayload *UpdateAlertConfigsPayload } -func (r ApiUpdateAlertConfigReceiverRequest) UpdateAlertConfigReceiverPayload(updateAlertConfigReceiverPayload UpdateAlertConfigReceiverPayload) ApiUpdateAlertConfigReceiverRequest { - r.updateAlertConfigReceiverPayload = &updateAlertConfigReceiverPayload +func (r ApiUpdateAlertConfigsRequest) UpdateAlertConfigsPayload(updateAlertConfigsPayload UpdateAlertConfigsPayload) ApiUpdateAlertConfigsRequest { + r.updateAlertConfigsPayload = &updateAlertConfigsPayload return r } -func (r ApiUpdateAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversResponse, error) { +func (r ApiUpdateAlertConfigsRequest) Execute() (*UpdateAlertConfigsResponse, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigReceiversResponse + localVarReturnValue *UpdateAlertConfigsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigReceiver") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigs") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.updateAlertConfigReceiverPayload == nil { - return localVarReturnValue, fmt.Errorf("updateAlertConfigReceiverPayload is required and must be specified") + if r.updateAlertConfigsPayload == nil { + return localVarReturnValue, fmt.Errorf("updateAlertConfigsPayload is required and must be specified") } // to determine the Content-Type header @@ -4053,7 +5908,7 @@ func (r ApiUpdateAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateAlertConfigReceiverPayload + localVarPostBody = r.updateAlertConfigsPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -4106,17 +5961,6 @@ func (r ApiUpdateAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes } newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) newErr.Model = v - return localVarReturnValue, newErr - } - if localVarHTTPResponse.StatusCode == 404 { - var v Message - err = a.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 } @@ -4135,74 +5979,71 @@ func (r ApiUpdateAlertConfigReceiverRequest) Execute() (*AlertConfigReceiversRes } /* -UpdateAlertConfigReceiver: Method for UpdateAlertConfigReceiver +UpdateAlertConfigs: Method for UpdateAlertConfigs -Update alert config receiver. +Update alert config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @param receiver - @return ApiUpdateAlertConfigReceiverRequest + @return ApiUpdateAlertConfigsRequest */ -func (a *APIClient) UpdateAlertConfigReceiver(ctx context.Context, instanceId string, projectId string, receiver string) ApiUpdateAlertConfigReceiverRequest { - return ApiUpdateAlertConfigReceiverRequest{ +func (a *APIClient) UpdateAlertConfigs(ctx context.Context, instanceId string, projectId string) ApiUpdateAlertConfigsRequest { + return ApiUpdateAlertConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, } } -func (a *APIClient) UpdateAlertConfigReceiverExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigReceiversResponse, error) { - r := ApiUpdateAlertConfigReceiverRequest{ +func (a *APIClient) UpdateAlertConfigsExecute(ctx context.Context, instanceId string, projectId string) (*UpdateAlertConfigsResponse, error) { + r := ApiUpdateAlertConfigsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, projectId: projectId, - receiver: receiver, } return r.Execute() } -type ApiUpdateAlertConfigRouteRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - receiver string - updateAlertConfigRoutePayload *UpdateAlertConfigRoutePayload +type ApiUpdateAlertgroupRequest struct { + ctx context.Context + apiService *DefaultApiService + groupName string + instanceId string + projectId string + updateAlertgroupPayload *UpdateAlertgroupPayload } -func (r ApiUpdateAlertConfigRouteRequest) UpdateAlertConfigRoutePayload(updateAlertConfigRoutePayload UpdateAlertConfigRoutePayload) ApiUpdateAlertConfigRouteRequest { - r.updateAlertConfigRoutePayload = &updateAlertConfigRoutePayload +func (r ApiUpdateAlertgroupRequest) UpdateAlertgroupPayload(updateAlertgroupPayload UpdateAlertgroupPayload) ApiUpdateAlertgroupRequest { + r.updateAlertgroupPayload = &updateAlertgroupPayload return r } -func (r ApiUpdateAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, error) { +func (r ApiUpdateAlertgroupRequest) Execute() (*AlertGroupsResponse, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *AlertConfigRouteResponse + localVarReturnValue *AlertGroupsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigRoute") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertgroup") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + localVarPath = strings.Replace(localVarPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(r.groupName, "groupName")), -1) localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) - localVarPath = strings.Replace(localVarPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(r.receiver, "receiver")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.updateAlertConfigRoutePayload == nil { - return localVarReturnValue, fmt.Errorf("updateAlertConfigRoutePayload is required and must be specified") + if r.updateAlertgroupPayload == nil { + return localVarReturnValue, fmt.Errorf("updateAlertgroupPayload is required and must be specified") } // to determine the Content-Type header @@ -4223,7 +6064,7 @@ func (r ApiUpdateAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateAlertConfigRoutePayload + localVarPostBody = r.updateAlertgroupPayload req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -4257,7 +6098,7 @@ func (r ApiUpdateAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, ErrorMessage: localVarHTTPResponse.Status, } if localVarHTTPResponse.StatusCode == 400 { - var v Error + var v Message err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) if err != nil { newErr.ErrorMessage = err.Error() @@ -4305,72 +6146,72 @@ func (r ApiUpdateAlertConfigRouteRequest) Execute() (*AlertConfigRouteResponse, } /* -UpdateAlertConfigRoute: Method for UpdateAlertConfigRoute +UpdateAlertgroup: Method for UpdateAlertgroup -Update alert receiver for route. +Update alert group config. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param groupName @param instanceId @param projectId - @param receiver - @return ApiUpdateAlertConfigRouteRequest + @return ApiUpdateAlertgroupRequest */ -func (a *APIClient) UpdateAlertConfigRoute(ctx context.Context, instanceId string, projectId string, receiver string) ApiUpdateAlertConfigRouteRequest { - return ApiUpdateAlertConfigRouteRequest{ +func (a *APIClient) UpdateAlertgroup(ctx context.Context, groupName string, instanceId string, projectId string) ApiUpdateAlertgroupRequest { + return ApiUpdateAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, - receiver: receiver, } } -func (a *APIClient) UpdateAlertConfigRouteExecute(ctx context.Context, instanceId string, projectId string, receiver string) (*AlertConfigRouteResponse, error) { - r := ApiUpdateAlertConfigRouteRequest{ +func (a *APIClient) UpdateAlertgroupExecute(ctx context.Context, groupName string, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiUpdateAlertgroupRequest{ apiService: a.defaultApi, ctx: ctx, + groupName: groupName, instanceId: instanceId, projectId: projectId, - receiver: receiver, } return r.Execute() } -type ApiUpdateAlertConfigsRequest struct { - ctx context.Context - apiService *DefaultApiService - instanceId string - projectId string - updateAlertConfigsPayload *UpdateAlertConfigsPayload +type ApiUpdateAlertgroupsRequest struct { + ctx context.Context + apiService *DefaultApiService + instanceId string + projectId string + updateAlertgroupsRequestInner *[]UpdateAlertgroupsRequestInner } -func (r ApiUpdateAlertConfigsRequest) UpdateAlertConfigsPayload(updateAlertConfigsPayload UpdateAlertConfigsPayload) ApiUpdateAlertConfigsRequest { - r.updateAlertConfigsPayload = &updateAlertConfigsPayload +func (r ApiUpdateAlertgroupsRequest) UpdateAlertgroupsRequestInner(updateAlertgroupsRequestInner []UpdateAlertgroupsRequestInner) ApiUpdateAlertgroupsRequest { + r.updateAlertgroupsRequestInner = &updateAlertgroupsRequestInner return r } -func (r ApiUpdateAlertConfigsRequest) Execute() (*UpdateAlertConfigsResponse, error) { +func (r ApiUpdateAlertgroupsRequest) Execute() (*AlertGroupsResponse, error) { var ( localVarHTTPMethod = http.MethodPut localVarPostBody interface{} formFiles []formFile - localVarReturnValue *UpdateAlertConfigsResponse + localVarReturnValue *AlertGroupsResponse ) a := r.apiService - localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertConfigs") + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.UpdateAlertgroups") if err != nil { return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} } - localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" + localVarPath := localBasePath + "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(r.instanceId, "instanceId")), -1) localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) localVarHeaderParams := make(map[string]string) localVarQueryParams := url.Values{} localVarFormParams := url.Values{} - if r.updateAlertConfigsPayload == nil { - return localVarReturnValue, fmt.Errorf("updateAlertConfigsPayload is required and must be specified") + if r.updateAlertgroupsRequestInner == nil { + return localVarReturnValue, fmt.Errorf("updateAlertgroupsRequestInner is required and must be specified") } // to determine the Content-Type header @@ -4391,7 +6232,7 @@ func (r ApiUpdateAlertConfigsRequest) Execute() (*UpdateAlertConfigsResponse, er localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.updateAlertConfigsPayload + localVarPostBody = r.updateAlertgroupsRequestInner req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) if err != nil { return localVarReturnValue, err @@ -4462,17 +6303,17 @@ func (r ApiUpdateAlertConfigsRequest) Execute() (*UpdateAlertConfigsResponse, er } /* -UpdateAlertConfigs: Method for UpdateAlertConfigs +UpdateAlertgroups: Method for UpdateAlertgroups -Update alert config. +Update alert groups. @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param instanceId @param projectId - @return ApiUpdateAlertConfigsRequest + @return ApiUpdateAlertgroupsRequest */ -func (a *APIClient) UpdateAlertConfigs(ctx context.Context, instanceId string, projectId string) ApiUpdateAlertConfigsRequest { - return ApiUpdateAlertConfigsRequest{ +func (a *APIClient) UpdateAlertgroups(ctx context.Context, instanceId string, projectId string) ApiUpdateAlertgroupsRequest { + return ApiUpdateAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, @@ -4480,8 +6321,8 @@ func (a *APIClient) UpdateAlertConfigs(ctx context.Context, instanceId string, p } } -func (a *APIClient) UpdateAlertConfigsExecute(ctx context.Context, instanceId string, projectId string) (*UpdateAlertConfigsResponse, error) { - r := ApiUpdateAlertConfigsRequest{ +func (a *APIClient) UpdateAlertgroupsExecute(ctx context.Context, instanceId string, projectId string) (*AlertGroupsResponse, error) { + r := ApiUpdateAlertgroupsRequest{ apiService: a.defaultApi, ctx: ctx, instanceId: instanceId, diff --git a/services/observability/api_default_test.go b/services/observability/api_default_test.go index 9958a33ed..7c6e68955 100644 --- a/services/observability/api_default_test.go +++ b/services/observability/api_default_test.go @@ -135,6 +135,121 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService CreateAlertgroups", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertGroupsResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + createAlertgroupsPayload := CreateAlertgroupsPayload{} + + resp, reqErr := apiClient.CreateAlertgroups(context.Background(), instanceId, projectId).CreateAlertgroupsPayload(createAlertgroupsPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateAlertrules", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertRulesResponse{} + 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 observability_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) + } + + groupName := groupNameValue + instanceId := instanceIdValue + projectId := projectIdValue + createAlertrulesPayload := CreateAlertrulesPayload{} + + resp, reqErr := apiClient.CreateAlertrules(context.Background(), groupName, instanceId, projectId).CreateAlertrulesPayload(createAlertrulesPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService CreateCredentials", func(t *testing.T) { _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" instanceIdValue := "instanceId" @@ -231,9 +346,583 @@ func Test_observability_DefaultApiService(t *testing.T) { } projectId := projectIdValue - createInstancePayload := CreateInstancePayload{} + createInstancePayload := CreateInstancePayload{} + + resp, reqErr := apiClient.CreateInstance(context.Background(), projectId).CreateInstancePayload(createInstancePayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService CreateScrapeConfig", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ScrapeConfigsResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + createScrapeConfigPayload := CreateScrapeConfigPayload{} + + resp, reqErr := apiClient.CreateScrapeConfig(context.Background(), instanceId, projectId).CreateScrapeConfigPayload(createScrapeConfigPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAlertConfigReceiver", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + receiverValue := "receiver" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertConfigReceiversResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + receiver := receiverValue + + resp, reqErr := apiClient.DeleteAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAlertConfigRoute", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + receiverValue := "receiver" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertConfigRouteResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + receiver := receiverValue + + resp, reqErr := apiClient.DeleteAlertConfigRoute(context.Background(), instanceId, projectId, receiver).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAlertgroup", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertGroupsResponse{} + 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 observability_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) + } + + groupName := groupNameValue + instanceId := instanceIdValue + projectId := projectIdValue + + resp, reqErr := apiClient.DeleteAlertgroup(context.Background(), groupName, instanceId, projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAlertgroups", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertGroupsResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + groupName := []string{} + + resp, reqErr := apiClient.DeleteAlertgroups(context.Background(), instanceId, projectId).GroupName(groupName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteAlertrules", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := AlertRulesResponse{} + 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 observability_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) + } + + groupName := groupNameValue + instanceId := instanceIdValue + projectId := projectIdValue + alertName := []string{} + + resp, reqErr := apiClient.DeleteAlertrules(context.Background(), groupName, instanceId, projectId).AlertName(alertName).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + usernameValue := "username" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := Message{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + username := usernameValue + + resp, reqErr := apiClient.DeleteCredentials(context.Background(), instanceId, projectId, username).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCredentialsRemoteWriteConfig", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + usernameValue := "username" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := CredentialsRemoteWriteDeleteResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + username := usernameValue + + resp, reqErr := apiClient.DeleteCredentialsRemoteWriteConfig(context.Background(), instanceId, projectId, username).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := InstanceResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + projectId := projectIdValue + + resp, reqErr := apiClient.DeleteInstance(context.Background(), instanceId, projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteScrapeConfig", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + jobNameValue := "jobName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) + projectIdValue := "projectId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := DeleteScrapeConfigResponse{} + 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 observability_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) + } + + instanceId := instanceIdValue + jobName := jobNameValue + projectId := projectIdValue - resp, reqErr := apiClient.CreateInstance(context.Background(), projectId).CreateInstancePayload(createInstancePayload).Execute() + resp, reqErr := apiClient.DeleteScrapeConfig(context.Background(), instanceId, jobName, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -243,16 +932,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService CreateScrapeConfig", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + t.Run("Test DefaultApiService GetAlertConfigReceiver", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + receiverValue := "receiver" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ScrapeConfigsResponse{} + data := Receiver{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -287,9 +978,9 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - createScrapeConfigPayload := CreateScrapeConfigPayload{} + receiver := receiverValue - resp, reqErr := apiClient.CreateScrapeConfig(context.Background(), instanceId, projectId).CreateScrapeConfigPayload(createScrapeConfigPayload).Execute() + resp, reqErr := apiClient.GetAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -299,8 +990,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteAlertConfigReceiver", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + t.Run("Test DefaultApiService GetAlertConfigRoute", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -310,7 +1001,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigReceiversResponse{} + data := AlertConfigRouteResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -347,7 +1038,7 @@ func Test_observability_DefaultApiService(t *testing.T) { projectId := projectIdValue receiver := receiverValue - resp, reqErr := apiClient.DeleteAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).Execute() + resp, reqErr := apiClient.GetAlertConfigRoute(context.Background(), instanceId, projectId, receiver).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -357,18 +1048,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteAlertConfigRoute", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + t.Run("Test DefaultApiService GetAlertConfigs", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigRouteResponse{} + data := GetAlertConfigsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -403,9 +1092,8 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - receiver := receiverValue - resp, reqErr := apiClient.DeleteAlertConfigRoute(context.Background(), instanceId, projectId, receiver).Execute() + resp, reqErr := apiClient.GetAlertConfigs(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -415,18 +1103,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteCredentials", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" + t.Run("Test DefaultApiService GetAlertgroup", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Message{} + data := AlertGroupResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -459,11 +1147,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } + groupName := groupNameValue instanceId := instanceIdValue projectId := projectIdValue - username := usernameValue - resp, reqErr := apiClient.DeleteCredentials(context.Background(), instanceId, projectId, username).Execute() + resp, reqErr := apiClient.GetAlertgroup(context.Background(), groupName, instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -473,8 +1161,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteCredentialsRemoteWriteConfig", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" + t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -484,7 +1172,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CredentialsRemoteWriteDeleteResponse{} + data := GetCredentialsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -521,7 +1209,7 @@ func Test_observability_DefaultApiService(t *testing.T) { projectId := projectIdValue username := usernameValue - resp, reqErr := apiClient.DeleteCredentialsRemoteWriteConfig(context.Background(), instanceId, projectId, username).Execute() + resp, reqErr := apiClient.GetCredentials(context.Background(), instanceId, projectId, username).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -531,16 +1219,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" + t.Run("Test DefaultApiService GetCredentialsRemoteWriteConfig", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + usernameValue := "username" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := InstanceResponse{} + data := CredentialsRemoteWriteConfig{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -575,8 +1265,9 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue + username := usernameValue - resp, reqErr := apiClient.DeleteInstance(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.GetCredentialsRemoteWriteConfig(context.Background(), instanceId, projectId, username).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -586,18 +1277,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService DeleteScrapeConfig", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + t.Run("Test DefaultApiService GetGrafanaConfigs", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - jobNameValue := "jobName" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := DeleteScrapeConfigResponse{} + data := GrafanaConfigs{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -631,10 +1320,9 @@ func Test_observability_DefaultApiService(t *testing.T) { } instanceId := instanceIdValue - jobName := jobNameValue projectId := projectIdValue - resp, reqErr := apiClient.DeleteScrapeConfig(context.Background(), instanceId, jobName, projectId).Execute() + resp, reqErr := apiClient.GetGrafanaConfigs(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -644,18 +1332,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetAlertConfigReceiver", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Receiver{} + data := GetInstanceResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -690,9 +1376,8 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - receiver := receiverValue - resp, reqErr := apiClient.GetAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).Execute() + resp, reqErr := apiClient.GetInstance(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -702,18 +1387,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetAlertConfigRoute", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + t.Run("Test DefaultApiService GetMetricsStorageRetention", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigRouteResponse{} + data := GetMetricsStorageRetentionResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -748,9 +1431,8 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - receiver := receiverValue - resp, reqErr := apiClient.GetAlertConfigRoute(context.Background(), instanceId, projectId, receiver).Execute() + resp, reqErr := apiClient.GetMetricsStorageRetention(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -760,16 +1442,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetAlertConfigs", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" + t.Run("Test DefaultApiService GetScrapeConfig", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + jobNameValue := "jobName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetAlertConfigsResponse{} + data := GetScrapeConfigResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -803,9 +1487,10 @@ func Test_observability_DefaultApiService(t *testing.T) { } instanceId := instanceIdValue + jobName := jobNameValue projectId := projectIdValue - resp, reqErr := apiClient.GetAlertConfigs(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.GetScrapeConfig(context.Background(), instanceId, jobName, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -815,18 +1500,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetCredentials", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}" + t.Run("Test DefaultApiService ListACL", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetCredentialsResponse{} + data := ListACLResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -861,9 +1544,8 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - username := usernameValue - resp, reqErr := apiClient.GetCredentials(context.Background(), instanceId, projectId, username).Execute() + resp, reqErr := apiClient.ListACL(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -873,18 +1555,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetCredentialsRemoteWriteConfig", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials/{username}/remote-write-limits" + t.Run("Test DefaultApiService ListAlertConfigReceivers", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - usernameValue := "username" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"username"+"}", url.PathEscape(ParameterValueToString(usernameValue, "username")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := CredentialsRemoteWriteConfig{} + data := AlertConfigReceiversResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -919,9 +1599,8 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - username := usernameValue - resp, reqErr := apiClient.GetCredentialsRemoteWriteConfig(context.Background(), instanceId, projectId, username).Execute() + resp, reqErr := apiClient.ListAlertConfigReceivers(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -931,8 +1610,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetGrafanaConfigs", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/grafana-configs" + t.Run("Test DefaultApiService ListAlertConfigRoutes", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -940,7 +1619,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GrafanaConfigs{} + data := AlertConfigRouteResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -976,7 +1655,7 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.GetGrafanaConfigs(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListAlertConfigRoutes(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -986,8 +1665,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetInstance", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}" + t.Run("Test DefaultApiService ListAlertgroups", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -995,7 +1674,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetInstanceResponse{} + data := AlertGroupsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1031,7 +1710,7 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.GetInstance(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListAlertgroups(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1041,8 +1720,10 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetMetricsStorageRetention", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/metrics-storage-retentions" + t.Run("Test DefaultApiService ListAlertrules", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -1050,7 +1731,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetMetricsStorageRetentionResponse{} + data := AlertRulesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1083,10 +1764,11 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } + groupName := groupNameValue instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.GetMetricsStorageRetention(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListAlertrules(context.Background(), groupName, instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1096,18 +1778,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService GetScrapeConfig", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs/{jobName}" + t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) - jobNameValue := "jobName" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"jobName"+"}", url.PathEscape(ParameterValueToString(jobNameValue, "jobName")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := GetScrapeConfigResponse{} + data := ListCredentialsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1141,10 +1821,9 @@ func Test_observability_DefaultApiService(t *testing.T) { } instanceId := instanceIdValue - jobName := jobNameValue projectId := projectIdValue - resp, reqErr := apiClient.GetScrapeConfig(context.Background(), instanceId, jobName, projectId).Execute() + resp, reqErr := apiClient.ListCredentials(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1154,16 +1833,14 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListACL", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" - instanceIdValue := "instanceId" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances" projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListACLResponse{} + data := ListInstancesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1196,10 +1873,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.ListACL(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListInstances(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1209,16 +1885,14 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListAlertConfigReceivers", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers" - instanceIdValue := "instanceId" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) + t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/plans" projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigReceiversResponse{} + data := PlansResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1251,10 +1925,9 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } - instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.ListAlertConfigReceivers(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListPlans(context.Background(), projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1264,8 +1937,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListAlertConfigRoutes", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes" + t.Run("Test DefaultApiService ListScrapeConfigs", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -1273,7 +1946,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigRouteResponse{} + data := ListScrapeConfigsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1309,7 +1982,7 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.ListAlertConfigRoutes(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.ListScrapeConfigs(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1319,8 +1992,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListCredentials", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/credentials" + t.Run("Test DefaultApiService PartialUpdateAlertgroups", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -1328,7 +2001,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListCredentialsResponse{} + data := AlertGroupsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1363,8 +2036,9 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue + updateAlertgroupsRequestInner := []UpdateAlertgroupsRequestInner{} - resp, reqErr := apiClient.ListCredentials(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.PartialUpdateAlertgroups(context.Background(), instanceId, projectId).UpdateAlertgroupsRequestInner(updateAlertgroupsRequestInner).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1374,14 +2048,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListInstances", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances" + t.Run("Test DefaultApiService PartialUpdateAlertrules", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}/alertrules" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListInstancesResponse{} + data := AlertRulesResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1414,9 +2092,12 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } + groupName := groupNameValue + instanceId := instanceIdValue projectId := projectIdValue + updateAlertgroupsRequestInnerRulesInner := []UpdateAlertgroupsRequestInnerRulesInner{} - resp, reqErr := apiClient.ListInstances(context.Background(), projectId).Execute() + resp, reqErr := apiClient.PartialUpdateAlertrules(context.Background(), groupName, instanceId, projectId).UpdateAlertgroupsRequestInnerRulesInner(updateAlertgroupsRequestInnerRulesInner).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1426,14 +2107,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListPlans", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/plans" + t.Run("Test DefaultApiService UpdateACL", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" + instanceIdValue := "instanceId" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := PlansResponse{} + data := Message{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1466,9 +2149,10 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } + instanceId := instanceIdValue projectId := projectIdValue - resp, reqErr := apiClient.ListPlans(context.Background(), projectId).Execute() + resp, reqErr := apiClient.UpdateACL(context.Background(), instanceId, projectId).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1478,16 +2162,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService ListScrapeConfigs", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/scrapeconfigs" + t.Run("Test DefaultApiService UpdateAlertConfigReceiver", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + receiverValue := "receiver" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := ListScrapeConfigsResponse{} + data := AlertConfigReceiversResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1522,8 +2208,10 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue + receiver := receiverValue + updateAlertConfigReceiverPayload := UpdateAlertConfigReceiverPayload{} - resp, reqErr := apiClient.ListScrapeConfigs(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.UpdateAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).UpdateAlertConfigReceiverPayload(updateAlertConfigReceiverPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1533,16 +2221,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService UpdateACL", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/acl" + t.Run("Test DefaultApiService UpdateAlertConfigRoute", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + receiverValue := "receiver" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := Message{} + data := AlertConfigRouteResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1577,8 +2267,10 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue + receiver := receiverValue + updateAlertConfigRoutePayload := UpdateAlertConfigRoutePayload{} - resp, reqErr := apiClient.UpdateACL(context.Background(), instanceId, projectId).Execute() + resp, reqErr := apiClient.UpdateAlertConfigRoute(context.Background(), instanceId, projectId, receiver).UpdateAlertConfigRoutePayload(updateAlertConfigRoutePayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1588,18 +2280,16 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService UpdateAlertConfigReceiver", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/receivers/{receiver}" + t.Run("Test DefaultApiService UpdateAlertConfigs", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigReceiversResponse{} + data := UpdateAlertConfigsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1634,10 +2324,9 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - receiver := receiverValue - updateAlertConfigReceiverPayload := UpdateAlertConfigReceiverPayload{} + updateAlertConfigsPayload := UpdateAlertConfigsPayload{} - resp, reqErr := apiClient.UpdateAlertConfigReceiver(context.Background(), instanceId, projectId, receiver).UpdateAlertConfigReceiverPayload(updateAlertConfigReceiverPayload).Execute() + resp, reqErr := apiClient.UpdateAlertConfigs(context.Background(), instanceId, projectId).UpdateAlertConfigsPayload(updateAlertConfigsPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1647,18 +2336,18 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService UpdateAlertConfigRoute", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs/routes/{receiver}" + t.Run("Test DefaultApiService UpdateAlertgroup", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups/{groupName}" + groupNameValue := "groupName" + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"groupName"+"}", url.PathEscape(ParameterValueToString(groupNameValue, "groupName")), -1) instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) - receiverValue := "receiver" - _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"receiver"+"}", url.PathEscape(ParameterValueToString(receiverValue, "receiver")), -1) testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := AlertConfigRouteResponse{} + data := AlertGroupsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1691,12 +2380,12 @@ func Test_observability_DefaultApiService(t *testing.T) { t.Fatalf("creating API client: %v", err) } + groupName := groupNameValue instanceId := instanceIdValue projectId := projectIdValue - receiver := receiverValue - updateAlertConfigRoutePayload := UpdateAlertConfigRoutePayload{} + updateAlertgroupPayload := UpdateAlertgroupPayload{} - resp, reqErr := apiClient.UpdateAlertConfigRoute(context.Background(), instanceId, projectId, receiver).UpdateAlertConfigRoutePayload(updateAlertConfigRoutePayload).Execute() + resp, reqErr := apiClient.UpdateAlertgroup(context.Background(), groupName, instanceId, projectId).UpdateAlertgroupPayload(updateAlertgroupPayload).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) @@ -1706,8 +2395,8 @@ func Test_observability_DefaultApiService(t *testing.T) { } }) - t.Run("Test DefaultApiService UpdateAlertConfigs", func(t *testing.T) { - _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertconfigs" + t.Run("Test DefaultApiService UpdateAlertgroups", func(t *testing.T) { + _apiUrlPath := "/v1/projects/{projectId}/instances/{instanceId}/alertgroups" instanceIdValue := "instanceId" _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1) projectIdValue := "projectId" @@ -1715,7 +2404,7 @@ func Test_observability_DefaultApiService(t *testing.T) { testDefaultApiServeMux := http.NewServeMux() testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { - data := UpdateAlertConfigsResponse{} + data := AlertGroupsResponse{} w.Header().Add("Content-Type", "application/json") json.NewEncoder(w).Encode(data) }) @@ -1750,9 +2439,9 @@ func Test_observability_DefaultApiService(t *testing.T) { instanceId := instanceIdValue projectId := projectIdValue - updateAlertConfigsPayload := UpdateAlertConfigsPayload{} + updateAlertgroupsRequestInner := []UpdateAlertgroupsRequestInner{} - resp, reqErr := apiClient.UpdateAlertConfigs(context.Background(), instanceId, projectId).UpdateAlertConfigsPayload(updateAlertConfigsPayload).Execute() + resp, reqErr := apiClient.UpdateAlertgroups(context.Background(), instanceId, projectId).UpdateAlertgroupsRequestInner(updateAlertgroupsRequestInner).Execute() if reqErr != nil { t.Fatalf("error in call: %v", reqErr) diff --git a/services/observability/model_alert_group.go b/services/observability/model_alert_group.go new file mode 100644 index 000000000..2dc38a167 --- /dev/null +++ b/services/observability/model_alert_group.go @@ -0,0 +1,219 @@ +/* +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 AlertGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertGroup{} + +/* + types and functions for interval +*/ + +// isNotNullableString +type AlertGroupGetIntervalAttributeType = *string + +func getAlertGroupGetIntervalAttributeTypeOk(arg AlertGroupGetIntervalAttributeType) (ret AlertGroupGetIntervalRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupGetIntervalAttributeType(arg *AlertGroupGetIntervalAttributeType, val AlertGroupGetIntervalRetType) { + *arg = &val +} + +type AlertGroupGetIntervalArgType = string +type AlertGroupGetIntervalRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type AlertGroupGetNameAttributeType = *string + +func getAlertGroupGetNameAttributeTypeOk(arg AlertGroupGetNameAttributeType) (ret AlertGroupGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupGetNameAttributeType(arg *AlertGroupGetNameAttributeType, val AlertGroupGetNameRetType) { + *arg = &val +} + +type AlertGroupGetNameArgType = string +type AlertGroupGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type AlertGroupGetRulesAttributeType = *[]AlertRuleRecord +type AlertGroupGetRulesArgType = []AlertRuleRecord +type AlertGroupGetRulesRetType = []AlertRuleRecord + +func getAlertGroupGetRulesAttributeTypeOk(arg AlertGroupGetRulesAttributeType) (ret AlertGroupGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupGetRulesAttributeType(arg *AlertGroupGetRulesAttributeType, val AlertGroupGetRulesRetType) { + *arg = &val +} + +// AlertGroup struct for AlertGroup +type AlertGroup struct { + Interval AlertGroupGetIntervalAttributeType `json:"interval,omitempty"` + // REQUIRED + Name AlertGroupGetNameAttributeType `json:"name"` + // REQUIRED + Rules AlertGroupGetRulesAttributeType `json:"rules"` +} + +type _AlertGroup AlertGroup + +// NewAlertGroup instantiates a new AlertGroup 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 NewAlertGroup(name AlertGroupGetNameArgType, rules AlertGroupGetRulesArgType) *AlertGroup { + this := AlertGroup{} + setAlertGroupGetNameAttributeType(&this.Name, name) + setAlertGroupGetRulesAttributeType(&this.Rules, rules) + return &this +} + +// NewAlertGroupWithDefaults instantiates a new AlertGroup 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 NewAlertGroupWithDefaults() *AlertGroup { + this := AlertGroup{} + var interval string = "60s" + this.Interval = &interval + return &this +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *AlertGroup) GetInterval() (res AlertGroupGetIntervalRetType) { + res, _ = o.GetIntervalOk() + return +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertGroup) GetIntervalOk() (ret AlertGroupGetIntervalRetType, ok bool) { + return getAlertGroupGetIntervalAttributeTypeOk(o.Interval) +} + +// HasInterval returns a boolean if a field has been set. +func (o *AlertGroup) HasInterval() bool { + _, ok := o.GetIntervalOk() + return ok +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *AlertGroup) SetInterval(v AlertGroupGetIntervalRetType) { + setAlertGroupGetIntervalAttributeType(&o.Interval, v) +} + +// GetName returns the Name field value +func (o *AlertGroup) GetName() (ret AlertGroupGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *AlertGroup) GetNameOk() (ret AlertGroupGetNameRetType, ok bool) { + return getAlertGroupGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *AlertGroup) SetName(v AlertGroupGetNameRetType) { + setAlertGroupGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value +func (o *AlertGroup) GetRules() (ret AlertGroupGetRulesRetType) { + ret, _ = o.GetRulesOk() + return ret +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *AlertGroup) GetRulesOk() (ret AlertGroupGetRulesRetType, ok bool) { + return getAlertGroupGetRulesAttributeTypeOk(o.Rules) +} + +// SetRules sets field value +func (o *AlertGroup) SetRules(v AlertGroupGetRulesRetType) { + setAlertGroupGetRulesAttributeType(&o.Rules, v) +} + +func (o AlertGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertGroupGetIntervalAttributeTypeOk(o.Interval); ok { + toSerialize["Interval"] = val + } + if val, ok := getAlertGroupGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getAlertGroupGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableAlertGroup struct { + value *AlertGroup + isSet bool +} + +func (v NullableAlertGroup) Get() *AlertGroup { + return v.value +} + +func (v *NullableAlertGroup) Set(val *AlertGroup) { + v.value = val + v.isSet = true +} + +func (v NullableAlertGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertGroup(val *AlertGroup) *NullableAlertGroup { + return &NullableAlertGroup{value: val, isSet: true} +} + +func (v NullableAlertGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_alert_group_response.go b/services/observability/model_alert_group_response.go new file mode 100644 index 000000000..7a440fd1d --- /dev/null +++ b/services/observability/model_alert_group_response.go @@ -0,0 +1,169 @@ +/* +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 AlertGroupResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertGroupResponse{} + +/* + types and functions for data +*/ + +// isModel +type AlertGroupResponseGetDataAttributeType = *AlertGroup +type AlertGroupResponseGetDataArgType = AlertGroup +type AlertGroupResponseGetDataRetType = AlertGroup + +func getAlertGroupResponseGetDataAttributeTypeOk(arg AlertGroupResponseGetDataAttributeType) (ret AlertGroupResponseGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupResponseGetDataAttributeType(arg *AlertGroupResponseGetDataAttributeType, val AlertGroupResponseGetDataRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type AlertGroupResponseGetMessageAttributeType = *string + +func getAlertGroupResponseGetMessageAttributeTypeOk(arg AlertGroupResponseGetMessageAttributeType) (ret AlertGroupResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupResponseGetMessageAttributeType(arg *AlertGroupResponseGetMessageAttributeType, val AlertGroupResponseGetMessageRetType) { + *arg = &val +} + +type AlertGroupResponseGetMessageArgType = string +type AlertGroupResponseGetMessageRetType = string + +// AlertGroupResponse struct for AlertGroupResponse +type AlertGroupResponse struct { + // REQUIRED + Data AlertGroupResponseGetDataAttributeType `json:"data"` + // REQUIRED + Message AlertGroupResponseGetMessageAttributeType `json:"message"` +} + +type _AlertGroupResponse AlertGroupResponse + +// NewAlertGroupResponse instantiates a new AlertGroupResponse 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 NewAlertGroupResponse(data AlertGroupResponseGetDataArgType, message AlertGroupResponseGetMessageArgType) *AlertGroupResponse { + this := AlertGroupResponse{} + setAlertGroupResponseGetDataAttributeType(&this.Data, data) + setAlertGroupResponseGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewAlertGroupResponseWithDefaults instantiates a new AlertGroupResponse 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 NewAlertGroupResponseWithDefaults() *AlertGroupResponse { + this := AlertGroupResponse{} + return &this +} + +// GetData returns the Data field value +func (o *AlertGroupResponse) GetData() (ret AlertGroupResponseGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AlertGroupResponse) GetDataOk() (ret AlertGroupResponseGetDataRetType, ok bool) { + return getAlertGroupResponseGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *AlertGroupResponse) SetData(v AlertGroupResponseGetDataRetType) { + setAlertGroupResponseGetDataAttributeType(&o.Data, v) +} + +// GetMessage returns the Message field value +func (o *AlertGroupResponse) GetMessage() (ret AlertGroupResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *AlertGroupResponse) GetMessageOk() (ret AlertGroupResponseGetMessageRetType, ok bool) { + return getAlertGroupResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *AlertGroupResponse) SetMessage(v AlertGroupResponseGetMessageRetType) { + setAlertGroupResponseGetMessageAttributeType(&o.Message, v) +} + +func (o AlertGroupResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertGroupResponseGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + if val, ok := getAlertGroupResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableAlertGroupResponse struct { + value *AlertGroupResponse + isSet bool +} + +func (v NullableAlertGroupResponse) Get() *AlertGroupResponse { + return v.value +} + +func (v *NullableAlertGroupResponse) Set(val *AlertGroupResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAlertGroupResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertGroupResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertGroupResponse(val *AlertGroupResponse) *NullableAlertGroupResponse { + return &NullableAlertGroupResponse{value: val, isSet: true} +} + +func (v NullableAlertGroupResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertGroupResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_alert_groups_response.go b/services/observability/model_alert_groups_response.go new file mode 100644 index 000000000..e312f518a --- /dev/null +++ b/services/observability/model_alert_groups_response.go @@ -0,0 +1,169 @@ +/* +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 AlertGroupsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertGroupsResponse{} + +/* + types and functions for data +*/ + +// isArray +type AlertGroupsResponseGetDataAttributeType = *[]AlertGroup +type AlertGroupsResponseGetDataArgType = []AlertGroup +type AlertGroupsResponseGetDataRetType = []AlertGroup + +func getAlertGroupsResponseGetDataAttributeTypeOk(arg AlertGroupsResponseGetDataAttributeType) (ret AlertGroupsResponseGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupsResponseGetDataAttributeType(arg *AlertGroupsResponseGetDataAttributeType, val AlertGroupsResponseGetDataRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type AlertGroupsResponseGetMessageAttributeType = *string + +func getAlertGroupsResponseGetMessageAttributeTypeOk(arg AlertGroupsResponseGetMessageAttributeType) (ret AlertGroupsResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertGroupsResponseGetMessageAttributeType(arg *AlertGroupsResponseGetMessageAttributeType, val AlertGroupsResponseGetMessageRetType) { + *arg = &val +} + +type AlertGroupsResponseGetMessageArgType = string +type AlertGroupsResponseGetMessageRetType = string + +// AlertGroupsResponse struct for AlertGroupsResponse +type AlertGroupsResponse struct { + // REQUIRED + Data AlertGroupsResponseGetDataAttributeType `json:"data"` + // REQUIRED + Message AlertGroupsResponseGetMessageAttributeType `json:"message"` +} + +type _AlertGroupsResponse AlertGroupsResponse + +// NewAlertGroupsResponse instantiates a new AlertGroupsResponse 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 NewAlertGroupsResponse(data AlertGroupsResponseGetDataArgType, message AlertGroupsResponseGetMessageArgType) *AlertGroupsResponse { + this := AlertGroupsResponse{} + setAlertGroupsResponseGetDataAttributeType(&this.Data, data) + setAlertGroupsResponseGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewAlertGroupsResponseWithDefaults instantiates a new AlertGroupsResponse 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 NewAlertGroupsResponseWithDefaults() *AlertGroupsResponse { + this := AlertGroupsResponse{} + return &this +} + +// GetData returns the Data field value +func (o *AlertGroupsResponse) GetData() (ret AlertGroupsResponseGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AlertGroupsResponse) GetDataOk() (ret AlertGroupsResponseGetDataRetType, ok bool) { + return getAlertGroupsResponseGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *AlertGroupsResponse) SetData(v AlertGroupsResponseGetDataRetType) { + setAlertGroupsResponseGetDataAttributeType(&o.Data, v) +} + +// GetMessage returns the Message field value +func (o *AlertGroupsResponse) GetMessage() (ret AlertGroupsResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *AlertGroupsResponse) GetMessageOk() (ret AlertGroupsResponseGetMessageRetType, ok bool) { + return getAlertGroupsResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *AlertGroupsResponse) SetMessage(v AlertGroupsResponseGetMessageRetType) { + setAlertGroupsResponseGetMessageAttributeType(&o.Message, v) +} + +func (o AlertGroupsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertGroupsResponseGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + if val, ok := getAlertGroupsResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableAlertGroupsResponse struct { + value *AlertGroupsResponse + isSet bool +} + +func (v NullableAlertGroupsResponse) Get() *AlertGroupsResponse { + return v.value +} + +func (v *NullableAlertGroupsResponse) Set(val *AlertGroupsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAlertGroupsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertGroupsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertGroupsResponse(val *AlertGroupsResponse) *NullableAlertGroupsResponse { + return &NullableAlertGroupsResponse{value: val, isSet: true} +} + +func (v NullableAlertGroupsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertGroupsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_alert_rule.go b/services/observability/model_alert_rule.go new file mode 100644 index 000000000..c7b4150b0 --- /dev/null +++ b/services/observability/model_alert_rule.go @@ -0,0 +1,314 @@ +/* +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 AlertRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertRule{} + +/* + types and functions for alert +*/ + +// isNotNullableString +type AlertRuleGetAlertAttributeType = *string + +func getAlertRuleGetAlertAttributeTypeOk(arg AlertRuleGetAlertAttributeType) (ret AlertRuleGetAlertRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleGetAlertAttributeType(arg *AlertRuleGetAlertAttributeType, val AlertRuleGetAlertRetType) { + *arg = &val +} + +type AlertRuleGetAlertArgType = string +type AlertRuleGetAlertRetType = string + +/* + types and functions for annotations +*/ + +// isContainer +type AlertRuleGetAnnotationsAttributeType = *map[string]string +type AlertRuleGetAnnotationsArgType = map[string]string +type AlertRuleGetAnnotationsRetType = map[string]string + +func getAlertRuleGetAnnotationsAttributeTypeOk(arg AlertRuleGetAnnotationsAttributeType) (ret AlertRuleGetAnnotationsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleGetAnnotationsAttributeType(arg *AlertRuleGetAnnotationsAttributeType, val AlertRuleGetAnnotationsRetType) { + *arg = &val +} + +/* + types and functions for expr +*/ + +// isNotNullableString +type AlertRuleGetExprAttributeType = *string + +func getAlertRuleGetExprAttributeTypeOk(arg AlertRuleGetExprAttributeType) (ret AlertRuleGetExprRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleGetExprAttributeType(arg *AlertRuleGetExprAttributeType, val AlertRuleGetExprRetType) { + *arg = &val +} + +type AlertRuleGetExprArgType = string +type AlertRuleGetExprRetType = string + +/* + types and functions for for +*/ + +// isNotNullableString +type AlertRuleGetForAttributeType = *string + +func getAlertRuleGetForAttributeTypeOk(arg AlertRuleGetForAttributeType) (ret AlertRuleGetForRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleGetForAttributeType(arg *AlertRuleGetForAttributeType, val AlertRuleGetForRetType) { + *arg = &val +} + +type AlertRuleGetForArgType = string +type AlertRuleGetForRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type AlertRuleGetLabelsAttributeType = *map[string]string +type AlertRuleGetLabelsArgType = map[string]string +type AlertRuleGetLabelsRetType = map[string]string + +func getAlertRuleGetLabelsAttributeTypeOk(arg AlertRuleGetLabelsAttributeType) (ret AlertRuleGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleGetLabelsAttributeType(arg *AlertRuleGetLabelsAttributeType, val AlertRuleGetLabelsRetType) { + *arg = &val +} + +// AlertRule struct for AlertRule +type AlertRule struct { + // REQUIRED + Alert AlertRuleGetAlertAttributeType `json:"alert"` + Annotations AlertRuleGetAnnotationsAttributeType `json:"annotations,omitempty"` + // REQUIRED + Expr AlertRuleGetExprAttributeType `json:"expr"` + For AlertRuleGetForAttributeType `json:"for,omitempty"` + Labels AlertRuleGetLabelsAttributeType `json:"labels,omitempty"` +} + +type _AlertRule AlertRule + +// NewAlertRule instantiates a new AlertRule 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 NewAlertRule(alert AlertRuleGetAlertArgType, expr AlertRuleGetExprArgType) *AlertRule { + this := AlertRule{} + setAlertRuleGetAlertAttributeType(&this.Alert, alert) + setAlertRuleGetExprAttributeType(&this.Expr, expr) + return &this +} + +// NewAlertRuleWithDefaults instantiates a new AlertRule 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 NewAlertRuleWithDefaults() *AlertRule { + this := AlertRule{} + var for_ string = "0s" + this.For = &for_ + return &this +} + +// GetAlert returns the Alert field value +func (o *AlertRule) GetAlert() (ret AlertRuleGetAlertRetType) { + ret, _ = o.GetAlertOk() + return ret +} + +// GetAlertOk returns a tuple with the Alert field value +// and a boolean to check if the value has been set. +func (o *AlertRule) GetAlertOk() (ret AlertRuleGetAlertRetType, ok bool) { + return getAlertRuleGetAlertAttributeTypeOk(o.Alert) +} + +// SetAlert sets field value +func (o *AlertRule) SetAlert(v AlertRuleGetAlertRetType) { + setAlertRuleGetAlertAttributeType(&o.Alert, v) +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *AlertRule) GetAnnotations() (res AlertRuleGetAnnotationsRetType) { + res, _ = o.GetAnnotationsOk() + return +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRule) GetAnnotationsOk() (ret AlertRuleGetAnnotationsRetType, ok bool) { + return getAlertRuleGetAnnotationsAttributeTypeOk(o.Annotations) +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *AlertRule) HasAnnotations() bool { + _, ok := o.GetAnnotationsOk() + return ok +} + +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *AlertRule) SetAnnotations(v AlertRuleGetAnnotationsRetType) { + setAlertRuleGetAnnotationsAttributeType(&o.Annotations, v) +} + +// GetExpr returns the Expr field value +func (o *AlertRule) GetExpr() (ret AlertRuleGetExprRetType) { + ret, _ = o.GetExprOk() + return ret +} + +// GetExprOk returns a tuple with the Expr field value +// and a boolean to check if the value has been set. +func (o *AlertRule) GetExprOk() (ret AlertRuleGetExprRetType, ok bool) { + return getAlertRuleGetExprAttributeTypeOk(o.Expr) +} + +// SetExpr sets field value +func (o *AlertRule) SetExpr(v AlertRuleGetExprRetType) { + setAlertRuleGetExprAttributeType(&o.Expr, v) +} + +// GetFor returns the For field value if set, zero value otherwise. +func (o *AlertRule) GetFor() (res AlertRuleGetForRetType) { + res, _ = o.GetForOk() + return +} + +// GetForOk returns a tuple with the For field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRule) GetForOk() (ret AlertRuleGetForRetType, ok bool) { + return getAlertRuleGetForAttributeTypeOk(o.For) +} + +// HasFor returns a boolean if a field has been set. +func (o *AlertRule) HasFor() bool { + _, ok := o.GetForOk() + return ok +} + +// SetFor gets a reference to the given string and assigns it to the For field. +func (o *AlertRule) SetFor(v AlertRuleGetForRetType) { + setAlertRuleGetForAttributeType(&o.For, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *AlertRule) GetLabels() (res AlertRuleGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRule) GetLabelsOk() (ret AlertRuleGetLabelsRetType, ok bool) { + return getAlertRuleGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *AlertRule) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *AlertRule) SetLabels(v AlertRuleGetLabelsRetType) { + setAlertRuleGetLabelsAttributeType(&o.Labels, v) +} + +func (o AlertRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertRuleGetAlertAttributeTypeOk(o.Alert); ok { + toSerialize["Alert"] = val + } + if val, ok := getAlertRuleGetAnnotationsAttributeTypeOk(o.Annotations); ok { + toSerialize["Annotations"] = val + } + if val, ok := getAlertRuleGetExprAttributeTypeOk(o.Expr); ok { + toSerialize["Expr"] = val + } + if val, ok := getAlertRuleGetForAttributeTypeOk(o.For); ok { + toSerialize["For"] = val + } + if val, ok := getAlertRuleGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableAlertRule struct { + value *AlertRule + isSet bool +} + +func (v NullableAlertRule) Get() *AlertRule { + return v.value +} + +func (v *NullableAlertRule) Set(val *AlertRule) { + v.value = val + v.isSet = true +} + +func (v NullableAlertRule) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertRule(val *AlertRule) *NullableAlertRule { + return &NullableAlertRule{value: val, isSet: true} +} + +func (v NullableAlertRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_alert_rule_record.go b/services/observability/model_alert_rule_record.go new file mode 100644 index 000000000..77ce53be8 --- /dev/null +++ b/services/observability/model_alert_rule_record.go @@ -0,0 +1,364 @@ +/* +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 AlertRuleRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertRuleRecord{} + +/* + types and functions for alert +*/ + +// isNotNullableString +type AlertRuleRecordGetAlertAttributeType = *string + +func getAlertRuleRecordGetAlertAttributeTypeOk(arg AlertRuleRecordGetAlertAttributeType) (ret AlertRuleRecordGetAlertRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetAlertAttributeType(arg *AlertRuleRecordGetAlertAttributeType, val AlertRuleRecordGetAlertRetType) { + *arg = &val +} + +type AlertRuleRecordGetAlertArgType = string +type AlertRuleRecordGetAlertRetType = string + +/* + types and functions for annotations +*/ + +// isContainer +type AlertRuleRecordGetAnnotationsAttributeType = *map[string]string +type AlertRuleRecordGetAnnotationsArgType = map[string]string +type AlertRuleRecordGetAnnotationsRetType = map[string]string + +func getAlertRuleRecordGetAnnotationsAttributeTypeOk(arg AlertRuleRecordGetAnnotationsAttributeType) (ret AlertRuleRecordGetAnnotationsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetAnnotationsAttributeType(arg *AlertRuleRecordGetAnnotationsAttributeType, val AlertRuleRecordGetAnnotationsRetType) { + *arg = &val +} + +/* + types and functions for expr +*/ + +// isNotNullableString +type AlertRuleRecordGetExprAttributeType = *string + +func getAlertRuleRecordGetExprAttributeTypeOk(arg AlertRuleRecordGetExprAttributeType) (ret AlertRuleRecordGetExprRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetExprAttributeType(arg *AlertRuleRecordGetExprAttributeType, val AlertRuleRecordGetExprRetType) { + *arg = &val +} + +type AlertRuleRecordGetExprArgType = string +type AlertRuleRecordGetExprRetType = string + +/* + types and functions for for +*/ + +// isNotNullableString +type AlertRuleRecordGetForAttributeType = *string + +func getAlertRuleRecordGetForAttributeTypeOk(arg AlertRuleRecordGetForAttributeType) (ret AlertRuleRecordGetForRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetForAttributeType(arg *AlertRuleRecordGetForAttributeType, val AlertRuleRecordGetForRetType) { + *arg = &val +} + +type AlertRuleRecordGetForArgType = string +type AlertRuleRecordGetForRetType = string + +/* + types and functions for labels +*/ + +// isContainer +type AlertRuleRecordGetLabelsAttributeType = *map[string]string +type AlertRuleRecordGetLabelsArgType = map[string]string +type AlertRuleRecordGetLabelsRetType = map[string]string + +func getAlertRuleRecordGetLabelsAttributeTypeOk(arg AlertRuleRecordGetLabelsAttributeType) (ret AlertRuleRecordGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetLabelsAttributeType(arg *AlertRuleRecordGetLabelsAttributeType, val AlertRuleRecordGetLabelsRetType) { + *arg = &val +} + +/* + types and functions for record +*/ + +// isNotNullableString +type AlertRuleRecordGetRecordAttributeType = *string + +func getAlertRuleRecordGetRecordAttributeTypeOk(arg AlertRuleRecordGetRecordAttributeType) (ret AlertRuleRecordGetRecordRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRuleRecordGetRecordAttributeType(arg *AlertRuleRecordGetRecordAttributeType, val AlertRuleRecordGetRecordRetType) { + *arg = &val +} + +type AlertRuleRecordGetRecordArgType = string +type AlertRuleRecordGetRecordRetType = string + +// AlertRuleRecord struct for AlertRuleRecord +type AlertRuleRecord struct { + Alert AlertRuleRecordGetAlertAttributeType `json:"alert,omitempty"` + Annotations AlertRuleRecordGetAnnotationsAttributeType `json:"annotations,omitempty"` + // REQUIRED + Expr AlertRuleRecordGetExprAttributeType `json:"expr"` + For AlertRuleRecordGetForAttributeType `json:"for,omitempty"` + Labels AlertRuleRecordGetLabelsAttributeType `json:"labels,omitempty"` + Record AlertRuleRecordGetRecordAttributeType `json:"record,omitempty"` +} + +type _AlertRuleRecord AlertRuleRecord + +// NewAlertRuleRecord instantiates a new AlertRuleRecord 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 NewAlertRuleRecord(expr AlertRuleRecordGetExprArgType) *AlertRuleRecord { + this := AlertRuleRecord{} + setAlertRuleRecordGetExprAttributeType(&this.Expr, expr) + return &this +} + +// NewAlertRuleRecordWithDefaults instantiates a new AlertRuleRecord 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 NewAlertRuleRecordWithDefaults() *AlertRuleRecord { + this := AlertRuleRecord{} + return &this +} + +// GetAlert returns the Alert field value if set, zero value otherwise. +func (o *AlertRuleRecord) GetAlert() (res AlertRuleRecordGetAlertRetType) { + res, _ = o.GetAlertOk() + return +} + +// GetAlertOk returns a tuple with the Alert field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetAlertOk() (ret AlertRuleRecordGetAlertRetType, ok bool) { + return getAlertRuleRecordGetAlertAttributeTypeOk(o.Alert) +} + +// HasAlert returns a boolean if a field has been set. +func (o *AlertRuleRecord) HasAlert() bool { + _, ok := o.GetAlertOk() + return ok +} + +// SetAlert gets a reference to the given string and assigns it to the Alert field. +func (o *AlertRuleRecord) SetAlert(v AlertRuleRecordGetAlertRetType) { + setAlertRuleRecordGetAlertAttributeType(&o.Alert, v) +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *AlertRuleRecord) GetAnnotations() (res AlertRuleRecordGetAnnotationsRetType) { + res, _ = o.GetAnnotationsOk() + return +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetAnnotationsOk() (ret AlertRuleRecordGetAnnotationsRetType, ok bool) { + return getAlertRuleRecordGetAnnotationsAttributeTypeOk(o.Annotations) +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *AlertRuleRecord) HasAnnotations() bool { + _, ok := o.GetAnnotationsOk() + return ok +} + +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *AlertRuleRecord) SetAnnotations(v AlertRuleRecordGetAnnotationsRetType) { + setAlertRuleRecordGetAnnotationsAttributeType(&o.Annotations, v) +} + +// GetExpr returns the Expr field value +func (o *AlertRuleRecord) GetExpr() (ret AlertRuleRecordGetExprRetType) { + ret, _ = o.GetExprOk() + return ret +} + +// GetExprOk returns a tuple with the Expr field value +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetExprOk() (ret AlertRuleRecordGetExprRetType, ok bool) { + return getAlertRuleRecordGetExprAttributeTypeOk(o.Expr) +} + +// SetExpr sets field value +func (o *AlertRuleRecord) SetExpr(v AlertRuleRecordGetExprRetType) { + setAlertRuleRecordGetExprAttributeType(&o.Expr, v) +} + +// GetFor returns the For field value if set, zero value otherwise. +func (o *AlertRuleRecord) GetFor() (res AlertRuleRecordGetForRetType) { + res, _ = o.GetForOk() + return +} + +// GetForOk returns a tuple with the For field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetForOk() (ret AlertRuleRecordGetForRetType, ok bool) { + return getAlertRuleRecordGetForAttributeTypeOk(o.For) +} + +// HasFor returns a boolean if a field has been set. +func (o *AlertRuleRecord) HasFor() bool { + _, ok := o.GetForOk() + return ok +} + +// SetFor gets a reference to the given string and assigns it to the For field. +func (o *AlertRuleRecord) SetFor(v AlertRuleRecordGetForRetType) { + setAlertRuleRecordGetForAttributeType(&o.For, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *AlertRuleRecord) GetLabels() (res AlertRuleRecordGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetLabelsOk() (ret AlertRuleRecordGetLabelsRetType, ok bool) { + return getAlertRuleRecordGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *AlertRuleRecord) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *AlertRuleRecord) SetLabels(v AlertRuleRecordGetLabelsRetType) { + setAlertRuleRecordGetLabelsAttributeType(&o.Labels, v) +} + +// GetRecord returns the Record field value if set, zero value otherwise. +func (o *AlertRuleRecord) GetRecord() (res AlertRuleRecordGetRecordRetType) { + res, _ = o.GetRecordOk() + return +} + +// GetRecordOk returns a tuple with the Record field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AlertRuleRecord) GetRecordOk() (ret AlertRuleRecordGetRecordRetType, ok bool) { + return getAlertRuleRecordGetRecordAttributeTypeOk(o.Record) +} + +// HasRecord returns a boolean if a field has been set. +func (o *AlertRuleRecord) HasRecord() bool { + _, ok := o.GetRecordOk() + return ok +} + +// SetRecord gets a reference to the given string and assigns it to the Record field. +func (o *AlertRuleRecord) SetRecord(v AlertRuleRecordGetRecordRetType) { + setAlertRuleRecordGetRecordAttributeType(&o.Record, v) +} + +func (o AlertRuleRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertRuleRecordGetAlertAttributeTypeOk(o.Alert); ok { + toSerialize["Alert"] = val + } + if val, ok := getAlertRuleRecordGetAnnotationsAttributeTypeOk(o.Annotations); ok { + toSerialize["Annotations"] = val + } + if val, ok := getAlertRuleRecordGetExprAttributeTypeOk(o.Expr); ok { + toSerialize["Expr"] = val + } + if val, ok := getAlertRuleRecordGetForAttributeTypeOk(o.For); ok { + toSerialize["For"] = val + } + if val, ok := getAlertRuleRecordGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + if val, ok := getAlertRuleRecordGetRecordAttributeTypeOk(o.Record); ok { + toSerialize["Record"] = val + } + return toSerialize, nil +} + +type NullableAlertRuleRecord struct { + value *AlertRuleRecord + isSet bool +} + +func (v NullableAlertRuleRecord) Get() *AlertRuleRecord { + return v.value +} + +func (v *NullableAlertRuleRecord) Set(val *AlertRuleRecord) { + v.value = val + v.isSet = true +} + +func (v NullableAlertRuleRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertRuleRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertRuleRecord(val *AlertRuleRecord) *NullableAlertRuleRecord { + return &NullableAlertRuleRecord{value: val, isSet: true} +} + +func (v NullableAlertRuleRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertRuleRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_alert_rules_response.go b/services/observability/model_alert_rules_response.go new file mode 100644 index 000000000..015ac24ed --- /dev/null +++ b/services/observability/model_alert_rules_response.go @@ -0,0 +1,169 @@ +/* +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 AlertRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AlertRulesResponse{} + +/* + types and functions for data +*/ + +// isArray +type AlertRulesResponseGetDataAttributeType = *[]AlertRule +type AlertRulesResponseGetDataArgType = []AlertRule +type AlertRulesResponseGetDataRetType = []AlertRule + +func getAlertRulesResponseGetDataAttributeTypeOk(arg AlertRulesResponseGetDataAttributeType) (ret AlertRulesResponseGetDataRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRulesResponseGetDataAttributeType(arg *AlertRulesResponseGetDataAttributeType, val AlertRulesResponseGetDataRetType) { + *arg = &val +} + +/* + types and functions for message +*/ + +// isNotNullableString +type AlertRulesResponseGetMessageAttributeType = *string + +func getAlertRulesResponseGetMessageAttributeTypeOk(arg AlertRulesResponseGetMessageAttributeType) (ret AlertRulesResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAlertRulesResponseGetMessageAttributeType(arg *AlertRulesResponseGetMessageAttributeType, val AlertRulesResponseGetMessageRetType) { + *arg = &val +} + +type AlertRulesResponseGetMessageArgType = string +type AlertRulesResponseGetMessageRetType = string + +// AlertRulesResponse struct for AlertRulesResponse +type AlertRulesResponse struct { + // REQUIRED + Data AlertRulesResponseGetDataAttributeType `json:"data"` + // REQUIRED + Message AlertRulesResponseGetMessageAttributeType `json:"message"` +} + +type _AlertRulesResponse AlertRulesResponse + +// NewAlertRulesResponse instantiates a new AlertRulesResponse 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 NewAlertRulesResponse(data AlertRulesResponseGetDataArgType, message AlertRulesResponseGetMessageArgType) *AlertRulesResponse { + this := AlertRulesResponse{} + setAlertRulesResponseGetDataAttributeType(&this.Data, data) + setAlertRulesResponseGetMessageAttributeType(&this.Message, message) + return &this +} + +// NewAlertRulesResponseWithDefaults instantiates a new AlertRulesResponse 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 NewAlertRulesResponseWithDefaults() *AlertRulesResponse { + this := AlertRulesResponse{} + return &this +} + +// GetData returns the Data field value +func (o *AlertRulesResponse) GetData() (ret AlertRulesResponseGetDataRetType) { + ret, _ = o.GetDataOk() + return ret +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *AlertRulesResponse) GetDataOk() (ret AlertRulesResponseGetDataRetType, ok bool) { + return getAlertRulesResponseGetDataAttributeTypeOk(o.Data) +} + +// SetData sets field value +func (o *AlertRulesResponse) SetData(v AlertRulesResponseGetDataRetType) { + setAlertRulesResponseGetDataAttributeType(&o.Data, v) +} + +// GetMessage returns the Message field value +func (o *AlertRulesResponse) GetMessage() (ret AlertRulesResponseGetMessageRetType) { + ret, _ = o.GetMessageOk() + return ret +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *AlertRulesResponse) GetMessageOk() (ret AlertRulesResponseGetMessageRetType, ok bool) { + return getAlertRulesResponseGetMessageAttributeTypeOk(o.Message) +} + +// SetMessage sets field value +func (o *AlertRulesResponse) SetMessage(v AlertRulesResponseGetMessageRetType) { + setAlertRulesResponseGetMessageAttributeType(&o.Message, v) +} + +func (o AlertRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAlertRulesResponseGetDataAttributeTypeOk(o.Data); ok { + toSerialize["Data"] = val + } + if val, ok := getAlertRulesResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + return toSerialize, nil +} + +type NullableAlertRulesResponse struct { + value *AlertRulesResponse + isSet bool +} + +func (v NullableAlertRulesResponse) Get() *AlertRulesResponse { + return v.value +} + +func (v *NullableAlertRulesResponse) Set(val *AlertRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAlertRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAlertRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAlertRulesResponse(val *AlertRulesResponse) *NullableAlertRulesResponse { + return &NullableAlertRulesResponse{value: val, isSet: true} +} + +func (v NullableAlertRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAlertRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_create_alertgroups_payload.go b/services/observability/model_create_alertgroups_payload.go new file mode 100644 index 000000000..3807058f0 --- /dev/null +++ b/services/observability/model_create_alertgroups_payload.go @@ -0,0 +1,222 @@ +/* +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 CreateAlertgroupsPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAlertgroupsPayload{} + +/* + types and functions for interval +*/ + +// isNotNullableString +type CreateAlertgroupsPayloadGetIntervalAttributeType = *string + +func getCreateAlertgroupsPayloadGetIntervalAttributeTypeOk(arg CreateAlertgroupsPayloadGetIntervalAttributeType) (ret CreateAlertgroupsPayloadGetIntervalRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertgroupsPayloadGetIntervalAttributeType(arg *CreateAlertgroupsPayloadGetIntervalAttributeType, val CreateAlertgroupsPayloadGetIntervalRetType) { + *arg = &val +} + +type CreateAlertgroupsPayloadGetIntervalArgType = string +type CreateAlertgroupsPayloadGetIntervalRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type CreateAlertgroupsPayloadGetNameAttributeType = *string + +func getCreateAlertgroupsPayloadGetNameAttributeTypeOk(arg CreateAlertgroupsPayloadGetNameAttributeType) (ret CreateAlertgroupsPayloadGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertgroupsPayloadGetNameAttributeType(arg *CreateAlertgroupsPayloadGetNameAttributeType, val CreateAlertgroupsPayloadGetNameRetType) { + *arg = &val +} + +type CreateAlertgroupsPayloadGetNameArgType = string +type CreateAlertgroupsPayloadGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type CreateAlertgroupsPayloadGetRulesAttributeType = *[]UpdateAlertgroupsRequestInnerRulesInner +type CreateAlertgroupsPayloadGetRulesArgType = []UpdateAlertgroupsRequestInnerRulesInner +type CreateAlertgroupsPayloadGetRulesRetType = []UpdateAlertgroupsRequestInnerRulesInner + +func getCreateAlertgroupsPayloadGetRulesAttributeTypeOk(arg CreateAlertgroupsPayloadGetRulesAttributeType) (ret CreateAlertgroupsPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertgroupsPayloadGetRulesAttributeType(arg *CreateAlertgroupsPayloadGetRulesAttributeType, val CreateAlertgroupsPayloadGetRulesRetType) { + *arg = &val +} + +// CreateAlertgroupsPayload Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus. +type CreateAlertgroupsPayload struct { + // How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s + Interval CreateAlertgroupsPayloadGetIntervalAttributeType `json:"interval,omitempty"` + // The name of the group. Must be unique. `Additional Validators:` * is the identifier and so unique * should only include the characters: a-zA-Z0-9- + // REQUIRED + Name CreateAlertgroupsPayloadGetNameAttributeType `json:"name"` + // rules for the alert group + // REQUIRED + Rules CreateAlertgroupsPayloadGetRulesAttributeType `json:"rules"` +} + +type _CreateAlertgroupsPayload CreateAlertgroupsPayload + +// NewCreateAlertgroupsPayload instantiates a new CreateAlertgroupsPayload 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 NewCreateAlertgroupsPayload(name CreateAlertgroupsPayloadGetNameArgType, rules CreateAlertgroupsPayloadGetRulesArgType) *CreateAlertgroupsPayload { + this := CreateAlertgroupsPayload{} + setCreateAlertgroupsPayloadGetNameAttributeType(&this.Name, name) + setCreateAlertgroupsPayloadGetRulesAttributeType(&this.Rules, rules) + return &this +} + +// NewCreateAlertgroupsPayloadWithDefaults instantiates a new CreateAlertgroupsPayload 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 NewCreateAlertgroupsPayloadWithDefaults() *CreateAlertgroupsPayload { + this := CreateAlertgroupsPayload{} + var interval string = "60s" + this.Interval = &interval + return &this +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *CreateAlertgroupsPayload) GetInterval() (res CreateAlertgroupsPayloadGetIntervalRetType) { + res, _ = o.GetIntervalOk() + return +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAlertgroupsPayload) GetIntervalOk() (ret CreateAlertgroupsPayloadGetIntervalRetType, ok bool) { + return getCreateAlertgroupsPayloadGetIntervalAttributeTypeOk(o.Interval) +} + +// HasInterval returns a boolean if a field has been set. +func (o *CreateAlertgroupsPayload) HasInterval() bool { + _, ok := o.GetIntervalOk() + return ok +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *CreateAlertgroupsPayload) SetInterval(v CreateAlertgroupsPayloadGetIntervalRetType) { + setCreateAlertgroupsPayloadGetIntervalAttributeType(&o.Interval, v) +} + +// GetName returns the Name field value +func (o *CreateAlertgroupsPayload) GetName() (ret CreateAlertgroupsPayloadGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CreateAlertgroupsPayload) GetNameOk() (ret CreateAlertgroupsPayloadGetNameRetType, ok bool) { + return getCreateAlertgroupsPayloadGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *CreateAlertgroupsPayload) SetName(v CreateAlertgroupsPayloadGetNameRetType) { + setCreateAlertgroupsPayloadGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value +func (o *CreateAlertgroupsPayload) GetRules() (ret CreateAlertgroupsPayloadGetRulesRetType) { + ret, _ = o.GetRulesOk() + return ret +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *CreateAlertgroupsPayload) GetRulesOk() (ret CreateAlertgroupsPayloadGetRulesRetType, ok bool) { + return getCreateAlertgroupsPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// SetRules sets field value +func (o *CreateAlertgroupsPayload) SetRules(v CreateAlertgroupsPayloadGetRulesRetType) { + setCreateAlertgroupsPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o CreateAlertgroupsPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAlertgroupsPayloadGetIntervalAttributeTypeOk(o.Interval); ok { + toSerialize["Interval"] = val + } + if val, ok := getCreateAlertgroupsPayloadGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getCreateAlertgroupsPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableCreateAlertgroupsPayload struct { + value *CreateAlertgroupsPayload + isSet bool +} + +func (v NullableCreateAlertgroupsPayload) Get() *CreateAlertgroupsPayload { + return v.value +} + +func (v *NullableCreateAlertgroupsPayload) Set(val *CreateAlertgroupsPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAlertgroupsPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAlertgroupsPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAlertgroupsPayload(val *CreateAlertgroupsPayload) *NullableCreateAlertgroupsPayload { + return &NullableCreateAlertgroupsPayload{value: val, isSet: true} +} + +func (v NullableCreateAlertgroupsPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAlertgroupsPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_create_alertrules_payload.go b/services/observability/model_create_alertrules_payload.go new file mode 100644 index 000000000..734b512b3 --- /dev/null +++ b/services/observability/model_create_alertrules_payload.go @@ -0,0 +1,319 @@ +/* +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 CreateAlertrulesPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAlertrulesPayload{} + +/* + types and functions for alert +*/ + +// isNotNullableString +type CreateAlertrulesPayloadGetAlertAttributeType = *string + +func getCreateAlertrulesPayloadGetAlertAttributeTypeOk(arg CreateAlertrulesPayloadGetAlertAttributeType) (ret CreateAlertrulesPayloadGetAlertRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertrulesPayloadGetAlertAttributeType(arg *CreateAlertrulesPayloadGetAlertAttributeType, val CreateAlertrulesPayloadGetAlertRetType) { + *arg = &val +} + +type CreateAlertrulesPayloadGetAlertArgType = string +type CreateAlertrulesPayloadGetAlertRetType = string + +/* + types and functions for annotations +*/ + +// isFreeform +type CreateAlertrulesPayloadGetAnnotationsAttributeType = *map[string]interface{} +type CreateAlertrulesPayloadGetAnnotationsArgType = map[string]interface{} +type CreateAlertrulesPayloadGetAnnotationsRetType = map[string]interface{} + +func getCreateAlertrulesPayloadGetAnnotationsAttributeTypeOk(arg CreateAlertrulesPayloadGetAnnotationsAttributeType) (ret CreateAlertrulesPayloadGetAnnotationsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertrulesPayloadGetAnnotationsAttributeType(arg *CreateAlertrulesPayloadGetAnnotationsAttributeType, val CreateAlertrulesPayloadGetAnnotationsRetType) { + *arg = &val +} + +/* + types and functions for expr +*/ + +// isNotNullableString +type CreateAlertrulesPayloadGetExprAttributeType = *string + +func getCreateAlertrulesPayloadGetExprAttributeTypeOk(arg CreateAlertrulesPayloadGetExprAttributeType) (ret CreateAlertrulesPayloadGetExprRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertrulesPayloadGetExprAttributeType(arg *CreateAlertrulesPayloadGetExprAttributeType, val CreateAlertrulesPayloadGetExprRetType) { + *arg = &val +} + +type CreateAlertrulesPayloadGetExprArgType = string +type CreateAlertrulesPayloadGetExprRetType = string + +/* + types and functions for for +*/ + +// isNotNullableString +type CreateAlertrulesPayloadGetForAttributeType = *string + +func getCreateAlertrulesPayloadGetForAttributeTypeOk(arg CreateAlertrulesPayloadGetForAttributeType) (ret CreateAlertrulesPayloadGetForRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertrulesPayloadGetForAttributeType(arg *CreateAlertrulesPayloadGetForAttributeType, val CreateAlertrulesPayloadGetForRetType) { + *arg = &val +} + +type CreateAlertrulesPayloadGetForArgType = string +type CreateAlertrulesPayloadGetForRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type CreateAlertrulesPayloadGetLabelsAttributeType = *map[string]interface{} +type CreateAlertrulesPayloadGetLabelsArgType = map[string]interface{} +type CreateAlertrulesPayloadGetLabelsRetType = map[string]interface{} + +func getCreateAlertrulesPayloadGetLabelsAttributeTypeOk(arg CreateAlertrulesPayloadGetLabelsAttributeType) (ret CreateAlertrulesPayloadGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setCreateAlertrulesPayloadGetLabelsAttributeType(arg *CreateAlertrulesPayloadGetLabelsAttributeType, val CreateAlertrulesPayloadGetLabelsRetType) { + *arg = &val +} + +// CreateAlertrulesPayload Alert rule. `Additional Validators:` * total config (all alert groups/rules) should not be bigger than 500000 characters as string since this the limitation of prometheus. +type CreateAlertrulesPayload struct { + // The name of the alert. `Additional Validators:` * is the identifier and so unique in the group * should only include the characters: a-zA-Z0-9- + // REQUIRED + Alert CreateAlertrulesPayloadGetAlertAttributeType `json:"alert"` + // map of key:value. Annotations to add to each alert. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters + Annotations CreateAlertrulesPayloadGetAnnotationsAttributeType `json:"annotations,omitempty"` + // The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts. + // REQUIRED + Expr CreateAlertrulesPayloadGetExprAttributeType `json:"expr"` + // Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. `Additional Validators:` * must be a valid time string + For CreateAlertrulesPayloadGetForAttributeType `json:"for,omitempty"` + // map of key:value. Labels to add or overwrite for each alert. `Additional Validators:` * should not contain more than 10 keys * each key and value should not be longer than 200 characters + Labels CreateAlertrulesPayloadGetLabelsAttributeType `json:"labels,omitempty"` +} + +type _CreateAlertrulesPayload CreateAlertrulesPayload + +// NewCreateAlertrulesPayload instantiates a new CreateAlertrulesPayload 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 NewCreateAlertrulesPayload(alert CreateAlertrulesPayloadGetAlertArgType, expr CreateAlertrulesPayloadGetExprArgType) *CreateAlertrulesPayload { + this := CreateAlertrulesPayload{} + setCreateAlertrulesPayloadGetAlertAttributeType(&this.Alert, alert) + setCreateAlertrulesPayloadGetExprAttributeType(&this.Expr, expr) + return &this +} + +// NewCreateAlertrulesPayloadWithDefaults instantiates a new CreateAlertrulesPayload 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 NewCreateAlertrulesPayloadWithDefaults() *CreateAlertrulesPayload { + this := CreateAlertrulesPayload{} + var for_ string = "0s" + this.For = &for_ + return &this +} + +// GetAlert returns the Alert field value +func (o *CreateAlertrulesPayload) GetAlert() (ret CreateAlertrulesPayloadGetAlertRetType) { + ret, _ = o.GetAlertOk() + return ret +} + +// GetAlertOk returns a tuple with the Alert field value +// and a boolean to check if the value has been set. +func (o *CreateAlertrulesPayload) GetAlertOk() (ret CreateAlertrulesPayloadGetAlertRetType, ok bool) { + return getCreateAlertrulesPayloadGetAlertAttributeTypeOk(o.Alert) +} + +// SetAlert sets field value +func (o *CreateAlertrulesPayload) SetAlert(v CreateAlertrulesPayloadGetAlertRetType) { + setCreateAlertrulesPayloadGetAlertAttributeType(&o.Alert, v) +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *CreateAlertrulesPayload) GetAnnotations() (res CreateAlertrulesPayloadGetAnnotationsRetType) { + res, _ = o.GetAnnotationsOk() + return +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAlertrulesPayload) GetAnnotationsOk() (ret CreateAlertrulesPayloadGetAnnotationsRetType, ok bool) { + return getCreateAlertrulesPayloadGetAnnotationsAttributeTypeOk(o.Annotations) +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *CreateAlertrulesPayload) HasAnnotations() bool { + _, ok := o.GetAnnotationsOk() + return ok +} + +// SetAnnotations gets a reference to the given map[string]interface{} and assigns it to the Annotations field. +func (o *CreateAlertrulesPayload) SetAnnotations(v CreateAlertrulesPayloadGetAnnotationsRetType) { + setCreateAlertrulesPayloadGetAnnotationsAttributeType(&o.Annotations, v) +} + +// GetExpr returns the Expr field value +func (o *CreateAlertrulesPayload) GetExpr() (ret CreateAlertrulesPayloadGetExprRetType) { + ret, _ = o.GetExprOk() + return ret +} + +// GetExprOk returns a tuple with the Expr field value +// and a boolean to check if the value has been set. +func (o *CreateAlertrulesPayload) GetExprOk() (ret CreateAlertrulesPayloadGetExprRetType, ok bool) { + return getCreateAlertrulesPayloadGetExprAttributeTypeOk(o.Expr) +} + +// SetExpr sets field value +func (o *CreateAlertrulesPayload) SetExpr(v CreateAlertrulesPayloadGetExprRetType) { + setCreateAlertrulesPayloadGetExprAttributeType(&o.Expr, v) +} + +// GetFor returns the For field value if set, zero value otherwise. +func (o *CreateAlertrulesPayload) GetFor() (res CreateAlertrulesPayloadGetForRetType) { + res, _ = o.GetForOk() + return +} + +// GetForOk returns a tuple with the For field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAlertrulesPayload) GetForOk() (ret CreateAlertrulesPayloadGetForRetType, ok bool) { + return getCreateAlertrulesPayloadGetForAttributeTypeOk(o.For) +} + +// HasFor returns a boolean if a field has been set. +func (o *CreateAlertrulesPayload) HasFor() bool { + _, ok := o.GetForOk() + return ok +} + +// SetFor gets a reference to the given string and assigns it to the For field. +func (o *CreateAlertrulesPayload) SetFor(v CreateAlertrulesPayloadGetForRetType) { + setCreateAlertrulesPayloadGetForAttributeType(&o.For, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *CreateAlertrulesPayload) GetLabels() (res CreateAlertrulesPayloadGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAlertrulesPayload) GetLabelsOk() (ret CreateAlertrulesPayloadGetLabelsRetType, ok bool) { + return getCreateAlertrulesPayloadGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *CreateAlertrulesPayload) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *CreateAlertrulesPayload) SetLabels(v CreateAlertrulesPayloadGetLabelsRetType) { + setCreateAlertrulesPayloadGetLabelsAttributeType(&o.Labels, v) +} + +func (o CreateAlertrulesPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getCreateAlertrulesPayloadGetAlertAttributeTypeOk(o.Alert); ok { + toSerialize["Alert"] = val + } + if val, ok := getCreateAlertrulesPayloadGetAnnotationsAttributeTypeOk(o.Annotations); ok { + toSerialize["Annotations"] = val + } + if val, ok := getCreateAlertrulesPayloadGetExprAttributeTypeOk(o.Expr); ok { + toSerialize["Expr"] = val + } + if val, ok := getCreateAlertrulesPayloadGetForAttributeTypeOk(o.For); ok { + toSerialize["For"] = val + } + if val, ok := getCreateAlertrulesPayloadGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableCreateAlertrulesPayload struct { + value *CreateAlertrulesPayload + isSet bool +} + +func (v NullableCreateAlertrulesPayload) Get() *CreateAlertrulesPayload { + return v.value +} + +func (v *NullableCreateAlertrulesPayload) Set(val *CreateAlertrulesPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAlertrulesPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAlertrulesPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAlertrulesPayload(val *CreateAlertrulesPayload) *NullableCreateAlertrulesPayload { + return &NullableCreateAlertrulesPayload{value: val, isSet: true} +} + +func (v NullableCreateAlertrulesPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAlertrulesPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_update_alertgroup_payload.go b/services/observability/model_update_alertgroup_payload.go new file mode 100644 index 000000000..c60319510 --- /dev/null +++ b/services/observability/model_update_alertgroup_payload.go @@ -0,0 +1,177 @@ +/* +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 UpdateAlertgroupPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAlertgroupPayload{} + +/* + types and functions for interval +*/ + +// isNotNullableString +type UpdateAlertgroupPayloadGetIntervalAttributeType = *string + +func getUpdateAlertgroupPayloadGetIntervalAttributeTypeOk(arg UpdateAlertgroupPayloadGetIntervalAttributeType) (ret UpdateAlertgroupPayloadGetIntervalRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupPayloadGetIntervalAttributeType(arg *UpdateAlertgroupPayloadGetIntervalAttributeType, val UpdateAlertgroupPayloadGetIntervalRetType) { + *arg = &val +} + +type UpdateAlertgroupPayloadGetIntervalArgType = string +type UpdateAlertgroupPayloadGetIntervalRetType = string + +/* + types and functions for rules +*/ + +// isArray +type UpdateAlertgroupPayloadGetRulesAttributeType = *[]UpdateAlertgroupsRequestInnerRulesInner +type UpdateAlertgroupPayloadGetRulesArgType = []UpdateAlertgroupsRequestInnerRulesInner +type UpdateAlertgroupPayloadGetRulesRetType = []UpdateAlertgroupsRequestInnerRulesInner + +func getUpdateAlertgroupPayloadGetRulesAttributeTypeOk(arg UpdateAlertgroupPayloadGetRulesAttributeType) (ret UpdateAlertgroupPayloadGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupPayloadGetRulesAttributeType(arg *UpdateAlertgroupPayloadGetRulesAttributeType, val UpdateAlertgroupPayloadGetRulesRetType) { + *arg = &val +} + +// UpdateAlertgroupPayload Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus. +type UpdateAlertgroupPayload struct { + // How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s + Interval UpdateAlertgroupPayloadGetIntervalAttributeType `json:"interval,omitempty"` + // rules for the alert group + // REQUIRED + Rules UpdateAlertgroupPayloadGetRulesAttributeType `json:"rules"` +} + +type _UpdateAlertgroupPayload UpdateAlertgroupPayload + +// NewUpdateAlertgroupPayload instantiates a new UpdateAlertgroupPayload 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 NewUpdateAlertgroupPayload(rules UpdateAlertgroupPayloadGetRulesArgType) *UpdateAlertgroupPayload { + this := UpdateAlertgroupPayload{} + setUpdateAlertgroupPayloadGetRulesAttributeType(&this.Rules, rules) + return &this +} + +// NewUpdateAlertgroupPayloadWithDefaults instantiates a new UpdateAlertgroupPayload 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 NewUpdateAlertgroupPayloadWithDefaults() *UpdateAlertgroupPayload { + this := UpdateAlertgroupPayload{} + var interval string = "60s" + this.Interval = &interval + return &this +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *UpdateAlertgroupPayload) GetInterval() (res UpdateAlertgroupPayloadGetIntervalRetType) { + res, _ = o.GetIntervalOk() + return +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupPayload) GetIntervalOk() (ret UpdateAlertgroupPayloadGetIntervalRetType, ok bool) { + return getUpdateAlertgroupPayloadGetIntervalAttributeTypeOk(o.Interval) +} + +// HasInterval returns a boolean if a field has been set. +func (o *UpdateAlertgroupPayload) HasInterval() bool { + _, ok := o.GetIntervalOk() + return ok +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *UpdateAlertgroupPayload) SetInterval(v UpdateAlertgroupPayloadGetIntervalRetType) { + setUpdateAlertgroupPayloadGetIntervalAttributeType(&o.Interval, v) +} + +// GetRules returns the Rules field value +func (o *UpdateAlertgroupPayload) GetRules() (ret UpdateAlertgroupPayloadGetRulesRetType) { + ret, _ = o.GetRulesOk() + return ret +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupPayload) GetRulesOk() (ret UpdateAlertgroupPayloadGetRulesRetType, ok bool) { + return getUpdateAlertgroupPayloadGetRulesAttributeTypeOk(o.Rules) +} + +// SetRules sets field value +func (o *UpdateAlertgroupPayload) SetRules(v UpdateAlertgroupPayloadGetRulesRetType) { + setUpdateAlertgroupPayloadGetRulesAttributeType(&o.Rules, v) +} + +func (o UpdateAlertgroupPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAlertgroupPayloadGetIntervalAttributeTypeOk(o.Interval); ok { + toSerialize["Interval"] = val + } + if val, ok := getUpdateAlertgroupPayloadGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableUpdateAlertgroupPayload struct { + value *UpdateAlertgroupPayload + isSet bool +} + +func (v NullableUpdateAlertgroupPayload) Get() *UpdateAlertgroupPayload { + return v.value +} + +func (v *NullableUpdateAlertgroupPayload) Set(val *UpdateAlertgroupPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAlertgroupPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAlertgroupPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAlertgroupPayload(val *UpdateAlertgroupPayload) *NullableUpdateAlertgroupPayload { + return &NullableUpdateAlertgroupPayload{value: val, isSet: true} +} + +func (v NullableUpdateAlertgroupPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAlertgroupPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_update_alertgroups_request_inner.go b/services/observability/model_update_alertgroups_request_inner.go new file mode 100644 index 000000000..e8bde68a7 --- /dev/null +++ b/services/observability/model_update_alertgroups_request_inner.go @@ -0,0 +1,222 @@ +/* +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 UpdateAlertgroupsRequestInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAlertgroupsRequestInner{} + +/* + types and functions for interval +*/ + +// isNotNullableString +type UpdateAlertgroupsRequestInnerGetIntervalAttributeType = *string + +func getUpdateAlertgroupsRequestInnerGetIntervalAttributeTypeOk(arg UpdateAlertgroupsRequestInnerGetIntervalAttributeType) (ret UpdateAlertgroupsRequestInnerGetIntervalRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerGetIntervalAttributeType(arg *UpdateAlertgroupsRequestInnerGetIntervalAttributeType, val UpdateAlertgroupsRequestInnerGetIntervalRetType) { + *arg = &val +} + +type UpdateAlertgroupsRequestInnerGetIntervalArgType = string +type UpdateAlertgroupsRequestInnerGetIntervalRetType = string + +/* + types and functions for name +*/ + +// isNotNullableString +type UpdateAlertgroupsRequestInnerGetNameAttributeType = *string + +func getUpdateAlertgroupsRequestInnerGetNameAttributeTypeOk(arg UpdateAlertgroupsRequestInnerGetNameAttributeType) (ret UpdateAlertgroupsRequestInnerGetNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerGetNameAttributeType(arg *UpdateAlertgroupsRequestInnerGetNameAttributeType, val UpdateAlertgroupsRequestInnerGetNameRetType) { + *arg = &val +} + +type UpdateAlertgroupsRequestInnerGetNameArgType = string +type UpdateAlertgroupsRequestInnerGetNameRetType = string + +/* + types and functions for rules +*/ + +// isArray +type UpdateAlertgroupsRequestInnerGetRulesAttributeType = *[]UpdateAlertgroupsRequestInnerRulesInner +type UpdateAlertgroupsRequestInnerGetRulesArgType = []UpdateAlertgroupsRequestInnerRulesInner +type UpdateAlertgroupsRequestInnerGetRulesRetType = []UpdateAlertgroupsRequestInnerRulesInner + +func getUpdateAlertgroupsRequestInnerGetRulesAttributeTypeOk(arg UpdateAlertgroupsRequestInnerGetRulesAttributeType) (ret UpdateAlertgroupsRequestInnerGetRulesRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerGetRulesAttributeType(arg *UpdateAlertgroupsRequestInnerGetRulesAttributeType, val UpdateAlertgroupsRequestInnerGetRulesRetType) { + *arg = &val +} + +// UpdateAlertgroupsRequestInner Alert group that should be created or updated `Additional Validators:` * total config should not be bigger than 500000 characters as string since this the limitation of prometheus. +type UpdateAlertgroupsRequestInner struct { + // How often rules in the group are evaluated. `Additional Validators:` * must be a valid time string * should be >=60s + Interval UpdateAlertgroupsRequestInnerGetIntervalAttributeType `json:"interval,omitempty"` + // The name of the group. Must be unique. `Additional Validators:` * is the identifier and so unique * should only include the characters: a-zA-Z0-9- + // REQUIRED + Name UpdateAlertgroupsRequestInnerGetNameAttributeType `json:"name"` + // rules for the alert group + // REQUIRED + Rules UpdateAlertgroupsRequestInnerGetRulesAttributeType `json:"rules"` +} + +type _UpdateAlertgroupsRequestInner UpdateAlertgroupsRequestInner + +// NewUpdateAlertgroupsRequestInner instantiates a new UpdateAlertgroupsRequestInner 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 NewUpdateAlertgroupsRequestInner(name UpdateAlertgroupsRequestInnerGetNameArgType, rules UpdateAlertgroupsRequestInnerGetRulesArgType) *UpdateAlertgroupsRequestInner { + this := UpdateAlertgroupsRequestInner{} + setUpdateAlertgroupsRequestInnerGetNameAttributeType(&this.Name, name) + setUpdateAlertgroupsRequestInnerGetRulesAttributeType(&this.Rules, rules) + return &this +} + +// NewUpdateAlertgroupsRequestInnerWithDefaults instantiates a new UpdateAlertgroupsRequestInner 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 NewUpdateAlertgroupsRequestInnerWithDefaults() *UpdateAlertgroupsRequestInner { + this := UpdateAlertgroupsRequestInner{} + var interval string = "60s" + this.Interval = &interval + return &this +} + +// GetInterval returns the Interval field value if set, zero value otherwise. +func (o *UpdateAlertgroupsRequestInner) GetInterval() (res UpdateAlertgroupsRequestInnerGetIntervalRetType) { + res, _ = o.GetIntervalOk() + return +} + +// GetIntervalOk returns a tuple with the Interval field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInner) GetIntervalOk() (ret UpdateAlertgroupsRequestInnerGetIntervalRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerGetIntervalAttributeTypeOk(o.Interval) +} + +// HasInterval returns a boolean if a field has been set. +func (o *UpdateAlertgroupsRequestInner) HasInterval() bool { + _, ok := o.GetIntervalOk() + return ok +} + +// SetInterval gets a reference to the given string and assigns it to the Interval field. +func (o *UpdateAlertgroupsRequestInner) SetInterval(v UpdateAlertgroupsRequestInnerGetIntervalRetType) { + setUpdateAlertgroupsRequestInnerGetIntervalAttributeType(&o.Interval, v) +} + +// GetName returns the Name field value +func (o *UpdateAlertgroupsRequestInner) GetName() (ret UpdateAlertgroupsRequestInnerGetNameRetType) { + ret, _ = o.GetNameOk() + return ret +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInner) GetNameOk() (ret UpdateAlertgroupsRequestInnerGetNameRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerGetNameAttributeTypeOk(o.Name) +} + +// SetName sets field value +func (o *UpdateAlertgroupsRequestInner) SetName(v UpdateAlertgroupsRequestInnerGetNameRetType) { + setUpdateAlertgroupsRequestInnerGetNameAttributeType(&o.Name, v) +} + +// GetRules returns the Rules field value +func (o *UpdateAlertgroupsRequestInner) GetRules() (ret UpdateAlertgroupsRequestInnerGetRulesRetType) { + ret, _ = o.GetRulesOk() + return ret +} + +// GetRulesOk returns a tuple with the Rules field value +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInner) GetRulesOk() (ret UpdateAlertgroupsRequestInnerGetRulesRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerGetRulesAttributeTypeOk(o.Rules) +} + +// SetRules sets field value +func (o *UpdateAlertgroupsRequestInner) SetRules(v UpdateAlertgroupsRequestInnerGetRulesRetType) { + setUpdateAlertgroupsRequestInnerGetRulesAttributeType(&o.Rules, v) +} + +func (o UpdateAlertgroupsRequestInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAlertgroupsRequestInnerGetIntervalAttributeTypeOk(o.Interval); ok { + toSerialize["Interval"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerGetNameAttributeTypeOk(o.Name); ok { + toSerialize["Name"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerGetRulesAttributeTypeOk(o.Rules); ok { + toSerialize["Rules"] = val + } + return toSerialize, nil +} + +type NullableUpdateAlertgroupsRequestInner struct { + value *UpdateAlertgroupsRequestInner + isSet bool +} + +func (v NullableUpdateAlertgroupsRequestInner) Get() *UpdateAlertgroupsRequestInner { + return v.value +} + +func (v *NullableUpdateAlertgroupsRequestInner) Set(val *UpdateAlertgroupsRequestInner) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAlertgroupsRequestInner) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAlertgroupsRequestInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAlertgroupsRequestInner(val *UpdateAlertgroupsRequestInner) *NullableUpdateAlertgroupsRequestInner { + return &NullableUpdateAlertgroupsRequestInner{value: val, isSet: true} +} + +func (v NullableUpdateAlertgroupsRequestInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAlertgroupsRequestInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/observability/model_update_alertgroups_request_inner_rules_inner.go b/services/observability/model_update_alertgroups_request_inner_rules_inner.go new file mode 100644 index 000000000..65ea777ba --- /dev/null +++ b/services/observability/model_update_alertgroups_request_inner_rules_inner.go @@ -0,0 +1,319 @@ +/* +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 UpdateAlertgroupsRequestInnerRulesInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAlertgroupsRequestInnerRulesInner{} + +/* + types and functions for alert +*/ + +// isNotNullableString +type UpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType = *string + +func getUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeTypeOk(arg UpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType) (ret UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType(arg *UpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType, val UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType) { + *arg = &val +} + +type UpdateAlertgroupsRequestInnerRulesInnerGetAlertArgType = string +type UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType = string + +/* + types and functions for annotations +*/ + +// isFreeform +type UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType = *map[string]interface{} +type UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsArgType = map[string]interface{} +type UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType = map[string]interface{} + +func getUpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeTypeOk(arg UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType) (ret UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType(arg *UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType, val UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType) { + *arg = &val +} + +/* + types and functions for expr +*/ + +// isNotNullableString +type UpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType = *string + +func getUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeTypeOk(arg UpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType) (ret UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType(arg *UpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType, val UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType) { + *arg = &val +} + +type UpdateAlertgroupsRequestInnerRulesInnerGetExprArgType = string +type UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType = string + +/* + types and functions for for +*/ + +// isNotNullableString +type UpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType = *string + +func getUpdateAlertgroupsRequestInnerRulesInnerGetForAttributeTypeOk(arg UpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType) (ret UpdateAlertgroupsRequestInnerRulesInnerGetForRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType(arg *UpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType, val UpdateAlertgroupsRequestInnerRulesInnerGetForRetType) { + *arg = &val +} + +type UpdateAlertgroupsRequestInnerRulesInnerGetForArgType = string +type UpdateAlertgroupsRequestInnerRulesInnerGetForRetType = string + +/* + types and functions for labels +*/ + +// isFreeform +type UpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType = *map[string]interface{} +type UpdateAlertgroupsRequestInnerRulesInnerGetLabelsArgType = map[string]interface{} +type UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType = map[string]interface{} + +func getUpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeTypeOk(arg UpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType) (ret UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setUpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType(arg *UpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType, val UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType) { + *arg = &val +} + +// UpdateAlertgroupsRequestInnerRulesInner Alert rule. `Additional Validators:` * total config (all alert groups/rules) should not be bigger than 500000 characters as string since this the limitation of prometheus. +type UpdateAlertgroupsRequestInnerRulesInner struct { + // The name of the alert. `Additional Validators:` * is the identifier and so unique in the group * should only include the characters: a-zA-Z0-9- + // REQUIRED + Alert UpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType `json:"alert"` + // map of key:value. Annotations to add to each alert. `Additional Validators:` * should not contain more than 5 keys * each key and value should not be longer than 200 characters + Annotations UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType `json:"annotations,omitempty"` + // The PromQL expression to evaluate. Every evaluation cycle this is evaluated at the current time, and all resultant time series become pending/firing alerts. + // REQUIRED + Expr UpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType `json:"expr"` + // Alerts are considered firing once they have been returned for this long. Alerts which have not yet fired for long enough are considered pending. `Additional Validators:` * must be a valid time string + For UpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType `json:"for,omitempty"` + // map of key:value. Labels to add or overwrite for each alert. `Additional Validators:` * should not contain more than 10 keys * each key and value should not be longer than 200 characters + Labels UpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType `json:"labels,omitempty"` +} + +type _UpdateAlertgroupsRequestInnerRulesInner UpdateAlertgroupsRequestInnerRulesInner + +// NewUpdateAlertgroupsRequestInnerRulesInner instantiates a new UpdateAlertgroupsRequestInnerRulesInner 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 NewUpdateAlertgroupsRequestInnerRulesInner(alert UpdateAlertgroupsRequestInnerRulesInnerGetAlertArgType, expr UpdateAlertgroupsRequestInnerRulesInnerGetExprArgType) *UpdateAlertgroupsRequestInnerRulesInner { + this := UpdateAlertgroupsRequestInnerRulesInner{} + setUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType(&this.Alert, alert) + setUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType(&this.Expr, expr) + return &this +} + +// NewUpdateAlertgroupsRequestInnerRulesInnerWithDefaults instantiates a new UpdateAlertgroupsRequestInnerRulesInner 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 NewUpdateAlertgroupsRequestInnerRulesInnerWithDefaults() *UpdateAlertgroupsRequestInnerRulesInner { + this := UpdateAlertgroupsRequestInnerRulesInner{} + var for_ string = "0s" + this.For = &for_ + return &this +} + +// GetAlert returns the Alert field value +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetAlert() (ret UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType) { + ret, _ = o.GetAlertOk() + return ret +} + +// GetAlertOk returns a tuple with the Alert field value +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetAlertOk() (ret UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeTypeOk(o.Alert) +} + +// SetAlert sets field value +func (o *UpdateAlertgroupsRequestInnerRulesInner) SetAlert(v UpdateAlertgroupsRequestInnerRulesInnerGetAlertRetType) { + setUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeType(&o.Alert, v) +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetAnnotations() (res UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType) { + res, _ = o.GetAnnotationsOk() + return +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetAnnotationsOk() (ret UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeTypeOk(o.Annotations) +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) HasAnnotations() bool { + _, ok := o.GetAnnotationsOk() + return ok +} + +// SetAnnotations gets a reference to the given map[string]interface{} and assigns it to the Annotations field. +func (o *UpdateAlertgroupsRequestInnerRulesInner) SetAnnotations(v UpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsRetType) { + setUpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeType(&o.Annotations, v) +} + +// GetExpr returns the Expr field value +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetExpr() (ret UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType) { + ret, _ = o.GetExprOk() + return ret +} + +// GetExprOk returns a tuple with the Expr field value +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetExprOk() (ret UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeTypeOk(o.Expr) +} + +// SetExpr sets field value +func (o *UpdateAlertgroupsRequestInnerRulesInner) SetExpr(v UpdateAlertgroupsRequestInnerRulesInnerGetExprRetType) { + setUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeType(&o.Expr, v) +} + +// GetFor returns the For field value if set, zero value otherwise. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetFor() (res UpdateAlertgroupsRequestInnerRulesInnerGetForRetType) { + res, _ = o.GetForOk() + return +} + +// GetForOk returns a tuple with the For field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetForOk() (ret UpdateAlertgroupsRequestInnerRulesInnerGetForRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerRulesInnerGetForAttributeTypeOk(o.For) +} + +// HasFor returns a boolean if a field has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) HasFor() bool { + _, ok := o.GetForOk() + return ok +} + +// SetFor gets a reference to the given string and assigns it to the For field. +func (o *UpdateAlertgroupsRequestInnerRulesInner) SetFor(v UpdateAlertgroupsRequestInnerRulesInnerGetForRetType) { + setUpdateAlertgroupsRequestInnerRulesInnerGetForAttributeType(&o.For, v) +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetLabels() (res UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType) { + res, _ = o.GetLabelsOk() + return +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) GetLabelsOk() (ret UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType, ok bool) { + return getUpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeTypeOk(o.Labels) +} + +// HasLabels returns a boolean if a field has been set. +func (o *UpdateAlertgroupsRequestInnerRulesInner) HasLabels() bool { + _, ok := o.GetLabelsOk() + return ok +} + +// SetLabels gets a reference to the given map[string]interface{} and assigns it to the Labels field. +func (o *UpdateAlertgroupsRequestInnerRulesInner) SetLabels(v UpdateAlertgroupsRequestInnerRulesInnerGetLabelsRetType) { + setUpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeType(&o.Labels, v) +} + +func (o UpdateAlertgroupsRequestInnerRulesInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getUpdateAlertgroupsRequestInnerRulesInnerGetAlertAttributeTypeOk(o.Alert); ok { + toSerialize["Alert"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerRulesInnerGetAnnotationsAttributeTypeOk(o.Annotations); ok { + toSerialize["Annotations"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerRulesInnerGetExprAttributeTypeOk(o.Expr); ok { + toSerialize["Expr"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerRulesInnerGetForAttributeTypeOk(o.For); ok { + toSerialize["For"] = val + } + if val, ok := getUpdateAlertgroupsRequestInnerRulesInnerGetLabelsAttributeTypeOk(o.Labels); ok { + toSerialize["Labels"] = val + } + return toSerialize, nil +} + +type NullableUpdateAlertgroupsRequestInnerRulesInner struct { + value *UpdateAlertgroupsRequestInnerRulesInner + isSet bool +} + +func (v NullableUpdateAlertgroupsRequestInnerRulesInner) Get() *UpdateAlertgroupsRequestInnerRulesInner { + return v.value +} + +func (v *NullableUpdateAlertgroupsRequestInnerRulesInner) Set(val *UpdateAlertgroupsRequestInnerRulesInner) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAlertgroupsRequestInnerRulesInner) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAlertgroupsRequestInnerRulesInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAlertgroupsRequestInnerRulesInner(val *UpdateAlertgroupsRequestInnerRulesInner) *NullableUpdateAlertgroupsRequestInnerRulesInner { + return &NullableUpdateAlertgroupsRequestInnerRulesInner{value: val, isSet: true} +} + +func (v NullableUpdateAlertgroupsRequestInnerRulesInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAlertgroupsRequestInnerRulesInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} From 18f498a59e984a7c3c48cea1086ccaab0c057630 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Schmitz?= <152157960+bahkauv70@users.noreply.github.com> Date: Thu, 27 Mar 2025 13:17:26 +0100 Subject: [PATCH 2/2] feat: added changelogs for new release --- CHANGELOG.md | 7 +++++-- services/observability/CHANGELOG.md | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60dc97fca..d3af2bb65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,8 +44,11 @@ - **Internal:** Backwards compatible change to generated code - `objectstorage`: [v1.1.1](services/objectstorage/CHANGELOG.md#v111-2025-03-19) - **Internal:** Backwards compatible change to generated code -- `observability`: [v0.3.1](services/observability/CHANGELOG.md#v031-2025-03-19) - - **Internal:** Backwards compatible change to generated code +- `observability` + - [0.4.0](services/observability/CHANGELOG.md#v040-2025-03-27) + - **New:** Support for alert groups + - [v0.3.1](services/observability/CHANGELOG.md#v031-2025-03-19) + - **Internal:** Backwards compatible change to generated code - `opensearch`: [v0.20.1](services/opensearch/CHANGELOG.md#v0201-2025-03-19) - **Internal:** Backwards compatible change to generated code - `postgresflex`: [v1.0.2](services/postgresflex/CHANGELOG.md#v102-2025-03-19) diff --git a/services/observability/CHANGELOG.md b/services/observability/CHANGELOG.md index f5aaade2f..c21d619e3 100644 --- a/services/observability/CHANGELOG.md +++ b/services/observability/CHANGELOG.md @@ -1,3 +1,6 @@ +## v0.4.0 (2025-03-27) +- **New:** Support for alert groups + ## v0.3.1 (2025-03-19) - **Internal:** Backwards compatible change to generated code