diff --git a/services/logs/api_default.go b/services/logs/api_default.go index 87195df90..d79d6ad5a 100644 --- a/services/logs/api_default.go +++ b/services/logs/api_default.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -23,6 +24,7 @@ import ( "github.com/stackitcloud/stackit-sdk-go/core/oapierror" ) +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApi interface { /* CreateAccessToken Create Access Token @@ -44,6 +46,7 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return AccessToken + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) /* @@ -64,6 +67,7 @@ type DefaultApi interface { @param regionId The STACKIT region name the resource is located in. @return LogsInstance + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) /* @@ -81,6 +85,7 @@ type DefaultApi interface { /* DeleteAccessTokenExecute executes the request + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error /* @@ -103,6 +108,7 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return AccessTokenList + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) /* @@ -125,6 +131,7 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return AccessTokenList + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) /* @@ -141,6 +148,7 @@ type DefaultApi interface { /* DeleteLogsInstanceExecute executes the request + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error /* @@ -165,6 +173,7 @@ type DefaultApi interface { @param tId The access token UUID. @return AccessToken + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) /* @@ -187,6 +196,7 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return LogsInstance + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) /* @@ -209,6 +219,7 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return AccessTokenList + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) /* @@ -229,6 +240,7 @@ type DefaultApi interface { @param regionId The STACKIT region name the resource is located in. @return LogsInstancesList + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) /* @@ -246,6 +258,7 @@ type DefaultApi interface { /* UpdateAccessTokenExecute executes the request + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error /* @@ -268,65 +281,84 @@ type DefaultApi interface { @param instanceId The Logs Instance UUID. @return LogsInstance + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead */ UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiCreateAccessTokenRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest Execute() (*AccessToken, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiCreateLogsInstanceRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest Execute() (*LogsInstance, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteAccessTokenRequest interface { Execute() error } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteAllAccessTokensRequest interface { Execute() (*AccessTokenList, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteAllExpiredAccessTokensRequest interface { Execute() (*AccessTokenList, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiDeleteLogsInstanceRequest interface { Execute() error } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetAccessTokenRequest interface { Execute() (*AccessToken, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiGetLogsInstanceRequest interface { Execute() (*LogsInstance, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListAccessTokensRequest interface { Execute() (*AccessTokenList, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiListLogsInstancesRequest interface { Execute() (*LogsInstancesList, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiUpdateAccessTokenRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest Execute() error } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ApiUpdateLogsInstanceRequest interface { + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest Execute() (*LogsInstance, error) } // DefaultApiService DefaultApi service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DefaultApiService service +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenRequest struct { ctx context.Context apiService *DefaultApiService @@ -336,11 +368,13 @@ type CreateAccessTokenRequest struct { createAccessTokenPayload *CreateAccessTokenPayload } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { r.createAccessTokenPayload = &createAccessTokenPayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateAccessTokenRequest) Execute() (*AccessToken, error) { var ( localVarHTTPMethod = http.MethodPost @@ -451,7 +485,7 @@ func (r CreateAccessTokenRequest) Execute() (*AccessToken, error) { /* CreateAccessToken: Create Access Token -Create a new Logs instance access token +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -469,6 +503,7 @@ func (a *APIClient) CreateAccessToken(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) CreateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessToken, error) { r := CreateAccessTokenRequest{ apiService: a.defaultApi, @@ -480,6 +515,7 @@ func (a *APIClient) CreateAccessTokenExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstanceRequest struct { ctx context.Context apiService *DefaultApiService @@ -488,11 +524,13 @@ type CreateLogsInstanceRequest struct { createLogsInstancePayload *CreateLogsInstancePayload } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { r.createLogsInstancePayload = &createLogsInstancePayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r CreateLogsInstanceRequest) Execute() (*LogsInstance, error) { var ( localVarHTTPMethod = http.MethodPost @@ -602,7 +640,7 @@ func (r CreateLogsInstanceRequest) Execute() (*LogsInstance, error) { /* CreateLogsInstance: Create Logs instance -Creates a new Logs instance within the project. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -618,6 +656,7 @@ func (a *APIClient) CreateLogsInstance(ctx context.Context, projectId string, re } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) CreateLogsInstanceExecute(ctx context.Context, projectId string, regionId string) (*LogsInstance, error) { r := CreateLogsInstanceRequest{ apiService: a.defaultApi, @@ -628,6 +667,7 @@ func (a *APIClient) CreateLogsInstanceExecute(ctx context.Context, projectId str return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DeleteAccessTokenRequest struct { ctx context.Context apiService *DefaultApiService @@ -637,6 +677,7 @@ type DeleteAccessTokenRequest struct { tId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r DeleteAccessTokenRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete @@ -732,7 +773,7 @@ func (r DeleteAccessTokenRequest) Execute() error { /* DeleteAccessToken: Delete Access Token -Deletes a Logs instance access token +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -752,6 +793,7 @@ func (a *APIClient) DeleteAccessToken(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) DeleteAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { r := DeleteAccessTokenRequest{ apiService: a.defaultApi, @@ -764,6 +806,7 @@ func (a *APIClient) DeleteAccessTokenExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DeleteAllAccessTokensRequest struct { ctx context.Context apiService *DefaultApiService @@ -772,6 +815,7 @@ type DeleteAllAccessTokensRequest struct { instanceId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r DeleteAllAccessTokensRequest) Execute() (*AccessTokenList, error) { var ( localVarHTTPMethod = http.MethodDelete @@ -877,7 +921,7 @@ func (r DeleteAllAccessTokensRequest) Execute() (*AccessTokenList, error) { /* DeleteAllAccessTokens: Delete All Access Tokens -Deletes all access tokens available for a Logs instance +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -895,6 +939,7 @@ func (a *APIClient) DeleteAllAccessTokens(ctx context.Context, projectId string, } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) DeleteAllAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { r := DeleteAllAccessTokensRequest{ apiService: a.defaultApi, @@ -906,6 +951,7 @@ func (a *APIClient) DeleteAllAccessTokensExecute(ctx context.Context, projectId return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DeleteAllExpiredAccessTokensRequest struct { ctx context.Context apiService *DefaultApiService @@ -914,6 +960,7 @@ type DeleteAllExpiredAccessTokensRequest struct { instanceId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r DeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, error) { var ( localVarHTTPMethod = http.MethodDelete @@ -1019,7 +1066,7 @@ func (r DeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, error) /* DeleteAllExpiredAccessTokens: Deletes all expired access tokens -Deletes all expired access tokens +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1037,6 +1084,7 @@ func (a *APIClient) DeleteAllExpiredAccessTokens(ctx context.Context, projectId } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) DeleteAllExpiredAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { r := DeleteAllExpiredAccessTokensRequest{ apiService: a.defaultApi, @@ -1048,6 +1096,7 @@ func (a *APIClient) DeleteAllExpiredAccessTokensExecute(ctx context.Context, pro return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type DeleteLogsInstanceRequest struct { ctx context.Context apiService *DefaultApiService @@ -1056,6 +1105,7 @@ type DeleteLogsInstanceRequest struct { instanceId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r DeleteLogsInstanceRequest) Execute() error { var ( localVarHTTPMethod = http.MethodDelete @@ -1150,7 +1200,7 @@ func (r DeleteLogsInstanceRequest) Execute() error { /* DeleteLogsInstance: Delete Logs instance -Deletes the given Logs instance. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1168,6 +1218,7 @@ func (a *APIClient) DeleteLogsInstance(ctx context.Context, projectId string, re } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) DeleteLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) error { r := DeleteLogsInstanceRequest{ apiService: a.defaultApi, @@ -1179,6 +1230,7 @@ func (a *APIClient) DeleteLogsInstanceExecute(ctx context.Context, projectId str return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetAccessTokenRequest struct { ctx context.Context apiService *DefaultApiService @@ -1188,6 +1240,7 @@ type GetAccessTokenRequest struct { tId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r GetAccessTokenRequest) Execute() (*AccessToken, error) { var ( localVarHTTPMethod = http.MethodGet @@ -1294,7 +1347,7 @@ func (r GetAccessTokenRequest) Execute() (*AccessToken, error) { /* GetAccessToken: Get Access Token -Get the information of the given access token. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1314,6 +1367,7 @@ func (a *APIClient) GetAccessToken(ctx context.Context, projectId string, region } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) GetAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) (*AccessToken, error) { r := GetAccessTokenRequest{ apiService: a.defaultApi, @@ -1326,6 +1380,7 @@ func (a *APIClient) GetAccessTokenExecute(ctx context.Context, projectId string, return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type GetLogsInstanceRequest struct { ctx context.Context apiService *DefaultApiService @@ -1334,6 +1389,7 @@ type GetLogsInstanceRequest struct { instanceId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r GetLogsInstanceRequest) Execute() (*LogsInstance, error) { var ( localVarHTTPMethod = http.MethodGet @@ -1439,7 +1495,7 @@ func (r GetLogsInstanceRequest) Execute() (*LogsInstance, error) { /* GetLogsInstance: Get Logs Instance -Returns the details for the given Logs instance. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1457,6 +1513,7 @@ func (a *APIClient) GetLogsInstance(ctx context.Context, projectId string, regio } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) GetLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { r := GetLogsInstanceRequest{ apiService: a.defaultApi, @@ -1468,6 +1525,7 @@ func (a *APIClient) GetLogsInstanceExecute(ctx context.Context, projectId string return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListAccessTokensRequest struct { ctx context.Context apiService *DefaultApiService @@ -1476,6 +1534,7 @@ type ListAccessTokensRequest struct { instanceId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListAccessTokensRequest) Execute() (*AccessTokenList, error) { var ( localVarHTTPMethod = http.MethodGet @@ -1581,7 +1640,7 @@ func (r ListAccessTokensRequest) Execute() (*AccessTokenList, error) { /* ListAccessTokens: List Access Tokens -Returns a list of access tokens created for a Logs instance +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1599,6 +1658,7 @@ func (a *APIClient) ListAccessTokens(ctx context.Context, projectId string, regi } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) ListAccessTokensExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*AccessTokenList, error) { r := ListAccessTokensRequest{ apiService: a.defaultApi, @@ -1610,6 +1670,7 @@ func (a *APIClient) ListAccessTokensExecute(ctx context.Context, projectId strin return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type ListLogsInstancesRequest struct { ctx context.Context apiService *DefaultApiService @@ -1617,6 +1678,7 @@ type ListLogsInstancesRequest struct { regionId string } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r ListLogsInstancesRequest) Execute() (*LogsInstancesList, error) { var ( localVarHTTPMethod = http.MethodGet @@ -1721,7 +1783,7 @@ func (r ListLogsInstancesRequest) Execute() (*LogsInstancesList, error) { /* ListLogsInstances: List Logs instances -Returns a list of all Logs instances within the project. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1737,6 +1799,7 @@ func (a *APIClient) ListLogsInstances(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) ListLogsInstancesExecute(ctx context.Context, projectId string, regionId string) (*LogsInstancesList, error) { r := ListLogsInstancesRequest{ apiService: a.defaultApi, @@ -1747,6 +1810,7 @@ func (a *APIClient) ListLogsInstancesExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenRequest struct { ctx context.Context apiService *DefaultApiService @@ -1757,11 +1821,13 @@ type UpdateAccessTokenRequest struct { updateAccessTokenPayload *UpdateAccessTokenPayload } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r UpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { r.updateAccessTokenPayload = &updateAccessTokenPayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r UpdateAccessTokenRequest) Execute() error { var ( localVarHTTPMethod = http.MethodPut @@ -1862,7 +1928,7 @@ func (r UpdateAccessTokenRequest) Execute() error { /* UpdateAccessToken: Update Access Token -Updates the given access token. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -1882,6 +1948,7 @@ func (a *APIClient) UpdateAccessToken(ctx context.Context, projectId string, reg } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) UpdateAccessTokenExecute(ctx context.Context, projectId string, regionId string, instanceId string, tId string) error { r := UpdateAccessTokenRequest{ apiService: a.defaultApi, @@ -1894,6 +1961,7 @@ func (a *APIClient) UpdateAccessTokenExecute(ctx context.Context, projectId stri return r.Execute() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstanceRequest struct { ctx context.Context apiService *DefaultApiService @@ -1903,11 +1971,13 @@ type UpdateLogsInstanceRequest struct { updateLogsInstancePayload *UpdateLogsInstancePayload } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r UpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { r.updateLogsInstancePayload = &updateLogsInstancePayload return r } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (r UpdateLogsInstanceRequest) Execute() (*LogsInstance, error) { var ( localVarHTTPMethod = http.MethodPut @@ -2018,7 +2088,7 @@ func (r UpdateLogsInstanceRequest) Execute() (*LogsInstance, error) { /* UpdateLogsInstance: Update Logs instance -Updates the given Logs instance. +Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). @param projectId The STACKIT portal project UUID the resource is located in. @@ -2036,6 +2106,7 @@ func (a *APIClient) UpdateLogsInstance(ctx context.Context, projectId string, re } } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (a *APIClient) UpdateLogsInstanceExecute(ctx context.Context, projectId string, regionId string, instanceId string) (*LogsInstance, error) { r := UpdateLogsInstanceRequest{ apiService: a.defaultApi, diff --git a/services/logs/client.go b/services/logs/client.go index 3fe3dfd67..08f26c7d1 100644 --- a/services/logs/client.go +++ b/services/logs/client.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -44,18 +45,21 @@ var ( // APIClient manages communication with the STACKIT Logs API API v1.0.0 // In most cases there should be only one, shared, APIClient. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type APIClient struct { cfg *config.Configuration common service // Reuse a single struct instead of allocating one for each service on the heap. defaultApi *DefaultApiService } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type service struct { client DefaultApi } // NewAPIClient creates a new API client. // Optionally receives configuration options +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { cfg := NewConfiguration() @@ -147,6 +151,7 @@ func typeCheckParameter(obj interface{}, expected string, name string) error { return nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func ParameterValueToString(obj interface{}, key string) string { if reflect.TypeOf(obj).Kind() != reflect.Ptr { return fmt.Sprintf("%v", obj) @@ -285,6 +290,7 @@ func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { // Allow modification of underlying config for alternate implementations and testing // Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (c *APIClient) GetConfig() *config.Configuration { return c.cfg } @@ -595,6 +601,7 @@ func parseCacheControl(headers http.Header) cacheControl { } // CacheExpires helper function to determine remaining time before repeating a request. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func CacheExpires(r *http.Response) time.Time { // Figure out when the cache expires. var expires time.Time diff --git a/services/logs/configuration.go b/services/logs/configuration.go index 355caecfe..0213c4d3c 100644 --- a/services/logs/configuration.go +++ b/services/logs/configuration.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -15,6 +16,7 @@ import ( ) // NewConfiguration returns a new Configuration object +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewConfiguration() *config.Configuration { cfg := &config.Configuration{ DefaultHeader: make(map[string]string), diff --git a/services/logs/go.mod b/services/logs/go.mod index 526c7e821..94929d785 100644 --- a/services/logs/go.mod +++ b/services/logs/go.mod @@ -5,7 +5,7 @@ go 1.21 require ( github.com/google/go-cmp v0.7.0 github.com/google/uuid v1.6.0 - github.com/stackitcloud/stackit-sdk-go/core v0.21.1 + github.com/stackitcloud/stackit-sdk-go/core v0.22.0 ) require github.com/golang-jwt/jwt/v5 v5.3.1 // indirect diff --git a/services/logs/go.sum b/services/logs/go.sum index ca103c909..195011dd5 100644 --- a/services/logs/go.sum +++ b/services/logs/go.sum @@ -4,5 +4,5 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1 h1:Y/PcAgM7DPYMNqum0MLv4n1mF9ieuevzcCIZYQfm3Ts= -github.com/stackitcloud/stackit-sdk-go/core v0.21.1/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0 h1:6rViz7GnNwXSh51Lur5xuDzO8EWSZfN9J0HvEkBKq6c= +github.com/stackitcloud/stackit-sdk-go/core v0.22.0/go.mod h1:osMglDby4csGZ5sIfhNyYq1bS1TxIdPY88+skE/kkmI= diff --git a/services/logs/model_access_token.go b/services/logs/model_access_token.go index 540011bd2..640fdc04e 100644 --- a/services/logs/model_access_token.go +++ b/services/logs/model_access_token.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -24,8 +25,10 @@ var _ MappedNullable = &AccessToken{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetAccessTokenAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetAccessTokenAttributeTypeOk(arg AccessTokenGetAccessTokenAttributeType) (ret AccessTokenGetAccessTokenRetType, ok bool) { if arg == nil { return ret, false @@ -33,11 +36,15 @@ func getAccessTokenGetAccessTokenAttributeTypeOk(arg AccessTokenGetAccessTokenAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetAccessTokenAttributeType(arg *AccessTokenGetAccessTokenAttributeType, val AccessTokenGetAccessTokenRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetAccessTokenArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetAccessTokenRetType = string /* @@ -45,8 +52,10 @@ type AccessTokenGetAccessTokenRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetCreatorAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetCreatorAttributeTypeOk(arg AccessTokenGetCreatorAttributeType) (ret AccessTokenGetCreatorRetType, ok bool) { if arg == nil { return ret, false @@ -54,11 +63,15 @@ func getAccessTokenGetCreatorAttributeTypeOk(arg AccessTokenGetCreatorAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetCreatorAttributeType(arg *AccessTokenGetCreatorAttributeType, val AccessTokenGetCreatorRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetCreatorArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetCreatorRetType = string /* @@ -66,8 +79,10 @@ type AccessTokenGetCreatorRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetDescriptionAttributeTypeOk(arg AccessTokenGetDescriptionAttributeType) (ret AccessTokenGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -75,11 +90,15 @@ func getAccessTokenGetDescriptionAttributeTypeOk(arg AccessTokenGetDescriptionAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetDescriptionAttributeType(arg *AccessTokenGetDescriptionAttributeType, val AccessTokenGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDescriptionRetType = string /* @@ -87,8 +106,10 @@ type AccessTokenGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetDisplayNameAttributeTypeOk(arg AccessTokenGetDisplayNameAttributeType) (ret AccessTokenGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -96,11 +117,15 @@ func getAccessTokenGetDisplayNameAttributeTypeOk(arg AccessTokenGetDisplayNameAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetDisplayNameAttributeType(arg *AccessTokenGetDisplayNameAttributeType, val AccessTokenGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetDisplayNameRetType = string /* @@ -108,10 +133,16 @@ type AccessTokenGetDisplayNameRetType = string */ // isBoolean +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokengetExpiresAttributeType = *bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokengetExpiresArgType = bool + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokengetExpiresRetType = bool +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokengetExpiresAttributeTypeOk(arg AccessTokengetExpiresAttributeType) (ret AccessTokengetExpiresRetType, ok bool) { if arg == nil { return ret, false @@ -119,6 +150,7 @@ func getAccessTokengetExpiresAttributeTypeOk(arg AccessTokengetExpiresAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokengetExpiresAttributeType(arg *AccessTokengetExpiresAttributeType, val AccessTokengetExpiresRetType) { *arg = &val } @@ -128,8 +160,10 @@ func setAccessTokengetExpiresAttributeType(arg *AccessTokengetExpiresAttributeTy */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetIdAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetIdAttributeTypeOk(arg AccessTokenGetIdAttributeType) (ret AccessTokenGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -137,11 +171,15 @@ func getAccessTokenGetIdAttributeTypeOk(arg AccessTokenGetIdAttributeType) (ret return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetIdAttributeType(arg *AccessTokenGetIdAttributeType, val AccessTokenGetIdRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetIdRetType = string /* @@ -149,10 +187,16 @@ type AccessTokenGetIdRetType = string */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetPermissionsAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetPermissionsArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetPermissionsRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetPermissionsAttributeTypeOk(arg AccessTokenGetPermissionsAttributeType) (ret AccessTokenGetPermissionsRetType, ok bool) { if arg == nil { return ret, false @@ -160,6 +204,7 @@ func getAccessTokenGetPermissionsAttributeTypeOk(arg AccessTokenGetPermissionsAt return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetPermissionsAttributeType(arg *AccessTokenGetPermissionsAttributeType, val AccessTokenGetPermissionsRetType) { *arg = &val } @@ -172,20 +217,25 @@ func setAccessTokenGetPermissionsAttributeType(arg *AccessTokenGetPermissionsAtt // AccessTokenStatus the model 'AccessToken' // value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenStatus string // List of Status const ( - ACCESSTOKENSTATUS_ACTIVE AccessTokenStatus = "active" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + ACCESSTOKENSTATUS_ACTIVE AccessTokenStatus = "active" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead ACCESSTOKENSTATUS_EXPIRED AccessTokenStatus = "expired" ) // All allowed values of AccessToken enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead var AllowedAccessTokenStatusEnumValues = []AccessTokenStatus{ "active", "expired", } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *AccessTokenStatus) UnmarshalJSON(src []byte) error { // use a type alias to prevent infinite recursion during unmarshal, // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers @@ -213,6 +263,7 @@ func (v *AccessTokenStatus) UnmarshalJSON(src []byte) error { // NewAccessTokenStatusFromValue returns a pointer to a valid AccessTokenStatus // for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAccessTokenStatusFromValue(v AccessTokenStatus) (*AccessTokenStatus, error) { ev := AccessTokenStatus(v) if ev.IsValid() { @@ -223,6 +274,7 @@ func NewAccessTokenStatusFromValue(v AccessTokenStatus) (*AccessTokenStatus, err } // IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v AccessTokenStatus) IsValid() bool { for _, existing := range AllowedAccessTokenStatusEnumValues { if existing == v { @@ -233,50 +285,65 @@ func (v AccessTokenStatus) IsValid() bool { } // Ptr returns reference to StatusStatus value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v AccessTokenStatus) Ptr() *AccessTokenStatus { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableAccessTokenStatus struct { value *AccessTokenStatus isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenStatus) Get() *AccessTokenStatus { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenStatus) Set(val *AccessTokenStatus) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenStatus) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenStatus) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableAccessTokenStatus(val *AccessTokenStatus) *NullableAccessTokenStatus { return &NullableAccessTokenStatus{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetStatusAttributeType = *AccessTokenStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetStatusArgType = AccessTokenStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetStatusRetType = AccessTokenStatus +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetStatusAttributeTypeOk(arg AccessTokenGetStatusAttributeType) (ret AccessTokenGetStatusRetType, ok bool) { if arg == nil { return ret, false @@ -284,6 +351,7 @@ func getAccessTokenGetStatusAttributeTypeOk(arg AccessTokenGetStatusAttributeTyp return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetStatusAttributeType(arg *AccessTokenGetStatusAttributeType, val AccessTokenGetStatusRetType) { *arg = &val } @@ -293,10 +361,16 @@ func setAccessTokenGetStatusAttributeType(arg *AccessTokenGetStatusAttributeType */ // isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetValidUntilAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetValidUntilArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenGetValidUntilRetType = time.Time +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenGetValidUntilAttributeTypeOk(arg AccessTokenGetValidUntilAttributeType) (ret AccessTokenGetValidUntilRetType, ok bool) { if arg == nil { return ret, false @@ -304,11 +378,13 @@ func getAccessTokenGetValidUntilAttributeTypeOk(arg AccessTokenGetValidUntilAttr return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenGetValidUntilAttributeType(arg *AccessTokenGetValidUntilAttributeType, val AccessTokenGetValidUntilRetType) { *arg = &val } // AccessToken struct for AccessToken +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessToken struct { // A generated access token. Only available on creation. AccessToken AccessTokenGetAccessTokenAttributeType `json:"accessToken,omitempty"` @@ -335,12 +411,14 @@ type AccessToken struct { ValidUntil AccessTokenGetValidUntilAttributeType `json:"validUntil,omitempty"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _AccessToken AccessToken // NewAccessToken instantiates a new AccessToken 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAccessToken(creator AccessTokenGetCreatorArgType, displayName AccessTokenGetDisplayNameArgType, expires AccessTokengetExpiresArgType, id AccessTokenGetIdArgType, permissions AccessTokenGetPermissionsArgType, status AccessTokenGetStatusArgType) *AccessToken { this := AccessToken{} setAccessTokenGetCreatorAttributeType(&this.Creator, creator) @@ -355,12 +433,14 @@ func NewAccessToken(creator AccessTokenGetCreatorArgType, displayName AccessToke // NewAccessTokenWithDefaults instantiates a new AccessToken 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAccessTokenWithDefaults() *AccessToken { this := AccessToken{} return &this } // GetAccessToken returns the AccessToken field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetAccessToken() (res AccessTokenGetAccessTokenRetType) { res, _ = o.GetAccessTokenOk() return @@ -368,22 +448,26 @@ func (o *AccessToken) GetAccessToken() (res AccessTokenGetAccessTokenRetType) { // GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetAccessTokenOk() (ret AccessTokenGetAccessTokenRetType, ok bool) { return getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken) } // HasAccessToken returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) HasAccessToken() bool { _, ok := o.GetAccessTokenOk() return ok } // SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetAccessToken(v AccessTokenGetAccessTokenRetType) { setAccessTokenGetAccessTokenAttributeType(&o.AccessToken, v) } // GetCreator returns the Creator field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetCreator() (ret AccessTokenGetCreatorRetType) { ret, _ = o.GetCreatorOk() return ret @@ -391,16 +475,19 @@ func (o *AccessToken) GetCreator() (ret AccessTokenGetCreatorRetType) { // GetCreatorOk returns a tuple with the Creator field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetCreatorOk() (ret AccessTokenGetCreatorRetType, ok bool) { return getAccessTokenGetCreatorAttributeTypeOk(o.Creator) } // SetCreator sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetCreator(v AccessTokenGetCreatorRetType) { setAccessTokenGetCreatorAttributeType(&o.Creator, v) } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetDescription() (res AccessTokenGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -408,22 +495,26 @@ func (o *AccessToken) GetDescription() (res AccessTokenGetDescriptionRetType) { // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetDescriptionOk() (ret AccessTokenGetDescriptionRetType, ok bool) { return getAccessTokenGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetDescription(v AccessTokenGetDescriptionRetType) { setAccessTokenGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetDisplayName() (ret AccessTokenGetDisplayNameRetType) { ret, _ = o.GetDisplayNameOk() return ret @@ -431,16 +522,19 @@ func (o *AccessToken) GetDisplayName() (ret AccessTokenGetDisplayNameRetType) { // GetDisplayNameOk returns a tuple with the DisplayName field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetDisplayNameOk() (ret AccessTokenGetDisplayNameRetType, ok bool) { return getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName) } // SetDisplayName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetDisplayName(v AccessTokenGetDisplayNameRetType) { setAccessTokenGetDisplayNameAttributeType(&o.DisplayName, v) } // GetExpires returns the Expires field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetExpires() (ret AccessTokengetExpiresRetType) { ret, _ = o.GetExpiresOk() return ret @@ -448,16 +542,19 @@ func (o *AccessToken) GetExpires() (ret AccessTokengetExpiresRetType) { // GetExpiresOk returns a tuple with the Expires field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetExpiresOk() (ret AccessTokengetExpiresRetType, ok bool) { return getAccessTokengetExpiresAttributeTypeOk(o.Expires) } // SetExpires sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetExpires(v AccessTokengetExpiresRetType) { setAccessTokengetExpiresAttributeType(&o.Expires, v) } // GetId returns the Id field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetId() (ret AccessTokenGetIdRetType) { ret, _ = o.GetIdOk() return ret @@ -465,16 +562,19 @@ func (o *AccessToken) GetId() (ret AccessTokenGetIdRetType) { // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetIdOk() (ret AccessTokenGetIdRetType, ok bool) { return getAccessTokenGetIdAttributeTypeOk(o.Id) } // SetId sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetId(v AccessTokenGetIdRetType) { setAccessTokenGetIdAttributeType(&o.Id, v) } // GetPermissions returns the Permissions field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetPermissions() (ret AccessTokenGetPermissionsRetType) { ret, _ = o.GetPermissionsOk() return ret @@ -482,16 +582,19 @@ func (o *AccessToken) GetPermissions() (ret AccessTokenGetPermissionsRetType) { // GetPermissionsOk returns a tuple with the Permissions field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetPermissionsOk() (ret AccessTokenGetPermissionsRetType, ok bool) { return getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions) } // SetPermissions sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetPermissions(v AccessTokenGetPermissionsRetType) { setAccessTokenGetPermissionsAttributeType(&o.Permissions, v) } // GetStatus returns the Status field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetStatus() (ret AccessTokenGetStatusRetType) { ret, _ = o.GetStatusOk() return ret @@ -499,16 +602,19 @@ func (o *AccessToken) GetStatus() (ret AccessTokenGetStatusRetType) { // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetStatusOk() (ret AccessTokenGetStatusRetType, ok bool) { return getAccessTokenGetStatusAttributeTypeOk(o.Status) } // SetStatus sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetStatus(v AccessTokenGetStatusRetType) { setAccessTokenGetStatusAttributeType(&o.Status, v) } // GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetValidUntil() (res AccessTokenGetValidUntilRetType) { res, _ = o.GetValidUntilOk() return @@ -516,21 +622,25 @@ func (o *AccessToken) GetValidUntil() (res AccessTokenGetValidUntilRetType) { // GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) GetValidUntilOk() (ret AccessTokenGetValidUntilRetType, ok bool) { return getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil) } // HasValidUntil returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) HasValidUntil() bool { _, ok := o.GetValidUntilOk() return ok } // SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessToken) SetValidUntil(v AccessTokenGetValidUntilRetType) { setAccessTokenGetValidUntilAttributeType(&o.ValidUntil, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o AccessToken) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken); ok { @@ -563,37 +673,45 @@ func (o AccessToken) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableAccessToken struct { value *AccessToken isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessToken) Get() *AccessToken { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessToken) Set(val *AccessToken) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessToken) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessToken) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { return &NullableAccessToken{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessToken) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_access_token_list.go b/services/logs/model_access_token_list.go index 7ea5e1633..09559d7c5 100644 --- a/services/logs/model_access_token_list.go +++ b/services/logs/model_access_token_list.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &AccessTokenList{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenListGetTokensAttributeType = *[]AccessToken + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenListGetTokensArgType = []AccessToken + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenListGetTokensRetType = []AccessToken +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getAccessTokenListGetTokensAttributeTypeOk(arg AccessTokenListGetTokensAttributeType) (ret AccessTokenListGetTokensRetType, ok bool) { if arg == nil { return ret, false @@ -33,22 +40,26 @@ func getAccessTokenListGetTokensAttributeTypeOk(arg AccessTokenListGetTokensAttr return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setAccessTokenListGetTokensAttributeType(arg *AccessTokenListGetTokensAttributeType, val AccessTokenListGetTokensRetType) { *arg = &val } // AccessTokenList struct for AccessTokenList +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type AccessTokenList struct { // REQUIRED Tokens AccessTokenListGetTokensAttributeType `json:"tokens" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _AccessTokenList AccessTokenList // NewAccessTokenList instantiates a new AccessTokenList 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAccessTokenList(tokens AccessTokenListGetTokensArgType) *AccessTokenList { this := AccessTokenList{} setAccessTokenListGetTokensAttributeType(&this.Tokens, tokens) @@ -58,12 +69,14 @@ func NewAccessTokenList(tokens AccessTokenListGetTokensArgType) *AccessTokenList // NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewAccessTokenListWithDefaults() *AccessTokenList { this := AccessTokenList{} return &this } // GetTokens returns the Tokens field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessTokenList) GetTokens() (ret AccessTokenListGetTokensRetType) { ret, _ = o.GetTokensOk() return ret @@ -71,15 +84,18 @@ func (o *AccessTokenList) GetTokens() (ret AccessTokenListGetTokensRetType) { // GetTokensOk returns a tuple with the Tokens field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessTokenList) GetTokensOk() (ret AccessTokenListGetTokensRetType, ok bool) { return getAccessTokenListGetTokensAttributeTypeOk(o.Tokens) } // SetTokens sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *AccessTokenList) SetTokens(v AccessTokenListGetTokensRetType) { setAccessTokenListGetTokensAttributeType(&o.Tokens, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o AccessTokenList) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getAccessTokenListGetTokensAttributeTypeOk(o.Tokens); ok { @@ -88,37 +104,45 @@ func (o AccessTokenList) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableAccessTokenList struct { value *AccessTokenList isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenList) Get() *AccessTokenList { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenList) Set(val *AccessTokenList) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenList) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenList) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { return &NullableAccessTokenList{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_create_access_token_payload.go b/services/logs/model_create_access_token_payload.go index edd823a2a..c97370d1f 100644 --- a/services/logs/model_create_access_token_payload.go +++ b/services/logs/model_create_access_token_payload.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &CreateAccessTokenPayload{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg CreateAccessTokenPayloadGetDescriptionAttributeType) (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg CreateAccessTo return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateAccessTokenPayloadGetDescriptionAttributeType(arg *CreateAccessTokenPayloadGetDescriptionAttributeType, val CreateAccessTokenPayloadGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDescriptionRetType = string /* @@ -43,8 +50,10 @@ type CreateAccessTokenPayloadGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg CreateAccessTokenPayloadGetDisplayNameAttributeType) (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -52,11 +61,15 @@ func getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg CreateAccessTo return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateAccessTokenPayloadGetDisplayNameAttributeType(arg *CreateAccessTokenPayloadGetDisplayNameAttributeType, val CreateAccessTokenPayloadGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetDisplayNameRetType = string /* @@ -64,10 +77,16 @@ type CreateAccessTokenPayloadGetDisplayNameRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetLifetimeAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetLifetimeArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetLifetimeRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(arg CreateAccessTokenPayloadGetLifetimeAttributeType) (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { if arg == nil { return ret, false @@ -75,6 +94,7 @@ func getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(arg CreateAccessToken return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateAccessTokenPayloadGetLifetimeAttributeType(arg *CreateAccessTokenPayloadGetLifetimeAttributeType, val CreateAccessTokenPayloadGetLifetimeRetType) { *arg = &val } @@ -84,10 +104,16 @@ func setCreateAccessTokenPayloadGetLifetimeAttributeType(arg *CreateAccessTokenP */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetPermissionsAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetPermissionsArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayloadGetPermissionsRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(arg CreateAccessTokenPayloadGetPermissionsAttributeType) (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { if arg == nil { return ret, false @@ -95,11 +121,13 @@ func getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(arg CreateAccessTo return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateAccessTokenPayloadGetPermissionsAttributeType(arg *CreateAccessTokenPayloadGetPermissionsAttributeType, val CreateAccessTokenPayloadGetPermissionsRetType) { *arg = &val } // CreateAccessTokenPayload struct for CreateAccessTokenPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateAccessTokenPayload struct { // The description of the access token. Description CreateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` @@ -114,12 +142,14 @@ type CreateAccessTokenPayload struct { Permissions CreateAccessTokenPayloadGetPermissionsAttributeType `json:"permissions" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _CreateAccessTokenPayload CreateAccessTokenPayload // NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateAccessTokenPayload(displayName CreateAccessTokenPayloadGetDisplayNameArgType, permissions CreateAccessTokenPayloadGetPermissionsArgType) *CreateAccessTokenPayload { this := CreateAccessTokenPayload{} setCreateAccessTokenPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) @@ -130,12 +160,14 @@ func NewCreateAccessTokenPayload(displayName CreateAccessTokenPayloadGetDisplayN // NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { this := CreateAccessTokenPayload{} return &this } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetDescription() (res CreateAccessTokenPayloadGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -143,22 +175,26 @@ func (o *CreateAccessTokenPayload) GetDescription() (res CreateAccessTokenPayloa // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetDescriptionOk() (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) { return getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) SetDescription(v CreateAccessTokenPayloadGetDescriptionRetType) { setCreateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetDisplayName() (ret CreateAccessTokenPayloadGetDisplayNameRetType) { ret, _ = o.GetDisplayNameOk() return ret @@ -166,16 +202,19 @@ func (o *CreateAccessTokenPayload) GetDisplayName() (ret CreateAccessTokenPayloa // GetDisplayNameOk returns a tuple with the DisplayName field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetDisplayNameOk() (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) { return getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) } // SetDisplayName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) SetDisplayName(v CreateAccessTokenPayloadGetDisplayNameRetType) { setCreateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) } // GetLifetime returns the Lifetime field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetLifetime() (res CreateAccessTokenPayloadGetLifetimeRetType) { res, _ = o.GetLifetimeOk() return @@ -183,22 +222,26 @@ func (o *CreateAccessTokenPayload) GetLifetime() (res CreateAccessTokenPayloadGe // GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetLifetimeOk() (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) { return getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime) } // HasLifetime returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) HasLifetime() bool { _, ok := o.GetLifetimeOk() return ok } // SetLifetime gets a reference to the given int64 and assigns it to the Lifetime field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) SetLifetime(v CreateAccessTokenPayloadGetLifetimeRetType) { setCreateAccessTokenPayloadGetLifetimeAttributeType(&o.Lifetime, v) } // GetPermissions returns the Permissions field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetPermissions() (ret CreateAccessTokenPayloadGetPermissionsRetType) { ret, _ = o.GetPermissionsOk() return ret @@ -206,15 +249,18 @@ func (o *CreateAccessTokenPayload) GetPermissions() (ret CreateAccessTokenPayloa // GetPermissionsOk returns a tuple with the Permissions field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) GetPermissionsOk() (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) { return getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions) } // SetPermissions sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateAccessTokenPayload) SetPermissions(v CreateAccessTokenPayloadGetPermissionsRetType) { setCreateAccessTokenPayloadGetPermissionsAttributeType(&o.Permissions, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { @@ -232,37 +278,45 @@ func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCreateAccessTokenPayload struct { value *CreateAccessTokenPayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateAccessTokenPayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateAccessTokenPayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { return &NullableCreateAccessTokenPayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_create_logs_instance_payload.go b/services/logs/model_create_logs_instance_payload.go index ef320fe38..bdc269faf 100644 --- a/services/logs/model_create_logs_instance_payload.go +++ b/services/logs/model_create_logs_instance_payload.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &CreateLogsInstancePayload{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetAclAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetAclArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetAclRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateLogsInstancePayloadGetAclAttributeTypeOk(arg CreateLogsInstancePayloadGetAclAttributeType) (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { if arg == nil { return ret, false @@ -33,6 +40,7 @@ func getCreateLogsInstancePayloadGetAclAttributeTypeOk(arg CreateLogsInstancePay return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateLogsInstancePayloadGetAclAttributeType(arg *CreateLogsInstancePayloadGetAclAttributeType, val CreateLogsInstancePayloadGetAclRetType) { *arg = &val } @@ -42,8 +50,10 @@ func setCreateLogsInstancePayloadGetAclAttributeType(arg *CreateLogsInstancePayl */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg CreateLogsInstancePayloadGetDescriptionAttributeType) (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -51,11 +61,15 @@ func getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg CreateLogsIns return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateLogsInstancePayloadGetDescriptionAttributeType(arg *CreateLogsInstancePayloadGetDescriptionAttributeType, val CreateLogsInstancePayloadGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDescriptionRetType = string /* @@ -63,8 +77,10 @@ type CreateLogsInstancePayloadGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateLogsInstancePayloadGetDisplayNameAttributeType) (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -72,11 +88,15 @@ func getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateLogsIns return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateLogsInstancePayloadGetDisplayNameAttributeType(arg *CreateLogsInstancePayloadGetDisplayNameAttributeType, val CreateLogsInstancePayloadGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetDisplayNameRetType = string /* @@ -84,10 +104,16 @@ type CreateLogsInstancePayloadGetDisplayNameRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetRetentionDaysArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayloadGetRetentionDaysRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg CreateLogsInstancePayloadGetRetentionDaysAttributeType) (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { if arg == nil { return ret, false @@ -95,11 +121,13 @@ func getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg CreateLogsI return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setCreateLogsInstancePayloadGetRetentionDaysAttributeType(arg *CreateLogsInstancePayloadGetRetentionDaysAttributeType, val CreateLogsInstancePayloadGetRetentionDaysRetType) { *arg = &val } // CreateLogsInstancePayload struct for CreateLogsInstancePayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type CreateLogsInstancePayload struct { // The access control list for the Logs instance. Acl CreateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` @@ -114,12 +142,14 @@ type CreateLogsInstancePayload struct { RetentionDays CreateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _CreateLogsInstancePayload CreateLogsInstancePayload // NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateLogsInstancePayload(displayName CreateLogsInstancePayloadGetDisplayNameArgType, retentionDays CreateLogsInstancePayloadGetRetentionDaysArgType) *CreateLogsInstancePayload { this := CreateLogsInstancePayload{} setCreateLogsInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName) @@ -130,12 +160,14 @@ func NewCreateLogsInstancePayload(displayName CreateLogsInstancePayloadGetDispla // NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { this := CreateLogsInstancePayload{} return &this } // GetAcl returns the Acl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetAcl() (res CreateLogsInstancePayloadGetAclRetType) { res, _ = o.GetAclOk() return @@ -143,22 +175,26 @@ func (o *CreateLogsInstancePayload) GetAcl() (res CreateLogsInstancePayloadGetAc // GetAclOk returns a tuple with the Acl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetAclOk() (ret CreateLogsInstancePayloadGetAclRetType, ok bool) { return getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) } // HasAcl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) HasAcl() bool { _, ok := o.GetAclOk() return ok } // SetAcl gets a reference to the given []string and assigns it to the Acl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) SetAcl(v CreateLogsInstancePayloadGetAclRetType) { setCreateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetDescription() (res CreateLogsInstancePayloadGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -166,22 +202,26 @@ func (o *CreateLogsInstancePayload) GetDescription() (res CreateLogsInstancePayl // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetDescriptionOk() (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) { return getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) SetDescription(v CreateLogsInstancePayloadGetDescriptionRetType) { setCreateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetDisplayName() (ret CreateLogsInstancePayloadGetDisplayNameRetType) { ret, _ = o.GetDisplayNameOk() return ret @@ -189,16 +229,19 @@ func (o *CreateLogsInstancePayload) GetDisplayName() (ret CreateLogsInstancePayl // GetDisplayNameOk returns a tuple with the DisplayName field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetDisplayNameOk() (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) { return getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) } // SetDisplayName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) SetDisplayName(v CreateLogsInstancePayloadGetDisplayNameRetType) { setCreateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) } // GetRetentionDays returns the RetentionDays field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetRetentionDays() (ret CreateLogsInstancePayloadGetRetentionDaysRetType) { ret, _ = o.GetRetentionDaysOk() return ret @@ -206,15 +249,18 @@ func (o *CreateLogsInstancePayload) GetRetentionDays() (ret CreateLogsInstancePa // GetRetentionDaysOk returns a tuple with the RetentionDays field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { return getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) } // SetRetentionDays sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *CreateLogsInstancePayload) SetRetentionDays(v CreateLogsInstancePayloadGetRetentionDaysRetType) { setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { @@ -232,37 +278,45 @@ func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableCreateLogsInstancePayload struct { value *CreateLogsInstancePayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateLogsInstancePayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateLogsInstancePayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { return &NullableCreateLogsInstancePayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_logs_instance.go b/services/logs/model_logs_instance.go index dbb4034ea..6bd1b6d8d 100644 --- a/services/logs/model_logs_instance.go +++ b/services/logs/model_logs_instance.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -24,10 +25,16 @@ var _ MappedNullable = &LogsInstance{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetAclAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetAclArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetAclRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetAclAttributeTypeOk(arg LogsInstanceGetAclAttributeType) (ret LogsInstanceGetAclRetType, ok bool) { if arg == nil { return ret, false @@ -35,6 +42,7 @@ func getLogsInstanceGetAclAttributeTypeOk(arg LogsInstanceGetAclAttributeType) ( return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetAclAttributeType(arg *LogsInstanceGetAclAttributeType, val LogsInstanceGetAclRetType) { *arg = &val } @@ -44,10 +52,16 @@ func setLogsInstanceGetAclAttributeType(arg *LogsInstanceGetAclAttributeType, va */ // isDateTime +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetCreatedAttributeType = *time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetCreatedArgType = time.Time + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetCreatedRetType = time.Time +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetCreatedAttributeTypeOk(arg LogsInstanceGetCreatedAttributeType) (ret LogsInstanceGetCreatedRetType, ok bool) { if arg == nil { return ret, false @@ -55,6 +69,7 @@ func getLogsInstanceGetCreatedAttributeTypeOk(arg LogsInstanceGetCreatedAttribut return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetCreatedAttributeType(arg *LogsInstanceGetCreatedAttributeType, val LogsInstanceGetCreatedRetType) { *arg = &val } @@ -64,8 +79,10 @@ func setLogsInstanceGetCreatedAttributeType(arg *LogsInstanceGetCreatedAttribute */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDatasourceUrlAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetDatasourceUrlAttributeTypeOk(arg LogsInstanceGetDatasourceUrlAttributeType) (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { if arg == nil { return ret, false @@ -73,11 +90,15 @@ func getLogsInstanceGetDatasourceUrlAttributeTypeOk(arg LogsInstanceGetDatasourc return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetDatasourceUrlAttributeType(arg *LogsInstanceGetDatasourceUrlAttributeType, val LogsInstanceGetDatasourceUrlRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDatasourceUrlArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDatasourceUrlRetType = string /* @@ -85,8 +106,10 @@ type LogsInstanceGetDatasourceUrlRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetDescriptionAttributeTypeOk(arg LogsInstanceGetDescriptionAttributeType) (ret LogsInstanceGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -94,11 +117,15 @@ func getLogsInstanceGetDescriptionAttributeTypeOk(arg LogsInstanceGetDescription return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetDescriptionAttributeType(arg *LogsInstanceGetDescriptionAttributeType, val LogsInstanceGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDescriptionRetType = string /* @@ -106,8 +133,10 @@ type LogsInstanceGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetDisplayNameAttributeTypeOk(arg LogsInstanceGetDisplayNameAttributeType) (ret LogsInstanceGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -115,11 +144,15 @@ func getLogsInstanceGetDisplayNameAttributeTypeOk(arg LogsInstanceGetDisplayName return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetDisplayNameAttributeType(arg *LogsInstanceGetDisplayNameAttributeType, val LogsInstanceGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetDisplayNameRetType = string /* @@ -127,8 +160,10 @@ type LogsInstanceGetDisplayNameRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIdAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetIdAttributeTypeOk(arg LogsInstanceGetIdAttributeType) (ret LogsInstanceGetIdRetType, ok bool) { if arg == nil { return ret, false @@ -136,11 +171,15 @@ func getLogsInstanceGetIdAttributeTypeOk(arg LogsInstanceGetIdAttributeType) (re return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetIdAttributeType(arg *LogsInstanceGetIdAttributeType, val LogsInstanceGetIdRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIdArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIdRetType = string /* @@ -148,8 +187,10 @@ type LogsInstanceGetIdRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestOtlpUrlAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(arg LogsInstanceGetIngestOtlpUrlAttributeType) (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { if arg == nil { return ret, false @@ -157,11 +198,15 @@ func getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(arg LogsInstanceGetIngestOtl return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetIngestOtlpUrlAttributeType(arg *LogsInstanceGetIngestOtlpUrlAttributeType, val LogsInstanceGetIngestOtlpUrlRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestOtlpUrlArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestOtlpUrlRetType = string /* @@ -169,8 +214,10 @@ type LogsInstanceGetIngestOtlpUrlRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestUrlAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetIngestUrlAttributeTypeOk(arg LogsInstanceGetIngestUrlAttributeType) (ret LogsInstanceGetIngestUrlRetType, ok bool) { if arg == nil { return ret, false @@ -178,11 +225,15 @@ func getLogsInstanceGetIngestUrlAttributeTypeOk(arg LogsInstanceGetIngestUrlAttr return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetIngestUrlAttributeType(arg *LogsInstanceGetIngestUrlAttributeType, val LogsInstanceGetIngestUrlRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestUrlArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetIngestUrlRetType = string /* @@ -190,8 +241,10 @@ type LogsInstanceGetIngestUrlRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryRangeUrlAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetQueryRangeUrlAttributeTypeOk(arg LogsInstanceGetQueryRangeUrlAttributeType) (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { if arg == nil { return ret, false @@ -199,11 +252,15 @@ func getLogsInstanceGetQueryRangeUrlAttributeTypeOk(arg LogsInstanceGetQueryRang return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetQueryRangeUrlAttributeType(arg *LogsInstanceGetQueryRangeUrlAttributeType, val LogsInstanceGetQueryRangeUrlRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryRangeUrlArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryRangeUrlRetType = string /* @@ -211,8 +268,10 @@ type LogsInstanceGetQueryRangeUrlRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryUrlAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetQueryUrlAttributeTypeOk(arg LogsInstanceGetQueryUrlAttributeType) (ret LogsInstanceGetQueryUrlRetType, ok bool) { if arg == nil { return ret, false @@ -220,11 +279,15 @@ func getLogsInstanceGetQueryUrlAttributeTypeOk(arg LogsInstanceGetQueryUrlAttrib return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetQueryUrlAttributeType(arg *LogsInstanceGetQueryUrlAttributeType, val LogsInstanceGetQueryUrlRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryUrlArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetQueryUrlRetType = string /* @@ -232,10 +295,16 @@ type LogsInstanceGetQueryUrlRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetRetentionDaysAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetRetentionDaysArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetRetentionDaysRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetRetentionDaysAttributeTypeOk(arg LogsInstanceGetRetentionDaysAttributeType) (ret LogsInstanceGetRetentionDaysRetType, ok bool) { if arg == nil { return ret, false @@ -243,6 +312,7 @@ func getLogsInstanceGetRetentionDaysAttributeTypeOk(arg LogsInstanceGetRetention return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetRetentionDaysAttributeType(arg *LogsInstanceGetRetentionDaysAttributeType, val LogsInstanceGetRetentionDaysRetType) { *arg = &val } @@ -255,22 +325,28 @@ func setLogsInstanceGetRetentionDaysAttributeType(arg *LogsInstanceGetRetentionD // LogsInstanceStatus The current status of the Logs instance. // value type for enums +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceStatus string // List of Status const ( - LOGSINSTANCESTATUS_ACTIVE LogsInstanceStatus = "active" - LOGSINSTANCESTATUS_DELETING LogsInstanceStatus = "deleting" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + LOGSINSTANCESTATUS_ACTIVE LogsInstanceStatus = "active" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead + LOGSINSTANCESTATUS_DELETING LogsInstanceStatus = "deleting" + // Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead LOGSINSTANCESTATUS_RECONCILING LogsInstanceStatus = "reconciling" ) // All allowed values of LogsInstance enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead var AllowedLogsInstanceStatusEnumValues = []LogsInstanceStatus{ "active", "deleting", "reconciling", } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *LogsInstanceStatus) UnmarshalJSON(src []byte) error { // use a type alias to prevent infinite recursion during unmarshal, // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers @@ -298,6 +374,7 @@ func (v *LogsInstanceStatus) UnmarshalJSON(src []byte) error { // NewLogsInstanceStatusFromValue returns a pointer to a valid LogsInstanceStatus // for the value passed as argument, or an error if the value passed is not allowed by the enum +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewLogsInstanceStatusFromValue(v LogsInstanceStatus) (*LogsInstanceStatus, error) { ev := LogsInstanceStatus(v) if ev.IsValid() { @@ -308,6 +385,7 @@ func NewLogsInstanceStatusFromValue(v LogsInstanceStatus) (*LogsInstanceStatus, } // IsValid return true if the value is valid for the enum, false otherwise +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v LogsInstanceStatus) IsValid() bool { for _, existing := range AllowedLogsInstanceStatusEnumValues { if existing == v { @@ -318,50 +396,65 @@ func (v LogsInstanceStatus) IsValid() bool { } // Ptr returns reference to StatusStatus value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v LogsInstanceStatus) Ptr() *LogsInstanceStatus { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableLogsInstanceStatus struct { value *LogsInstanceStatus isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstanceStatus) Get() *LogsInstanceStatus { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstanceStatus) Set(val *LogsInstanceStatus) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstanceStatus) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstanceStatus) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableLogsInstanceStatus(val *LogsInstanceStatus) *NullableLogsInstanceStatus { return &NullableLogsInstanceStatus{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstanceStatus) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstanceStatus) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetStatusAttributeType = *LogsInstanceStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetStatusArgType = LogsInstanceStatus + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstanceGetStatusRetType = LogsInstanceStatus +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstanceGetStatusAttributeTypeOk(arg LogsInstanceGetStatusAttributeType) (ret LogsInstanceGetStatusRetType, ok bool) { if arg == nil { return ret, false @@ -369,11 +462,13 @@ func getLogsInstanceGetStatusAttributeTypeOk(arg LogsInstanceGetStatusAttributeT return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstanceGetStatusAttributeType(arg *LogsInstanceGetStatusAttributeType, val LogsInstanceGetStatusRetType) { *arg = &val } // LogsInstance struct for LogsInstance +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstance struct { // The access control list for the Logs instance. Acl LogsInstanceGetAclAttributeType `json:"acl,omitempty"` @@ -407,12 +502,14 @@ type LogsInstance struct { Status LogsInstanceGetStatusAttributeType `json:"status" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _LogsInstance LogsInstance // NewLogsInstance instantiates a new LogsInstance 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewLogsInstance(created LogsInstanceGetCreatedArgType, displayName LogsInstanceGetDisplayNameArgType, id LogsInstanceGetIdArgType, retentionDays LogsInstanceGetRetentionDaysArgType, status LogsInstanceGetStatusArgType) *LogsInstance { this := LogsInstance{} setLogsInstanceGetCreatedAttributeType(&this.Created, created) @@ -426,12 +523,14 @@ func NewLogsInstance(created LogsInstanceGetCreatedArgType, displayName LogsInst // NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewLogsInstanceWithDefaults() *LogsInstance { this := LogsInstance{} return &this } // GetAcl returns the Acl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetAcl() (res LogsInstanceGetAclRetType) { res, _ = o.GetAclOk() return @@ -439,22 +538,26 @@ func (o *LogsInstance) GetAcl() (res LogsInstanceGetAclRetType) { // GetAclOk returns a tuple with the Acl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetAclOk() (ret LogsInstanceGetAclRetType, ok bool) { return getLogsInstanceGetAclAttributeTypeOk(o.Acl) } // HasAcl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasAcl() bool { _, ok := o.GetAclOk() return ok } // SetAcl gets a reference to the given []string and assigns it to the Acl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetAcl(v LogsInstanceGetAclRetType) { setLogsInstanceGetAclAttributeType(&o.Acl, v) } // GetCreated returns the Created field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetCreated() (ret LogsInstanceGetCreatedRetType) { ret, _ = o.GetCreatedOk() return ret @@ -462,16 +565,19 @@ func (o *LogsInstance) GetCreated() (ret LogsInstanceGetCreatedRetType) { // GetCreatedOk returns a tuple with the Created field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetCreatedOk() (ret LogsInstanceGetCreatedRetType, ok bool) { return getLogsInstanceGetCreatedAttributeTypeOk(o.Created) } // SetCreated sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetCreated(v LogsInstanceGetCreatedRetType) { setLogsInstanceGetCreatedAttributeType(&o.Created, v) } // GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDatasourceUrl() (res LogsInstanceGetDatasourceUrlRetType) { res, _ = o.GetDatasourceUrlOk() return @@ -479,22 +585,26 @@ func (o *LogsInstance) GetDatasourceUrl() (res LogsInstanceGetDatasourceUrlRetTy // GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDatasourceUrlOk() (ret LogsInstanceGetDatasourceUrlRetType, ok bool) { return getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl) } // HasDatasourceUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasDatasourceUrl() bool { _, ok := o.GetDatasourceUrlOk() return ok } // SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetDatasourceUrl(v LogsInstanceGetDatasourceUrlRetType) { setLogsInstanceGetDatasourceUrlAttributeType(&o.DatasourceUrl, v) } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDescription() (res LogsInstanceGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -502,22 +612,26 @@ func (o *LogsInstance) GetDescription() (res LogsInstanceGetDescriptionRetType) // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDescriptionOk() (ret LogsInstanceGetDescriptionRetType, ok bool) { return getLogsInstanceGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetDescription(v LogsInstanceGetDescriptionRetType) { setLogsInstanceGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDisplayName() (ret LogsInstanceGetDisplayNameRetType) { ret, _ = o.GetDisplayNameOk() return ret @@ -525,16 +639,19 @@ func (o *LogsInstance) GetDisplayName() (ret LogsInstanceGetDisplayNameRetType) // GetDisplayNameOk returns a tuple with the DisplayName field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetDisplayNameOk() (ret LogsInstanceGetDisplayNameRetType, ok bool) { return getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName) } // SetDisplayName sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetDisplayName(v LogsInstanceGetDisplayNameRetType) { setLogsInstanceGetDisplayNameAttributeType(&o.DisplayName, v) } // GetId returns the Id field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetId() (ret LogsInstanceGetIdRetType) { ret, _ = o.GetIdOk() return ret @@ -542,16 +659,19 @@ func (o *LogsInstance) GetId() (ret LogsInstanceGetIdRetType) { // GetIdOk returns a tuple with the Id field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetIdOk() (ret LogsInstanceGetIdRetType, ok bool) { return getLogsInstanceGetIdAttributeTypeOk(o.Id) } // SetId sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetId(v LogsInstanceGetIdRetType) { setLogsInstanceGetIdAttributeType(&o.Id, v) } // GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetIngestOtlpUrl() (res LogsInstanceGetIngestOtlpUrlRetType) { res, _ = o.GetIngestOtlpUrlOk() return @@ -559,22 +679,26 @@ func (o *LogsInstance) GetIngestOtlpUrl() (res LogsInstanceGetIngestOtlpUrlRetTy // GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetIngestOtlpUrlOk() (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) { return getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl) } // HasIngestOtlpUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasIngestOtlpUrl() bool { _, ok := o.GetIngestOtlpUrlOk() return ok } // SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetIngestOtlpUrl(v LogsInstanceGetIngestOtlpUrlRetType) { setLogsInstanceGetIngestOtlpUrlAttributeType(&o.IngestOtlpUrl, v) } // GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetIngestUrl() (res LogsInstanceGetIngestUrlRetType) { res, _ = o.GetIngestUrlOk() return @@ -582,22 +706,26 @@ func (o *LogsInstance) GetIngestUrl() (res LogsInstanceGetIngestUrlRetType) { // GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetIngestUrlOk() (ret LogsInstanceGetIngestUrlRetType, ok bool) { return getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl) } // HasIngestUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasIngestUrl() bool { _, ok := o.GetIngestUrlOk() return ok } // SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetIngestUrl(v LogsInstanceGetIngestUrlRetType) { setLogsInstanceGetIngestUrlAttributeType(&o.IngestUrl, v) } // GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetQueryRangeUrl() (res LogsInstanceGetQueryRangeUrlRetType) { res, _ = o.GetQueryRangeUrlOk() return @@ -605,22 +733,26 @@ func (o *LogsInstance) GetQueryRangeUrl() (res LogsInstanceGetQueryRangeUrlRetTy // GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetQueryRangeUrlOk() (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) { return getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl) } // HasQueryRangeUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasQueryRangeUrl() bool { _, ok := o.GetQueryRangeUrlOk() return ok } // SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetQueryRangeUrl(v LogsInstanceGetQueryRangeUrlRetType) { setLogsInstanceGetQueryRangeUrlAttributeType(&o.QueryRangeUrl, v) } // GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetQueryUrl() (res LogsInstanceGetQueryUrlRetType) { res, _ = o.GetQueryUrlOk() return @@ -628,22 +760,26 @@ func (o *LogsInstance) GetQueryUrl() (res LogsInstanceGetQueryUrlRetType) { // GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetQueryUrlOk() (ret LogsInstanceGetQueryUrlRetType, ok bool) { return getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl) } // HasQueryUrl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) HasQueryUrl() bool { _, ok := o.GetQueryUrlOk() return ok } // SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetQueryUrl(v LogsInstanceGetQueryUrlRetType) { setLogsInstanceGetQueryUrlAttributeType(&o.QueryUrl, v) } // GetRetentionDays returns the RetentionDays field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetRetentionDays() (ret LogsInstanceGetRetentionDaysRetType) { ret, _ = o.GetRetentionDaysOk() return ret @@ -651,16 +787,19 @@ func (o *LogsInstance) GetRetentionDays() (ret LogsInstanceGetRetentionDaysRetTy // GetRetentionDaysOk returns a tuple with the RetentionDays field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetRetentionDaysOk() (ret LogsInstanceGetRetentionDaysRetType, ok bool) { return getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays) } // SetRetentionDays sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetRetentionDays(v LogsInstanceGetRetentionDaysRetType) { setLogsInstanceGetRetentionDaysAttributeType(&o.RetentionDays, v) } // GetStatus returns the Status field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetStatus() (ret LogsInstanceGetStatusRetType) { ret, _ = o.GetStatusOk() return ret @@ -668,15 +807,18 @@ func (o *LogsInstance) GetStatus() (ret LogsInstanceGetStatusRetType) { // GetStatusOk returns a tuple with the Status field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) GetStatusOk() (ret LogsInstanceGetStatusRetType, ok bool) { return getLogsInstanceGetStatusAttributeTypeOk(o.Status) } // SetStatus sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstance) SetStatus(v LogsInstanceGetStatusRetType) { setLogsInstanceGetStatusAttributeType(&o.Status, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o LogsInstance) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getLogsInstanceGetAclAttributeTypeOk(o.Acl); ok { @@ -718,37 +860,45 @@ func (o LogsInstance) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableLogsInstance struct { value *LogsInstance isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstance) Get() *LogsInstance { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstance) Set(val *LogsInstance) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstance) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstance) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { return &NullableLogsInstance{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_logs_instances_list.go b/services/logs/model_logs_instances_list.go index 6e186cc80..32efac2ee 100644 --- a/services/logs/model_logs_instances_list.go +++ b/services/logs/model_logs_instances_list.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &LogsInstancesList{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstancesListGetInstancesAttributeType = *[]LogsInstance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstancesListGetInstancesArgType = []LogsInstance + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstancesListGetInstancesRetType = []LogsInstance +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getLogsInstancesListGetInstancesAttributeTypeOk(arg LogsInstancesListGetInstancesAttributeType) (ret LogsInstancesListGetInstancesRetType, ok bool) { if arg == nil { return ret, false @@ -33,22 +40,26 @@ func getLogsInstancesListGetInstancesAttributeTypeOk(arg LogsInstancesListGetIns return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setLogsInstancesListGetInstancesAttributeType(arg *LogsInstancesListGetInstancesAttributeType, val LogsInstancesListGetInstancesRetType) { *arg = &val } // LogsInstancesList struct for LogsInstancesList +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type LogsInstancesList struct { // REQUIRED Instances LogsInstancesListGetInstancesAttributeType `json:"instances" required:"true"` } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type _LogsInstancesList LogsInstancesList // NewLogsInstancesList instantiates a new LogsInstancesList 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewLogsInstancesList(instances LogsInstancesListGetInstancesArgType) *LogsInstancesList { this := LogsInstancesList{} setLogsInstancesListGetInstancesAttributeType(&this.Instances, instances) @@ -58,12 +69,14 @@ func NewLogsInstancesList(instances LogsInstancesListGetInstancesArgType) *LogsI // NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewLogsInstancesListWithDefaults() *LogsInstancesList { this := LogsInstancesList{} return &this } // GetInstances returns the Instances field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstancesList) GetInstances() (ret LogsInstancesListGetInstancesRetType) { ret, _ = o.GetInstancesOk() return ret @@ -71,15 +84,18 @@ func (o *LogsInstancesList) GetInstances() (ret LogsInstancesListGetInstancesRet // GetInstancesOk returns a tuple with the Instances field value // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstancesList) GetInstancesOk() (ret LogsInstancesListGetInstancesRetType, ok bool) { return getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances) } // SetInstances sets field value +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *LogsInstancesList) SetInstances(v LogsInstancesListGetInstancesRetType) { setLogsInstancesListGetInstancesAttributeType(&o.Instances, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances); ok { @@ -88,37 +104,45 @@ func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableLogsInstancesList struct { value *LogsInstancesList isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstancesList) Get() *LogsInstancesList { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstancesList) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstancesList) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { return &NullableLogsInstancesList{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_update_access_token_payload.go b/services/logs/model_update_access_token_payload.go index 70f8dd8d1..7375a6f67 100644 --- a/services/logs/model_update_access_token_payload.go +++ b/services/logs/model_update_access_token_payload.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,8 +23,10 @@ var _ MappedNullable = &UpdateAccessTokenPayload{} */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg UpdateAccessTokenPayloadGetDescriptionAttributeType) (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -31,11 +34,15 @@ func getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg UpdateAccessTo return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateAccessTokenPayloadGetDescriptionAttributeType(arg *UpdateAccessTokenPayloadGetDescriptionAttributeType, val UpdateAccessTokenPayloadGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDescriptionRetType = string /* @@ -43,8 +50,10 @@ type UpdateAccessTokenPayloadGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg UpdateAccessTokenPayloadGetDisplayNameAttributeType) (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -52,14 +61,19 @@ func getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg UpdateAccessTo return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateAccessTokenPayloadGetDisplayNameAttributeType(arg *UpdateAccessTokenPayloadGetDisplayNameAttributeType, val UpdateAccessTokenPayloadGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayloadGetDisplayNameRetType = string // UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateAccessTokenPayload struct { // The description of the access token. Description UpdateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"` @@ -71,6 +85,7 @@ type UpdateAccessTokenPayload struct { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { this := UpdateAccessTokenPayload{} return &this @@ -79,12 +94,14 @@ func NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { // NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { this := UpdateAccessTokenPayload{} return &this } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) GetDescription() (res UpdateAccessTokenPayloadGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -92,22 +109,26 @@ func (o *UpdateAccessTokenPayload) GetDescription() (res UpdateAccessTokenPayloa // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) GetDescriptionOk() (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) { return getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) SetDescription(v UpdateAccessTokenPayloadGetDescriptionRetType) { setUpdateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) GetDisplayName() (res UpdateAccessTokenPayloadGetDisplayNameRetType) { res, _ = o.GetDisplayNameOk() return @@ -115,21 +136,25 @@ func (o *UpdateAccessTokenPayload) GetDisplayName() (res UpdateAccessTokenPayloa // GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) { return getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName) } // HasDisplayName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) HasDisplayName() bool { _, ok := o.GetDisplayNameOk() return ok } // SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateAccessTokenPayload) SetDisplayName(v UpdateAccessTokenPayloadGetDisplayNameRetType) { setUpdateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok { @@ -141,37 +166,45 @@ func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableUpdateAccessTokenPayload struct { value *UpdateAccessTokenPayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateAccessTokenPayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateAccessTokenPayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { return &NullableUpdateAccessTokenPayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/model_update_logs_instance_payload.go b/services/logs/model_update_logs_instance_payload.go index 0420dd384..f9c736061 100644 --- a/services/logs/model_update_logs_instance_payload.go +++ b/services/logs/model_update_logs_instance_payload.go @@ -8,6 +8,7 @@ API version: 1.0.0 // Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead package logs import ( @@ -22,10 +23,16 @@ var _ MappedNullable = &UpdateLogsInstancePayload{} */ // isArray +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetAclAttributeType = *[]string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetAclArgType = []string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetAclRetType = []string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateLogsInstancePayloadGetAclAttributeTypeOk(arg UpdateLogsInstancePayloadGetAclAttributeType) (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { if arg == nil { return ret, false @@ -33,6 +40,7 @@ func getUpdateLogsInstancePayloadGetAclAttributeTypeOk(arg UpdateLogsInstancePay return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateLogsInstancePayloadGetAclAttributeType(arg *UpdateLogsInstancePayloadGetAclAttributeType, val UpdateLogsInstancePayloadGetAclRetType) { *arg = &val } @@ -42,8 +50,10 @@ func setUpdateLogsInstancePayloadGetAclAttributeType(arg *UpdateLogsInstancePayl */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDescriptionAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateLogsInstancePayloadGetDescriptionAttributeType) (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { if arg == nil { return ret, false @@ -51,11 +61,15 @@ func getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateLogsIns return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateLogsInstancePayloadGetDescriptionAttributeType(arg *UpdateLogsInstancePayloadGetDescriptionAttributeType, val UpdateLogsInstancePayloadGetDescriptionRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDescriptionArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDescriptionRetType = string /* @@ -63,8 +77,10 @@ type UpdateLogsInstancePayloadGetDescriptionRetType = string */ // isNotNullableString +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDisplayNameAttributeType = *string +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg UpdateLogsInstancePayloadGetDisplayNameAttributeType) (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { if arg == nil { return ret, false @@ -72,11 +88,15 @@ func getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg UpdateLogsIns return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateLogsInstancePayloadGetDisplayNameAttributeType(arg *UpdateLogsInstancePayloadGetDisplayNameAttributeType, val UpdateLogsInstancePayloadGetDisplayNameRetType) { *arg = &val } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDisplayNameArgType = string + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetDisplayNameRetType = string /* @@ -84,10 +104,16 @@ type UpdateLogsInstancePayloadGetDisplayNameRetType = string */ // isInteger +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetRetentionDaysAttributeType = *int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetRetentionDaysArgType = int64 + +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayloadGetRetentionDaysRetType = int64 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg UpdateLogsInstancePayloadGetRetentionDaysAttributeType) (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { if arg == nil { return ret, false @@ -95,11 +121,13 @@ func getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg UpdateLogsI return *arg, true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(arg *UpdateLogsInstancePayloadGetRetentionDaysAttributeType, val UpdateLogsInstancePayloadGetRetentionDaysRetType) { *arg = &val } // UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type UpdateLogsInstancePayload struct { // The access control list for the Logs instance. Acl UpdateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"` @@ -116,6 +144,7 @@ type UpdateLogsInstancePayload struct { // 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { this := UpdateLogsInstancePayload{} return &this @@ -124,12 +153,14 @@ func NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { // NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { this := UpdateLogsInstancePayload{} return &this } // GetAcl returns the Acl field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetAcl() (res UpdateLogsInstancePayloadGetAclRetType) { res, _ = o.GetAclOk() return @@ -137,22 +168,26 @@ func (o *UpdateLogsInstancePayload) GetAcl() (res UpdateLogsInstancePayloadGetAc // GetAclOk returns a tuple with the Acl field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetAclOk() (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) { return getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl) } // HasAcl returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) HasAcl() bool { _, ok := o.GetAclOk() return ok } // SetAcl gets a reference to the given []string and assigns it to the Acl field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) SetAcl(v UpdateLogsInstancePayloadGetAclRetType) { setUpdateLogsInstancePayloadGetAclAttributeType(&o.Acl, v) } // GetDescription returns the Description field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetDescription() (res UpdateLogsInstancePayloadGetDescriptionRetType) { res, _ = o.GetDescriptionOk() return @@ -160,22 +195,26 @@ func (o *UpdateLogsInstancePayload) GetDescription() (res UpdateLogsInstancePayl // GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetDescriptionOk() (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) { return getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description) } // HasDescription returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) HasDescription() bool { _, ok := o.GetDescriptionOk() return ok } // SetDescription gets a reference to the given string and assigns it to the Description field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) SetDescription(v UpdateLogsInstancePayloadGetDescriptionRetType) { setUpdateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v) } // GetDisplayName returns the DisplayName field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetDisplayName() (res UpdateLogsInstancePayloadGetDisplayNameRetType) { res, _ = o.GetDisplayNameOk() return @@ -183,22 +222,26 @@ func (o *UpdateLogsInstancePayload) GetDisplayName() (res UpdateLogsInstancePayl // GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) { return getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName) } // HasDisplayName returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) HasDisplayName() bool { _, ok := o.GetDisplayNameOk() return ok } // SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) SetDisplayName(v UpdateLogsInstancePayloadGetDisplayNameRetType) { setUpdateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v) } // GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetRetentionDays() (res UpdateLogsInstancePayloadGetRetentionDaysRetType) { res, _ = o.GetRetentionDaysOk() return @@ -206,21 +249,25 @@ func (o *UpdateLogsInstancePayload) GetRetentionDays() (res UpdateLogsInstancePa // GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise // and a boolean to check if the value has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) { return getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays) } // HasRetentionDays returns a boolean if a field has been set. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { _, ok := o.GetRetentionDaysOk() return ok } // SetRetentionDays gets a reference to the given int64 and assigns it to the RetentionDays field. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o *UpdateLogsInstancePayload) SetRetentionDays(v UpdateLogsInstancePayloadGetRetentionDaysRetType) { setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} if val, ok := getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok { @@ -238,37 +285,45 @@ func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { return toSerialize, nil } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableUpdateLogsInstancePayload struct { value *UpdateLogsInstancePayload isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateLogsInstancePayload) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateLogsInstancePayload) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { return &NullableUpdateLogsInstancePayload{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) diff --git a/services/logs/oas_commit b/services/logs/oas_commit index 588ee296b..853627d06 100644 --- a/services/logs/oas_commit +++ b/services/logs/oas_commit @@ -1 +1 @@ -964ac4ce34f0b6417f2496a1d48585c4926dee3a +335aa32af4d6c0d2a036b8567773da2f051f7efb diff --git a/services/logs/utils.go b/services/logs/utils.go index 7709fc985..94c9a7d98 100644 --- a/services/logs/utils.go +++ b/services/logs/utils.go @@ -18,341 +18,419 @@ import ( ) // PtrBool is a helper routine that returns a pointer to given boolean value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrBool(v bool) *bool { return &v } // PtrInt is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt(v int) *int { return &v } // PtrInt32 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt32(v int32) *int32 { return &v } // PtrInt64 is a helper routine that returns a pointer to given integer value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrInt64(v int64) *int64 { return &v } // PtrFloat32 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat32(v float32) *float32 { return &v } // PtrFloat64 is a helper routine that returns a pointer to given float value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrFloat64(v float64) *float64 { return &v } // PtrString is a helper routine that returns a pointer to given string value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrString(v string) *string { return &v } // PtrTime is helper routine that returns a pointer to given Time value. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func PtrTime(v time.Time) *time.Time { return &v } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableValue[T any] struct { value *T isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) Get() *T { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Set(val *T) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableValue[T]) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableValue[T]) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableBool struct { value *bool isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) Get() *bool { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Set(val *bool) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableBool(val *bool) *NullableBool { return &NullableBool{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableBool) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableBool) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt struct { value *int isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) Get() *int { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Set(val *int) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt(val *int) *NullableInt { return &NullableInt{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt32 struct { value *int32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) Get() *int32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Set(val *int32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt32(val *int32) *NullableInt32 { return &NullableInt32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableInt64 struct { value *int64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) Get() *int64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Set(val *int64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableInt64(val *int64) *NullableInt64 { return &NullableInt64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableInt64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableInt64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat32 struct { value *float32 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) Get() *float32 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Set(val *float32) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat32(val *float32) *NullableFloat32 { return &NullableFloat32{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat32) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat32) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableFloat64 struct { value *float64 isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) Get() *float64 { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Set(val *float64) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableFloat64(val *float64) *NullableFloat64 { return &NullableFloat64{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableFloat64) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableFloat64) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableString struct { value *string isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) Get() *string { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Set(val *string) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableString(val *string) *NullableString { return &NullableString{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableString) MarshalJSON() ([]byte, error) { return json.Marshal(v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableString) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type NullableTime struct { value *time.Time isSet bool } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) Get() *time.Time { return v.value } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Set(val *time.Time) { v.value = val v.isSet = true } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) IsSet() bool { return v.isSet } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) Unset() { v.value = nil v.isSet = false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func NewNullableTime(val *time.Time) *NullableTime { return &NullableTime{value: val, isSet: true} } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v NullableTime) MarshalJSON() ([]byte, error) { return v.value.MarshalJSON() } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func (v *NullableTime) UnmarshalJSON(src []byte) error { v.isSet = true return json.Unmarshal(src, &v.value) } // IsNil checks if an input is nil +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func IsNil(i interface{}) bool { if i == nil { return true @@ -369,13 +447,16 @@ func IsNil(i interface{}) bool { return false } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead type MappedNullable interface { ToMap() (map[string]interface{}, error) } +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" // randString returns a random string with a specified length. It panics if n <= 0. +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead func randString(n int) string { b := make([]byte, n) for i := range b { diff --git a/services/logs/v1alphaapi/api_default.go b/services/logs/v1alphaapi/api_default.go new file mode 100644 index 000000000..7c4d5a161 --- /dev/null +++ b/services/logs/v1alphaapi/api_default.go @@ -0,0 +1,1859 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + CreateAccessToken Create Access Token + + Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest + + // CreateAccessTokenExecute executes the request + // @return AccessToken + CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + CreateLogsInstance Create Logs instance + + Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest + */ + CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest + + // CreateLogsInstanceExecute executes the request + // @return LogsInstance + CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + DeleteAccessToken Delete Access Token + + Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest + + // DeleteAccessTokenExecute executes the request + DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) + + /* + DeleteAllAccessTokens Delete All Access Tokens + + Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest + */ + DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest + + // DeleteAllAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteAllExpiredAccessTokens Deletes all expired access tokens + + Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest + */ + DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest + + // DeleteAllExpiredAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteLogsInstance Delete Logs instance + + Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest + */ + DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest + + // DeleteLogsInstanceExecute executes the request + DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + + /* + GetAccessToken Get Access Token + + Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest + + // GetAccessTokenExecute executes the request + // @return AccessToken + GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + GetLogsInstance Get Logs Instance + + Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest + */ + GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest + + // GetLogsInstanceExecute executes the request + // @return LogsInstance + GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + ListAccessTokens List Access Tokens + + Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest + + // ListAccessTokensExecute executes the request + // @return AccessTokenList + ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + ListLogsInstances List Logs instances + + Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest + */ + ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest + + // ListLogsInstancesExecute executes the request + // @return LogsInstancesList + ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + + /* + UpdateAccessToken Update Access Token + + Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest + + // UpdateAccessTokenExecute executes the request + UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) + + /* + UpdateLogsInstance Update Logs instance + + Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest + */ + UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest + + // UpdateLogsInstanceExecute executes the request + // @return LogsInstance + UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r ApiCreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r ApiCreateAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.CreateAccessTokenExecute(r) +} + +/* +CreateAccessToken Create Access Token + +Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *DefaultAPIService) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, nil, reportError("createAccessTokenPayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createLogsInstancePayload *CreateLogsInstancePayload +} + +func (r ApiCreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { + r.createLogsInstancePayload = &createLogsInstancePayload + return r +} + +func (r ApiCreateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.CreateLogsInstanceExecute(r) +} + +/* +CreateLogsInstance Create Logs instance + +Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest +*/ +func (a *DefaultAPIService) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("createLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiDeleteAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteAccessTokenExecute(r) +} + +/* +DeleteAccessToken Delete Access Token + +Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *DefaultAPIService) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteAllAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllAccessTokensExecute(r) +} + +/* +DeleteAllAccessTokens Delete All Access Tokens + +Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAllExpiredAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllExpiredAccessTokensExecute(r) +} + +/* +DeleteAllExpiredAccessTokens Deletes all expired access tokens + +Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllExpiredAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteLogsInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteLogsInstanceExecute(r) +} + +/* +DeleteLogsInstance Delete Logs instance + +Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest +*/ +func (a *DefaultAPIService) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteLogsInstance") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiGetAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.GetAccessTokenExecute(r) +} + +/* +GetAccessToken Get Access Token + +Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *DefaultAPIService) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiGetLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.GetLogsInstanceExecute(r) +} + +/* +GetLogsInstance Get Logs Instance + +Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest +*/ +func (a *DefaultAPIService) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiListAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.ListAccessTokensExecute(r) +} + +/* +ListAccessTokens List Access Tokens + +Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest +*/ +func (a *DefaultAPIService) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListLogsInstancesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string +} + +func (r ApiListLogsInstancesRequest) Execute() (*LogsInstancesList, *http.Response, error) { + return r.ApiService.ListLogsInstancesExecute(r) +} + +/* +ListLogsInstances List Logs instances + +Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest +*/ +func (a *DefaultAPIService) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstancesList +func (a *DefaultAPIService) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstancesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListLogsInstances") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r ApiUpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r ApiUpdateAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.UpdateAccessTokenExecute(r) +} + +/* +UpdateAccessToken Update Access Token + +Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *DefaultAPIService) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return nil, reportError("updateAccessTokenPayload 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{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateLogsInstancePayload *UpdateLogsInstancePayload +} + +func (r ApiUpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { + r.updateLogsInstancePayload = &updateLogsInstancePayload + return r +} + +func (r ApiUpdateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.UpdateLogsInstanceExecute(r) +} + +/* +UpdateLogsInstance Update Logs instance + +Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest +*/ +func (a *DefaultAPIService) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1alpha/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("updateLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/services/logs/v1alphaapi/api_default_mock.go b/services/logs/v1alphaapi/api_default_mock.go new file mode 100644 index 000000000..4c7290e65 --- /dev/null +++ b/services/logs/v1alphaapi/api_default_mock.go @@ -0,0 +1,286 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "context" + "net/http" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateAccessTokenExecuteMock can be populated to implement the behavior of the CreateAccessTokenExecute function of this mock + CreateAccessTokenExecuteMock *func(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + // CreateLogsInstanceExecuteMock can be populated to implement the behavior of the CreateLogsInstanceExecute function of this mock + CreateLogsInstanceExecuteMock *func(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // DeleteAccessTokenExecuteMock can be populated to implement the behavior of the DeleteAccessTokenExecute function of this mock + DeleteAccessTokenExecuteMock *func(r ApiDeleteAccessTokenRequest) (*http.Response, error) + // DeleteAllAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllAccessTokensExecute function of this mock + DeleteAllAccessTokensExecuteMock *func(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteAllExpiredAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllExpiredAccessTokensExecute function of this mock + DeleteAllExpiredAccessTokensExecuteMock *func(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteLogsInstanceExecuteMock can be populated to implement the behavior of the DeleteLogsInstanceExecute function of this mock + DeleteLogsInstanceExecuteMock *func(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + // GetAccessTokenExecuteMock can be populated to implement the behavior of the GetAccessTokenExecute function of this mock + GetAccessTokenExecuteMock *func(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + // GetLogsInstanceExecuteMock can be populated to implement the behavior of the GetLogsInstanceExecute function of this mock + GetLogsInstanceExecuteMock *func(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // ListAccessTokensExecuteMock can be populated to implement the behavior of the ListAccessTokensExecute function of this mock + ListAccessTokensExecuteMock *func(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // ListLogsInstancesExecuteMock can be populated to implement the behavior of the ListLogsInstancesExecute function of this mock + ListLogsInstancesExecuteMock *func(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + // UpdateAccessTokenExecuteMock can be populated to implement the behavior of the UpdateAccessTokenExecute function of this mock + UpdateAccessTokenExecuteMock *func(r ApiUpdateAccessTokenRequest) (*http.Response, error) + // UpdateLogsInstanceExecuteMock can be populated to implement the behavior of the UpdateLogsInstanceExecute function of this mock + UpdateLogsInstanceExecuteMock *func(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +func (a DefaultAPIServiceMock) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// CreateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.CreateAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.CreateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// DeleteAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + if a.DeleteAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllExpiredAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllExpiredAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllExpiredAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllExpiredAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + if a.DeleteLogsInstanceExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// GetAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.GetAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// GetLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.GetLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// ListAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.ListAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListLogsInstancesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListLogsInstancesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + if a.ListLogsInstancesExecuteMock == nil { + var localVarReturnValue *LogsInstancesList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListLogsInstancesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// UpdateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + if a.UpdateAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.UpdateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.UpdateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.UpdateLogsInstanceExecuteMock)(r) +} diff --git a/services/logs/v1alphaapi/client.go b/services/logs/v1alphaapi/client.go new file mode 100644 index 000000000..d67ef48ea --- /dev/null +++ b/services/logs/v1alphaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Logs API API v1alpha.0.3 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/logs/v1alphaapi/configuration.go b/services/logs/v1alphaapi/configuration.go new file mode 100644 index 000000000..e9101aa7e --- /dev/null +++ b/services/logs/v1alphaapi/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1alphaapi + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/logs", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://logs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/logs/v1alphaapi/model_access_token.go b/services/logs/v1alphaapi/model_access_token.go new file mode 100644 index 000000000..1b1270f86 --- /dev/null +++ b/services/logs/v1alphaapi/model_access_token.go @@ -0,0 +1,413 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessToken{} + +// AccessToken struct for AccessToken +type AccessToken struct { + // A generated access token. Only available on creation. + AccessToken *string `json:"accessToken,omitempty"` + // The user who created the access token. + Creator string `json:"creator"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // Indicates if the access token can expire. + Expires bool `json:"expires"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` + Status string `json:"status"` + // The date and time util an access token is valid to (inclusively). + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +type _AccessToken AccessToken + +// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator string, displayName string, expires bool, id string, permissions []string, status string) *AccessToken { + this := AccessToken{} + this.Creator = creator + this.DisplayName = displayName + this.Expires = expires + this.Id = id + this.Permissions = permissions + this.Status = status + return &this +} + +// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken { + this := AccessToken{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AccessToken) GetAccessToken() string { + if o == nil || IsNil(o.AccessToken) { + var ret string + return ret + } + return *o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetAccessTokenOk() (*string, bool) { + if o == nil || IsNil(o.AccessToken) { + return nil, false + } + return o.AccessToken, true +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AccessToken) HasAccessToken() bool { + if o != nil && !IsNil(o.AccessToken) { + return true + } + + return false +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AccessToken) SetAccessToken(v string) { + o.AccessToken = &v +} + +// GetCreator returns the Creator field value +func (o *AccessToken) GetCreator() string { + if o == nil { + var ret string + return ret + } + + return o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetCreatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Creator, true +} + +// SetCreator sets field value +func (o *AccessToken) SetCreator(v string) { + o.Creator = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessToken) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessToken) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AccessToken) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessToken) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *AccessToken) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpires returns the Expires field value +func (o *AccessToken) GetExpires() bool { + if o == nil { + var ret bool + return ret + } + + return o.Expires +} + +// GetExpiresOk returns a tuple with the Expires field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetExpiresOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Expires, true +} + +// SetExpires sets field value +func (o *AccessToken) SetExpires(v bool) { + o.Expires = v +} + +// GetId returns the Id field value +func (o *AccessToken) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AccessToken) SetId(v string) { + o.Id = v +} + +// GetPermissions returns the Permissions field value +func (o *AccessToken) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *AccessToken) SetPermissions(v []string) { + o.Permissions = v +} + +// GetStatus returns the Status field value +func (o *AccessToken) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *AccessToken) SetStatus(v string) { + o.Status = v +} + +// GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +func (o *AccessToken) GetValidUntil() time.Time { + if o == nil || IsNil(o.ValidUntil) { + var ret time.Time + return ret + } + return *o.ValidUntil +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetValidUntilOk() (*time.Time, bool) { + if o == nil || IsNil(o.ValidUntil) { + return nil, false + } + return o.ValidUntil, true +} + +// HasValidUntil returns a boolean if a field has been set. +func (o *AccessToken) HasValidUntil() bool { + if o != nil && !IsNil(o.ValidUntil) { + return true + } + + return false +} + +// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +func (o *AccessToken) SetValidUntil(v time.Time) { + o.ValidUntil = &v +} + +func (o AccessToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessToken) { + toSerialize["accessToken"] = o.AccessToken + } + toSerialize["creator"] = o.Creator + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["expires"] = o.Expires + toSerialize["id"] = o.Id + toSerialize["permissions"] = o.Permissions + toSerialize["status"] = o.Status + if !IsNil(o.ValidUntil) { + toSerialize["validUntil"] = o.ValidUntil + } + return toSerialize, nil +} + +func (o *AccessToken) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "creator", + "displayName", + "expires", + "id", + "permissions", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessToken := _AccessToken{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessToken) + + if err != nil { + return err + } + + *o = AccessToken(varAccessToken) + + return err +} + +type NullableAccessToken struct { + value *AccessToken + isSet bool +} + +func (v NullableAccessToken) Get() *AccessToken { + return v.value +} + +func (v *NullableAccessToken) Set(val *AccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { + return &NullableAccessToken{value: val, isSet: true} +} + +func (v NullableAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_access_token_list.go b/services/logs/v1alphaapi/model_access_token_list.go new file mode 100644 index 000000000..9d38a485b --- /dev/null +++ b/services/logs/v1alphaapi/model_access_token_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenList{} + +// AccessTokenList struct for AccessTokenList +type AccessTokenList struct { + Tokens []AccessToken `json:"tokens"` +} + +type _AccessTokenList AccessTokenList + +// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens []AccessToken) *AccessTokenList { + this := AccessTokenList{} + this.Tokens = tokens + return &this +} + +// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList { + this := AccessTokenList{} + return &this +} + +// GetTokens returns the Tokens field value +func (o *AccessTokenList) GetTokens() []AccessToken { + if o == nil { + var ret []AccessToken + return ret + } + + return o.Tokens +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *AccessTokenList) GetTokensOk() ([]AccessToken, bool) { + if o == nil { + return nil, false + } + return o.Tokens, true +} + +// SetTokens sets field value +func (o *AccessTokenList) SetTokens(v []AccessToken) { + o.Tokens = v +} + +func (o AccessTokenList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tokens"] = o.Tokens + return toSerialize, nil +} + +func (o *AccessTokenList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "tokens", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessTokenList := _AccessTokenList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessTokenList) + + if err != nil { + return err + } + + *o = AccessTokenList(varAccessTokenList) + + return err +} + +type NullableAccessTokenList struct { + value *AccessTokenList + isSet bool +} + +func (v NullableAccessTokenList) Get() *AccessTokenList { + return v.value +} + +func (v *NullableAccessTokenList) Set(val *AccessTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { + return &NullableAccessTokenList{value: val, isSet: true} +} + +func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_create_access_token_payload.go b/services/logs/v1alphaapi/model_create_access_token_payload.go new file mode 100644 index 000000000..abfc168a5 --- /dev/null +++ b/services/logs/v1alphaapi/model_create_access_token_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A lifetime period for an access token in days. If unset the token will not expire. + Lifetime *int32 `json:"lifetime,omitempty"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName string, permissions []string) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + this.DisplayName = displayName + this.Permissions = permissions + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetLifetime() int32 { + if o == nil || IsNil(o.Lifetime) { + var ret int32 + return ret + } + return *o.Lifetime +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetLifetimeOk() (*int32, bool) { + if o == nil || IsNil(o.Lifetime) { + return nil, false + } + return o.Lifetime, true +} + +// HasLifetime returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasLifetime() bool { + if o != nil && !IsNil(o.Lifetime) { + return true + } + + return false +} + +// SetLifetime gets a reference to the given int32 and assigns it to the Lifetime field. +func (o *CreateAccessTokenPayload) SetLifetime(v int32) { + o.Lifetime = &v +} + +// GetPermissions returns the Permissions field value +func (o *CreateAccessTokenPayload) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *CreateAccessTokenPayload) SetPermissions(v []string) { + o.Permissions = v +} + +func (o CreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Lifetime) { + toSerialize["lifetime"] = o.Lifetime + } + toSerialize["permissions"] = o.Permissions + return toSerialize, nil +} + +func (o *CreateAccessTokenPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "permissions", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateAccessTokenPayload := _CreateAccessTokenPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateAccessTokenPayload) + + if err != nil { + return err + } + + *o = CreateAccessTokenPayload(varCreateAccessTokenPayload) + + return err +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_create_logs_instance_payload.go b/services/logs/v1alphaapi/model_create_logs_instance_payload.go new file mode 100644 index 000000000..918cf9be9 --- /dev/null +++ b/services/logs/v1alphaapi/model_create_logs_instance_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLogsInstancePayload{} + +// CreateLogsInstancePayload struct for CreateLogsInstancePayload +type CreateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` +} + +type _CreateLogsInstancePayload CreateLogsInstancePayload + +// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName string, retentionDays int32) *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + this.DisplayName = displayName + this.RetentionDays = retentionDays + return &this +} + +// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateLogsInstancePayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *CreateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *CreateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +func (o CreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["retentionDays"] = o.RetentionDays + return toSerialize, nil +} + +func (o *CreateLogsInstancePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "retentionDays", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateLogsInstancePayload := _CreateLogsInstancePayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateLogsInstancePayload) + + if err != nil { + return err + } + + *o = CreateLogsInstancePayload(varCreateLogsInstancePayload) + + return err +} + +type NullableCreateLogsInstancePayload struct { + value *CreateLogsInstancePayload + isSet bool +} + +func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { + return v.value +} + +func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { + return &NullableCreateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_logs_instance.go b/services/logs/v1alphaapi/model_logs_instance.go new file mode 100644 index 000000000..a3c551431 --- /dev/null +++ b/services/logs/v1alphaapi/model_logs_instance.go @@ -0,0 +1,533 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the LogsInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstance{} + +// LogsInstance struct for LogsInstance +type LogsInstance struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The date and time the creation of the Logs instance was triggered. + Created time.Time `json:"created"` + // The Logs instance's datasource URL, can be used in Grafana as a datasource URL + DatasourceUrl *string `json:"datasourceUrl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name of the Logs instance. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A auto generated unique id which identifies the Logs instance. + Id string `json:"id"` + // The Logs instance's ingest logs via OTLP URL + IngestOtlpUrl *string `json:"ingestOtlpUrl,omitempty"` + // The Logs instance's ingest logs URL + IngestUrl *string `json:"ingestUrl,omitempty"` + // The Logs instance's query range URL + QueryRangeUrl *string `json:"queryRangeUrl,omitempty"` + // The Logs instance's query URL + QueryUrl *string `json:"queryUrl,omitempty"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` + // The current status of the Logs instance. + Status string `json:"status"` +} + +type _LogsInstance LogsInstance + +// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created time.Time, displayName string, id string, retentionDays int32, status string) *LogsInstance { + this := LogsInstance{} + this.Created = created + this.DisplayName = displayName + this.Id = id + this.RetentionDays = retentionDays + this.Status = status + return &this +} + +// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance { + this := LogsInstance{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *LogsInstance) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *LogsInstance) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *LogsInstance) SetAcl(v []string) { + o.Acl = v +} + +// GetCreated returns the Created field value +func (o *LogsInstance) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value +func (o *LogsInstance) SetCreated(v time.Time) { + o.Created = v +} + +// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetDatasourceUrl() string { + if o == nil || IsNil(o.DatasourceUrl) { + var ret string + return ret + } + return *o.DatasourceUrl +} + +// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDatasourceUrlOk() (*string, bool) { + if o == nil || IsNil(o.DatasourceUrl) { + return nil, false + } + return o.DatasourceUrl, true +} + +// HasDatasourceUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasDatasourceUrl() bool { + if o != nil && !IsNil(o.DatasourceUrl) { + return true + } + + return false +} + +// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +func (o *LogsInstance) SetDatasourceUrl(v string) { + o.DatasourceUrl = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsInstance) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsInstance) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsInstance) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *LogsInstance) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *LogsInstance) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value +func (o *LogsInstance) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *LogsInstance) SetId(v string) { + o.Id = v +} + +// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestOtlpUrl() string { + if o == nil || IsNil(o.IngestOtlpUrl) { + var ret string + return ret + } + return *o.IngestOtlpUrl +} + +// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestOtlpUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestOtlpUrl) { + return nil, false + } + return o.IngestOtlpUrl, true +} + +// HasIngestOtlpUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestOtlpUrl() bool { + if o != nil && !IsNil(o.IngestOtlpUrl) { + return true + } + + return false +} + +// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +func (o *LogsInstance) SetIngestOtlpUrl(v string) { + o.IngestOtlpUrl = &v +} + +// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestUrl() string { + if o == nil || IsNil(o.IngestUrl) { + var ret string + return ret + } + return *o.IngestUrl +} + +// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestUrl) { + return nil, false + } + return o.IngestUrl, true +} + +// HasIngestUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestUrl() bool { + if o != nil && !IsNil(o.IngestUrl) { + return true + } + + return false +} + +// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +func (o *LogsInstance) SetIngestUrl(v string) { + o.IngestUrl = &v +} + +// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryRangeUrl() string { + if o == nil || IsNil(o.QueryRangeUrl) { + var ret string + return ret + } + return *o.QueryRangeUrl +} + +// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryRangeUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryRangeUrl) { + return nil, false + } + return o.QueryRangeUrl, true +} + +// HasQueryRangeUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryRangeUrl() bool { + if o != nil && !IsNil(o.QueryRangeUrl) { + return true + } + + return false +} + +// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +func (o *LogsInstance) SetQueryRangeUrl(v string) { + o.QueryRangeUrl = &v +} + +// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryUrl() string { + if o == nil || IsNil(o.QueryUrl) { + var ret string + return ret + } + return *o.QueryUrl +} + +// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryUrl) { + return nil, false + } + return o.QueryUrl, true +} + +// HasQueryUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryUrl() bool { + if o != nil && !IsNil(o.QueryUrl) { + return true + } + + return false +} + +// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +func (o *LogsInstance) SetQueryUrl(v string) { + o.QueryUrl = &v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *LogsInstance) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *LogsInstance) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +// GetStatus returns the Status field value +func (o *LogsInstance) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *LogsInstance) SetStatus(v string) { + o.Status = v +} + +func (o LogsInstance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + toSerialize["created"] = o.Created + if !IsNil(o.DatasourceUrl) { + toSerialize["datasourceUrl"] = o.DatasourceUrl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["id"] = o.Id + if !IsNil(o.IngestOtlpUrl) { + toSerialize["ingestOtlpUrl"] = o.IngestOtlpUrl + } + if !IsNil(o.IngestUrl) { + toSerialize["ingestUrl"] = o.IngestUrl + } + if !IsNil(o.QueryRangeUrl) { + toSerialize["queryRangeUrl"] = o.QueryRangeUrl + } + if !IsNil(o.QueryUrl) { + toSerialize["queryUrl"] = o.QueryUrl + } + toSerialize["retentionDays"] = o.RetentionDays + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *LogsInstance) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "created", + "displayName", + "id", + "retentionDays", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstance := _LogsInstance{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstance) + + if err != nil { + return err + } + + *o = LogsInstance(varLogsInstance) + + return err +} + +type NullableLogsInstance struct { + value *LogsInstance + isSet bool +} + +func (v NullableLogsInstance) Get() *LogsInstance { + return v.value +} + +func (v *NullableLogsInstance) Set(val *LogsInstance) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { + return &NullableLogsInstance{value: val, isSet: true} +} + +func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_logs_instances_list.go b/services/logs/v1alphaapi/model_logs_instances_list.go new file mode 100644 index 000000000..44cf964d7 --- /dev/null +++ b/services/logs/v1alphaapi/model_logs_instances_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstancesList{} + +// LogsInstancesList struct for LogsInstancesList +type LogsInstancesList struct { + Instances []LogsInstance `json:"instances"` +} + +type _LogsInstancesList LogsInstancesList + +// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances []LogsInstance) *LogsInstancesList { + this := LogsInstancesList{} + this.Instances = instances + return &this +} + +// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList { + this := LogsInstancesList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *LogsInstancesList) GetInstances() []LogsInstance { + if o == nil { + var ret []LogsInstance + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *LogsInstancesList) GetInstancesOk() ([]LogsInstance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *LogsInstancesList) SetInstances(v []LogsInstance) { + o.Instances = v +} + +func (o LogsInstancesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + return toSerialize, nil +} + +func (o *LogsInstancesList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "instances", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstancesList := _LogsInstancesList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstancesList) + + if err != nil { + return err + } + + *o = LogsInstancesList(varLogsInstancesList) + + return err +} + +type NullableLogsInstancesList struct { + value *LogsInstancesList + isSet bool +} + +func (v NullableLogsInstancesList) Get() *LogsInstancesList { + return v.value +} + +func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstancesList) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstancesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { + return &NullableLogsInstancesList{value: val, isSet: true} +} + +func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_update_access_token_payload.go b/services/logs/v1alphaapi/model_update_access_token_payload.go new file mode 100644 index 000000000..076f3b3f4 --- /dev/null +++ b/services/logs/v1alphaapi/model_update_access_token_payload.go @@ -0,0 +1,162 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` +} + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +func (o UpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + return toSerialize, nil +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/model_update_logs_instance_payload.go b/services/logs/v1alphaapi/model_update_logs_instance_payload.go new file mode 100644 index 000000000..cc7b924f6 --- /dev/null +++ b/services/logs/v1alphaapi/model_update_logs_instance_payload.go @@ -0,0 +1,236 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "encoding/json" +) + +// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLogsInstancePayload{} + +// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +type UpdateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + +// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *UpdateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil || IsNil(o.RetentionDays) { + var ret int32 + return ret + } + return *o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil || IsNil(o.RetentionDays) { + return nil, false + } + return o.RetentionDays, true +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { + if o != nil && !IsNil(o.RetentionDays) { + return true + } + + return false +} + +// SetRetentionDays gets a reference to the given int32 and assigns it to the RetentionDays field. +func (o *UpdateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = &v +} + +func (o UpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.RetentionDays) { + toSerialize["retentionDays"] = o.RetentionDays + } + return toSerialize, nil +} + +type NullableUpdateLogsInstancePayload struct { + value *UpdateLogsInstancePayload + isSet bool +} + +func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { + return v.value +} + +func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { + return &NullableUpdateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1alphaapi/response.go b/services/logs/v1alphaapi/response.go new file mode 100644 index 000000000..b64135f49 --- /dev/null +++ b/services/logs/v1alphaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/logs/v1alphaapi/utils.go b/services/logs/v1alphaapi/utils.go new file mode 100644 index 000000000..18e9888b0 --- /dev/null +++ b/services/logs/v1alphaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1alpha.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1alphaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/logs/v1api/api_default.go b/services/logs/v1api/api_default.go new file mode 100644 index 000000000..44efa0ae2 --- /dev/null +++ b/services/logs/v1api/api_default.go @@ -0,0 +1,1859 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + CreateAccessToken Create Access Token + + Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest + + // CreateAccessTokenExecute executes the request + // @return AccessToken + CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + CreateLogsInstance Create Logs instance + + Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest + */ + CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest + + // CreateLogsInstanceExecute executes the request + // @return LogsInstance + CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + DeleteAccessToken Delete Access Token + + Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest + + // DeleteAccessTokenExecute executes the request + DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) + + /* + DeleteAllAccessTokens Delete All Access Tokens + + Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest + */ + DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest + + // DeleteAllAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteAllExpiredAccessTokens Deletes all expired access tokens + + Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest + */ + DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest + + // DeleteAllExpiredAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteLogsInstance Delete Logs instance + + Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest + */ + DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest + + // DeleteLogsInstanceExecute executes the request + DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + + /* + GetAccessToken Get Access Token + + Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest + + // GetAccessTokenExecute executes the request + // @return AccessToken + GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + GetLogsInstance Get Logs Instance + + Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest + */ + GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest + + // GetLogsInstanceExecute executes the request + // @return LogsInstance + GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + ListAccessTokens List Access Tokens + + Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest + + // ListAccessTokensExecute executes the request + // @return AccessTokenList + ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + ListLogsInstances List Logs instances + + Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest + */ + ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest + + // ListLogsInstancesExecute executes the request + // @return LogsInstancesList + ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + + /* + UpdateAccessToken Update Access Token + + Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest + + // UpdateAccessTokenExecute executes the request + UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) + + /* + UpdateLogsInstance Update Logs instance + + Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest + */ + UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest + + // UpdateLogsInstanceExecute executes the request + // @return LogsInstance + UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r ApiCreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r ApiCreateAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.CreateAccessTokenExecute(r) +} + +/* +CreateAccessToken Create Access Token + +Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *DefaultAPIService) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, nil, reportError("createAccessTokenPayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createLogsInstancePayload *CreateLogsInstancePayload +} + +func (r ApiCreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { + r.createLogsInstancePayload = &createLogsInstancePayload + return r +} + +func (r ApiCreateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.CreateLogsInstanceExecute(r) +} + +/* +CreateLogsInstance Create Logs instance + +Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest +*/ +func (a *DefaultAPIService) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("createLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiDeleteAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteAccessTokenExecute(r) +} + +/* +DeleteAccessToken Delete Access Token + +Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *DefaultAPIService) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteAllAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllAccessTokensExecute(r) +} + +/* +DeleteAllAccessTokens Delete All Access Tokens + +Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAllExpiredAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllExpiredAccessTokensExecute(r) +} + +/* +DeleteAllExpiredAccessTokens Deletes all expired access tokens + +Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllExpiredAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteLogsInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteLogsInstanceExecute(r) +} + +/* +DeleteLogsInstance Delete Logs instance + +Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest +*/ +func (a *DefaultAPIService) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteLogsInstance") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiGetAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.GetAccessTokenExecute(r) +} + +/* +GetAccessToken Get Access Token + +Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *DefaultAPIService) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiGetLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.GetLogsInstanceExecute(r) +} + +/* +GetLogsInstance Get Logs Instance + +Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest +*/ +func (a *DefaultAPIService) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiListAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.ListAccessTokensExecute(r) +} + +/* +ListAccessTokens List Access Tokens + +Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest +*/ +func (a *DefaultAPIService) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListLogsInstancesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string +} + +func (r ApiListLogsInstancesRequest) Execute() (*LogsInstancesList, *http.Response, error) { + return r.ApiService.ListLogsInstancesExecute(r) +} + +/* +ListLogsInstances List Logs instances + +Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest +*/ +func (a *DefaultAPIService) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstancesList +func (a *DefaultAPIService) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstancesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListLogsInstances") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r ApiUpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r ApiUpdateAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.UpdateAccessTokenExecute(r) +} + +/* +UpdateAccessToken Update Access Token + +Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *DefaultAPIService) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return nil, reportError("updateAccessTokenPayload 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{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateLogsInstancePayload *UpdateLogsInstancePayload +} + +func (r ApiUpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { + r.updateLogsInstancePayload = &updateLogsInstancePayload + return r +} + +func (r ApiUpdateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.UpdateLogsInstanceExecute(r) +} + +/* +UpdateLogsInstance Update Logs instance + +Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest +*/ +func (a *DefaultAPIService) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("updateLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/services/logs/v1api/api_default_mock.go b/services/logs/v1api/api_default_mock.go new file mode 100644 index 000000000..d62ab5bbb --- /dev/null +++ b/services/logs/v1api/api_default_mock.go @@ -0,0 +1,286 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "context" + "net/http" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateAccessTokenExecuteMock can be populated to implement the behavior of the CreateAccessTokenExecute function of this mock + CreateAccessTokenExecuteMock *func(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + // CreateLogsInstanceExecuteMock can be populated to implement the behavior of the CreateLogsInstanceExecute function of this mock + CreateLogsInstanceExecuteMock *func(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // DeleteAccessTokenExecuteMock can be populated to implement the behavior of the DeleteAccessTokenExecute function of this mock + DeleteAccessTokenExecuteMock *func(r ApiDeleteAccessTokenRequest) (*http.Response, error) + // DeleteAllAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllAccessTokensExecute function of this mock + DeleteAllAccessTokensExecuteMock *func(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteAllExpiredAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllExpiredAccessTokensExecute function of this mock + DeleteAllExpiredAccessTokensExecuteMock *func(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteLogsInstanceExecuteMock can be populated to implement the behavior of the DeleteLogsInstanceExecute function of this mock + DeleteLogsInstanceExecuteMock *func(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + // GetAccessTokenExecuteMock can be populated to implement the behavior of the GetAccessTokenExecute function of this mock + GetAccessTokenExecuteMock *func(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + // GetLogsInstanceExecuteMock can be populated to implement the behavior of the GetLogsInstanceExecute function of this mock + GetLogsInstanceExecuteMock *func(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // ListAccessTokensExecuteMock can be populated to implement the behavior of the ListAccessTokensExecute function of this mock + ListAccessTokensExecuteMock *func(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // ListLogsInstancesExecuteMock can be populated to implement the behavior of the ListLogsInstancesExecute function of this mock + ListLogsInstancesExecuteMock *func(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + // UpdateAccessTokenExecuteMock can be populated to implement the behavior of the UpdateAccessTokenExecute function of this mock + UpdateAccessTokenExecuteMock *func(r ApiUpdateAccessTokenRequest) (*http.Response, error) + // UpdateLogsInstanceExecuteMock can be populated to implement the behavior of the UpdateLogsInstanceExecute function of this mock + UpdateLogsInstanceExecuteMock *func(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +func (a DefaultAPIServiceMock) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// CreateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.CreateAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.CreateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// DeleteAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + if a.DeleteAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllExpiredAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllExpiredAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllExpiredAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllExpiredAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + if a.DeleteLogsInstanceExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// GetAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.GetAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// GetLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.GetLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// ListAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.ListAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListLogsInstancesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListLogsInstancesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + if a.ListLogsInstancesExecuteMock == nil { + var localVarReturnValue *LogsInstancesList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListLogsInstancesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// UpdateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + if a.UpdateAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.UpdateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.UpdateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.UpdateLogsInstanceExecuteMock)(r) +} diff --git a/services/logs/v1api/client.go b/services/logs/v1api/client.go new file mode 100644 index 000000000..4c8754812 --- /dev/null +++ b/services/logs/v1api/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Logs API API v1.0.0 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/logs/v1api/configuration.go b/services/logs/v1api/configuration.go new file mode 100644 index 000000000..d136fda5c --- /dev/null +++ b/services/logs/v1api/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1api + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/logs", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://logs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/logs/v1api/model_access_token.go b/services/logs/v1api/model_access_token.go new file mode 100644 index 000000000..a57acca16 --- /dev/null +++ b/services/logs/v1api/model_access_token.go @@ -0,0 +1,413 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessToken{} + +// AccessToken struct for AccessToken +type AccessToken struct { + // A generated access token. Only available on creation. + AccessToken *string `json:"accessToken,omitempty"` + // The user who created the access token. + Creator string `json:"creator"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // Indicates if the access token can expire. + Expires bool `json:"expires"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` + Status string `json:"status"` + // The date and time util an access token is valid to (inclusively). + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +type _AccessToken AccessToken + +// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator string, displayName string, expires bool, id string, permissions []string, status string) *AccessToken { + this := AccessToken{} + this.Creator = creator + this.DisplayName = displayName + this.Expires = expires + this.Id = id + this.Permissions = permissions + this.Status = status + return &this +} + +// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken { + this := AccessToken{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AccessToken) GetAccessToken() string { + if o == nil || IsNil(o.AccessToken) { + var ret string + return ret + } + return *o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetAccessTokenOk() (*string, bool) { + if o == nil || IsNil(o.AccessToken) { + return nil, false + } + return o.AccessToken, true +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AccessToken) HasAccessToken() bool { + if o != nil && !IsNil(o.AccessToken) { + return true + } + + return false +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AccessToken) SetAccessToken(v string) { + o.AccessToken = &v +} + +// GetCreator returns the Creator field value +func (o *AccessToken) GetCreator() string { + if o == nil { + var ret string + return ret + } + + return o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetCreatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Creator, true +} + +// SetCreator sets field value +func (o *AccessToken) SetCreator(v string) { + o.Creator = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessToken) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessToken) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AccessToken) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessToken) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *AccessToken) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpires returns the Expires field value +func (o *AccessToken) GetExpires() bool { + if o == nil { + var ret bool + return ret + } + + return o.Expires +} + +// GetExpiresOk returns a tuple with the Expires field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetExpiresOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Expires, true +} + +// SetExpires sets field value +func (o *AccessToken) SetExpires(v bool) { + o.Expires = v +} + +// GetId returns the Id field value +func (o *AccessToken) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AccessToken) SetId(v string) { + o.Id = v +} + +// GetPermissions returns the Permissions field value +func (o *AccessToken) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *AccessToken) SetPermissions(v []string) { + o.Permissions = v +} + +// GetStatus returns the Status field value +func (o *AccessToken) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *AccessToken) SetStatus(v string) { + o.Status = v +} + +// GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +func (o *AccessToken) GetValidUntil() time.Time { + if o == nil || IsNil(o.ValidUntil) { + var ret time.Time + return ret + } + return *o.ValidUntil +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetValidUntilOk() (*time.Time, bool) { + if o == nil || IsNil(o.ValidUntil) { + return nil, false + } + return o.ValidUntil, true +} + +// HasValidUntil returns a boolean if a field has been set. +func (o *AccessToken) HasValidUntil() bool { + if o != nil && !IsNil(o.ValidUntil) { + return true + } + + return false +} + +// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +func (o *AccessToken) SetValidUntil(v time.Time) { + o.ValidUntil = &v +} + +func (o AccessToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessToken) { + toSerialize["accessToken"] = o.AccessToken + } + toSerialize["creator"] = o.Creator + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["expires"] = o.Expires + toSerialize["id"] = o.Id + toSerialize["permissions"] = o.Permissions + toSerialize["status"] = o.Status + if !IsNil(o.ValidUntil) { + toSerialize["validUntil"] = o.ValidUntil + } + return toSerialize, nil +} + +func (o *AccessToken) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "creator", + "displayName", + "expires", + "id", + "permissions", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessToken := _AccessToken{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessToken) + + if err != nil { + return err + } + + *o = AccessToken(varAccessToken) + + return err +} + +type NullableAccessToken struct { + value *AccessToken + isSet bool +} + +func (v NullableAccessToken) Get() *AccessToken { + return v.value +} + +func (v *NullableAccessToken) Set(val *AccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { + return &NullableAccessToken{value: val, isSet: true} +} + +func (v NullableAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_access_token_list.go b/services/logs/v1api/model_access_token_list.go new file mode 100644 index 000000000..b44d1ad9e --- /dev/null +++ b/services/logs/v1api/model_access_token_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenList{} + +// AccessTokenList struct for AccessTokenList +type AccessTokenList struct { + Tokens []AccessToken `json:"tokens"` +} + +type _AccessTokenList AccessTokenList + +// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens []AccessToken) *AccessTokenList { + this := AccessTokenList{} + this.Tokens = tokens + return &this +} + +// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList { + this := AccessTokenList{} + return &this +} + +// GetTokens returns the Tokens field value +func (o *AccessTokenList) GetTokens() []AccessToken { + if o == nil { + var ret []AccessToken + return ret + } + + return o.Tokens +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *AccessTokenList) GetTokensOk() ([]AccessToken, bool) { + if o == nil { + return nil, false + } + return o.Tokens, true +} + +// SetTokens sets field value +func (o *AccessTokenList) SetTokens(v []AccessToken) { + o.Tokens = v +} + +func (o AccessTokenList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tokens"] = o.Tokens + return toSerialize, nil +} + +func (o *AccessTokenList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "tokens", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessTokenList := _AccessTokenList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessTokenList) + + if err != nil { + return err + } + + *o = AccessTokenList(varAccessTokenList) + + return err +} + +type NullableAccessTokenList struct { + value *AccessTokenList + isSet bool +} + +func (v NullableAccessTokenList) Get() *AccessTokenList { + return v.value +} + +func (v *NullableAccessTokenList) Set(val *AccessTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { + return &NullableAccessTokenList{value: val, isSet: true} +} + +func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_create_access_token_payload.go b/services/logs/v1api/model_create_access_token_payload.go new file mode 100644 index 000000000..94433d08c --- /dev/null +++ b/services/logs/v1api/model_create_access_token_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A lifetime period for an access token in days. If unset the token will not expire. + Lifetime *int32 `json:"lifetime,omitempty"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName string, permissions []string) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + this.DisplayName = displayName + this.Permissions = permissions + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetLifetime() int32 { + if o == nil || IsNil(o.Lifetime) { + var ret int32 + return ret + } + return *o.Lifetime +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetLifetimeOk() (*int32, bool) { + if o == nil || IsNil(o.Lifetime) { + return nil, false + } + return o.Lifetime, true +} + +// HasLifetime returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasLifetime() bool { + if o != nil && !IsNil(o.Lifetime) { + return true + } + + return false +} + +// SetLifetime gets a reference to the given int32 and assigns it to the Lifetime field. +func (o *CreateAccessTokenPayload) SetLifetime(v int32) { + o.Lifetime = &v +} + +// GetPermissions returns the Permissions field value +func (o *CreateAccessTokenPayload) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *CreateAccessTokenPayload) SetPermissions(v []string) { + o.Permissions = v +} + +func (o CreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Lifetime) { + toSerialize["lifetime"] = o.Lifetime + } + toSerialize["permissions"] = o.Permissions + return toSerialize, nil +} + +func (o *CreateAccessTokenPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "permissions", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateAccessTokenPayload := _CreateAccessTokenPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateAccessTokenPayload) + + if err != nil { + return err + } + + *o = CreateAccessTokenPayload(varCreateAccessTokenPayload) + + return err +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_create_logs_instance_payload.go b/services/logs/v1api/model_create_logs_instance_payload.go new file mode 100644 index 000000000..ad133f759 --- /dev/null +++ b/services/logs/v1api/model_create_logs_instance_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLogsInstancePayload{} + +// CreateLogsInstancePayload struct for CreateLogsInstancePayload +type CreateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` +} + +type _CreateLogsInstancePayload CreateLogsInstancePayload + +// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName string, retentionDays int32) *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + this.DisplayName = displayName + this.RetentionDays = retentionDays + return &this +} + +// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateLogsInstancePayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *CreateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *CreateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +func (o CreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["retentionDays"] = o.RetentionDays + return toSerialize, nil +} + +func (o *CreateLogsInstancePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "retentionDays", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateLogsInstancePayload := _CreateLogsInstancePayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateLogsInstancePayload) + + if err != nil { + return err + } + + *o = CreateLogsInstancePayload(varCreateLogsInstancePayload) + + return err +} + +type NullableCreateLogsInstancePayload struct { + value *CreateLogsInstancePayload + isSet bool +} + +func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { + return v.value +} + +func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { + return &NullableCreateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_logs_instance.go b/services/logs/v1api/model_logs_instance.go new file mode 100644 index 000000000..c4ac3f056 --- /dev/null +++ b/services/logs/v1api/model_logs_instance.go @@ -0,0 +1,533 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the LogsInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstance{} + +// LogsInstance struct for LogsInstance +type LogsInstance struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The date and time the creation of the Logs instance was triggered. + Created time.Time `json:"created"` + // The Logs instance's datasource URL, can be used in Grafana as a datasource URL + DatasourceUrl *string `json:"datasourceUrl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name of the Logs instance. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A auto generated unique id which identifies the Logs instance. + Id string `json:"id"` + // The Logs instance's ingest logs via OTLP URL + IngestOtlpUrl *string `json:"ingestOtlpUrl,omitempty"` + // The Logs instance's ingest logs URL + IngestUrl *string `json:"ingestUrl,omitempty"` + // The Logs instance's query range URL + QueryRangeUrl *string `json:"queryRangeUrl,omitempty"` + // The Logs instance's query URL + QueryUrl *string `json:"queryUrl,omitempty"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` + // The current status of the Logs instance. + Status string `json:"status"` +} + +type _LogsInstance LogsInstance + +// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created time.Time, displayName string, id string, retentionDays int32, status string) *LogsInstance { + this := LogsInstance{} + this.Created = created + this.DisplayName = displayName + this.Id = id + this.RetentionDays = retentionDays + this.Status = status + return &this +} + +// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance { + this := LogsInstance{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *LogsInstance) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *LogsInstance) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *LogsInstance) SetAcl(v []string) { + o.Acl = v +} + +// GetCreated returns the Created field value +func (o *LogsInstance) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value +func (o *LogsInstance) SetCreated(v time.Time) { + o.Created = v +} + +// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetDatasourceUrl() string { + if o == nil || IsNil(o.DatasourceUrl) { + var ret string + return ret + } + return *o.DatasourceUrl +} + +// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDatasourceUrlOk() (*string, bool) { + if o == nil || IsNil(o.DatasourceUrl) { + return nil, false + } + return o.DatasourceUrl, true +} + +// HasDatasourceUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasDatasourceUrl() bool { + if o != nil && !IsNil(o.DatasourceUrl) { + return true + } + + return false +} + +// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +func (o *LogsInstance) SetDatasourceUrl(v string) { + o.DatasourceUrl = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsInstance) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsInstance) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsInstance) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *LogsInstance) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *LogsInstance) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value +func (o *LogsInstance) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *LogsInstance) SetId(v string) { + o.Id = v +} + +// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestOtlpUrl() string { + if o == nil || IsNil(o.IngestOtlpUrl) { + var ret string + return ret + } + return *o.IngestOtlpUrl +} + +// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestOtlpUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestOtlpUrl) { + return nil, false + } + return o.IngestOtlpUrl, true +} + +// HasIngestOtlpUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestOtlpUrl() bool { + if o != nil && !IsNil(o.IngestOtlpUrl) { + return true + } + + return false +} + +// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +func (o *LogsInstance) SetIngestOtlpUrl(v string) { + o.IngestOtlpUrl = &v +} + +// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestUrl() string { + if o == nil || IsNil(o.IngestUrl) { + var ret string + return ret + } + return *o.IngestUrl +} + +// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestUrl) { + return nil, false + } + return o.IngestUrl, true +} + +// HasIngestUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestUrl() bool { + if o != nil && !IsNil(o.IngestUrl) { + return true + } + + return false +} + +// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +func (o *LogsInstance) SetIngestUrl(v string) { + o.IngestUrl = &v +} + +// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryRangeUrl() string { + if o == nil || IsNil(o.QueryRangeUrl) { + var ret string + return ret + } + return *o.QueryRangeUrl +} + +// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryRangeUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryRangeUrl) { + return nil, false + } + return o.QueryRangeUrl, true +} + +// HasQueryRangeUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryRangeUrl() bool { + if o != nil && !IsNil(o.QueryRangeUrl) { + return true + } + + return false +} + +// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +func (o *LogsInstance) SetQueryRangeUrl(v string) { + o.QueryRangeUrl = &v +} + +// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryUrl() string { + if o == nil || IsNil(o.QueryUrl) { + var ret string + return ret + } + return *o.QueryUrl +} + +// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryUrl) { + return nil, false + } + return o.QueryUrl, true +} + +// HasQueryUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryUrl() bool { + if o != nil && !IsNil(o.QueryUrl) { + return true + } + + return false +} + +// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +func (o *LogsInstance) SetQueryUrl(v string) { + o.QueryUrl = &v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *LogsInstance) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *LogsInstance) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +// GetStatus returns the Status field value +func (o *LogsInstance) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *LogsInstance) SetStatus(v string) { + o.Status = v +} + +func (o LogsInstance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + toSerialize["created"] = o.Created + if !IsNil(o.DatasourceUrl) { + toSerialize["datasourceUrl"] = o.DatasourceUrl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["id"] = o.Id + if !IsNil(o.IngestOtlpUrl) { + toSerialize["ingestOtlpUrl"] = o.IngestOtlpUrl + } + if !IsNil(o.IngestUrl) { + toSerialize["ingestUrl"] = o.IngestUrl + } + if !IsNil(o.QueryRangeUrl) { + toSerialize["queryRangeUrl"] = o.QueryRangeUrl + } + if !IsNil(o.QueryUrl) { + toSerialize["queryUrl"] = o.QueryUrl + } + toSerialize["retentionDays"] = o.RetentionDays + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *LogsInstance) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "created", + "displayName", + "id", + "retentionDays", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstance := _LogsInstance{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstance) + + if err != nil { + return err + } + + *o = LogsInstance(varLogsInstance) + + return err +} + +type NullableLogsInstance struct { + value *LogsInstance + isSet bool +} + +func (v NullableLogsInstance) Get() *LogsInstance { + return v.value +} + +func (v *NullableLogsInstance) Set(val *LogsInstance) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { + return &NullableLogsInstance{value: val, isSet: true} +} + +func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_logs_instances_list.go b/services/logs/v1api/model_logs_instances_list.go new file mode 100644 index 000000000..6be5cbcaf --- /dev/null +++ b/services/logs/v1api/model_logs_instances_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstancesList{} + +// LogsInstancesList struct for LogsInstancesList +type LogsInstancesList struct { + Instances []LogsInstance `json:"instances"` +} + +type _LogsInstancesList LogsInstancesList + +// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances []LogsInstance) *LogsInstancesList { + this := LogsInstancesList{} + this.Instances = instances + return &this +} + +// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList { + this := LogsInstancesList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *LogsInstancesList) GetInstances() []LogsInstance { + if o == nil { + var ret []LogsInstance + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *LogsInstancesList) GetInstancesOk() ([]LogsInstance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *LogsInstancesList) SetInstances(v []LogsInstance) { + o.Instances = v +} + +func (o LogsInstancesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + return toSerialize, nil +} + +func (o *LogsInstancesList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "instances", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstancesList := _LogsInstancesList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstancesList) + + if err != nil { + return err + } + + *o = LogsInstancesList(varLogsInstancesList) + + return err +} + +type NullableLogsInstancesList struct { + value *LogsInstancesList + isSet bool +} + +func (v NullableLogsInstancesList) Get() *LogsInstancesList { + return v.value +} + +func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstancesList) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstancesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { + return &NullableLogsInstancesList{value: val, isSet: true} +} + +func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_update_access_token_payload.go b/services/logs/v1api/model_update_access_token_payload.go new file mode 100644 index 000000000..48c23b14b --- /dev/null +++ b/services/logs/v1api/model_update_access_token_payload.go @@ -0,0 +1,162 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` +} + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +func (o UpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + return toSerialize, nil +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/model_update_logs_instance_payload.go b/services/logs/v1api/model_update_logs_instance_payload.go new file mode 100644 index 000000000..21a6582c6 --- /dev/null +++ b/services/logs/v1api/model_update_logs_instance_payload.go @@ -0,0 +1,236 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "encoding/json" +) + +// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLogsInstancePayload{} + +// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +type UpdateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + +// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *UpdateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil || IsNil(o.RetentionDays) { + var ret int32 + return ret + } + return *o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil || IsNil(o.RetentionDays) { + return nil, false + } + return o.RetentionDays, true +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { + if o != nil && !IsNil(o.RetentionDays) { + return true + } + + return false +} + +// SetRetentionDays gets a reference to the given int32 and assigns it to the RetentionDays field. +func (o *UpdateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = &v +} + +func (o UpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.RetentionDays) { + toSerialize["retentionDays"] = o.RetentionDays + } + return toSerialize, nil +} + +type NullableUpdateLogsInstancePayload struct { + value *UpdateLogsInstancePayload + isSet bool +} + +func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { + return v.value +} + +func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { + return &NullableUpdateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1api/response.go b/services/logs/v1api/response.go new file mode 100644 index 000000000..9a62bfd94 --- /dev/null +++ b/services/logs/v1api/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/logs/v1api/utils.go b/services/logs/v1api/utils.go new file mode 100644 index 000000000..c1e039c0a --- /dev/null +++ b/services/logs/v1api/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1api + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/logs/v1betaapi/api_default.go b/services/logs/v1betaapi/api_default.go new file mode 100644 index 000000000..a60d13cdd --- /dev/null +++ b/services/logs/v1betaapi/api_default.go @@ -0,0 +1,1859 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +type DefaultAPI interface { + + /* + CreateAccessToken Create Access Token + + Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest + */ + CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest + + // CreateAccessTokenExecute executes the request + // @return AccessToken + CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + CreateLogsInstance Create Logs instance + + Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest + */ + CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest + + // CreateLogsInstanceExecute executes the request + // @return LogsInstance + CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + DeleteAccessToken Delete Access Token + + Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest + */ + DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest + + // DeleteAccessTokenExecute executes the request + DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) + + /* + DeleteAllAccessTokens Delete All Access Tokens + + Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest + */ + DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest + + // DeleteAllAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteAllExpiredAccessTokens Deletes all expired access tokens + + Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest + */ + DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest + + // DeleteAllExpiredAccessTokensExecute executes the request + // @return AccessTokenList + DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + DeleteLogsInstance Delete Logs instance + + Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest + */ + DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest + + // DeleteLogsInstanceExecute executes the request + DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + + /* + GetAccessToken Get Access Token + + Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest + */ + GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest + + // GetAccessTokenExecute executes the request + // @return AccessToken + GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + + /* + GetLogsInstance Get Logs Instance + + Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest + */ + GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest + + // GetLogsInstanceExecute executes the request + // @return LogsInstance + GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + + /* + ListAccessTokens List Access Tokens + + Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest + */ + ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest + + // ListAccessTokensExecute executes the request + // @return AccessTokenList + ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + + /* + ListLogsInstances List Logs instances + + Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest + */ + ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest + + // ListLogsInstancesExecute executes the request + // @return LogsInstancesList + ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + + /* + UpdateAccessToken Update Access Token + + Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest + */ + UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest + + // UpdateAccessTokenExecute executes the request + UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) + + /* + UpdateLogsInstance Update Logs instance + + Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest + */ + UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest + + // UpdateLogsInstanceExecute executes the request + // @return LogsInstance + UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +// DefaultAPIService DefaultAPI service +type DefaultAPIService service + +type ApiCreateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + createAccessTokenPayload *CreateAccessTokenPayload +} + +func (r ApiCreateAccessTokenRequest) CreateAccessTokenPayload(createAccessTokenPayload CreateAccessTokenPayload) ApiCreateAccessTokenRequest { + r.createAccessTokenPayload = &createAccessTokenPayload + return r +} + +func (r ApiCreateAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.CreateAccessTokenExecute(r) +} + +/* +CreateAccessToken Create Access Token + +Create a new Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiCreateAccessTokenRequest +*/ +func (a *DefaultAPIService) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createAccessTokenPayload == nil { + return localVarReturnValue, nil, reportError("createAccessTokenPayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiCreateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + createLogsInstancePayload *CreateLogsInstancePayload +} + +func (r ApiCreateLogsInstanceRequest) CreateLogsInstancePayload(createLogsInstancePayload CreateLogsInstancePayload) ApiCreateLogsInstanceRequest { + r.createLogsInstancePayload = &createLogsInstancePayload + return r +} + +func (r ApiCreateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.CreateLogsInstanceExecute(r) +} + +/* +CreateLogsInstance Create Logs instance + +Creates a new Logs instance within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiCreateLogsInstanceRequest +*/ +func (a *DefaultAPIService) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.CreateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("createLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.createLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiDeleteAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteAccessTokenExecute(r) +} + +/* +DeleteAccessToken Delete Access Token + +Deletes a Logs instance access token + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiDeleteAccessTokenRequest +*/ +func (a *DefaultAPIService) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiDeleteAllAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllAccessTokensExecute(r) +} + +/* +DeleteAllAccessTokens Delete All Access Tokens + +Deletes all access tokens available for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteAllExpiredAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteAllExpiredAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.DeleteAllExpiredAccessTokensExecute(r) +} + +/* +DeleteAllExpiredAccessTokens Deletes all expired access tokens + +Deletes all expired access tokens + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteAllExpiredAccessTokensRequest +*/ +func (a *DefaultAPIService) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteAllExpiredAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiDeleteLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiDeleteLogsInstanceRequest) Execute() (*http.Response, error) { + return r.ApiService.DeleteLogsInstanceExecute(r) +} + +/* +DeleteLogsInstance Delete Logs instance + +Deletes the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiDeleteLogsInstanceRequest +*/ +func (a *DefaultAPIService) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.DeleteLogsInstance") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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{"text/plain"} + + // 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 nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiGetAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string +} + +func (r ApiGetAccessTokenRequest) Execute() (*AccessToken, *http.Response, error) { + return r.ApiService.GetAccessTokenExecute(r) +} + +/* +GetAccessToken Get Access Token + +Get the information of the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiGetAccessTokenRequest +*/ +func (a *DefaultAPIService) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +// +// @return AccessToken +func (a *DefaultAPIService) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessToken + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetAccessToken") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiGetLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiGetLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.GetLogsInstanceExecute(r) +} + +/* +GetLogsInstance Get Logs Instance + +Returns the details for the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiGetLogsInstanceRequest +*/ +func (a *DefaultAPIService) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.GetLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListAccessTokensRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string +} + +func (r ApiListAccessTokensRequest) Execute() (*AccessTokenList, *http.Response, error) { + return r.ApiService.ListAccessTokensExecute(r) +} + +/* +ListAccessTokens List Access Tokens + +Returns a list of access tokens created for a Logs instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiListAccessTokensRequest +*/ +func (a *DefaultAPIService) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return AccessTokenList +func (a *DefaultAPIService) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *AccessTokenList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListAccessTokens") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiListLogsInstancesRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string +} + +func (r ApiListLogsInstancesRequest) Execute() (*LogsInstancesList, *http.Response, error) { + return r.ApiService.ListLogsInstancesExecute(r) +} + +/* +ListLogsInstances List Logs instances + +Returns a list of all Logs instances within the project. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @return ApiListLogsInstancesRequest +*/ +func (a *DefaultAPIService) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return LogsInstancesList +func (a *DefaultAPIService) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstancesList + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.ListLogsInstances") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -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", "text/plain"} + + // 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, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +type ApiUpdateAccessTokenRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + tId string + updateAccessTokenPayload *UpdateAccessTokenPayload +} + +func (r ApiUpdateAccessTokenRequest) UpdateAccessTokenPayload(updateAccessTokenPayload UpdateAccessTokenPayload) ApiUpdateAccessTokenRequest { + r.updateAccessTokenPayload = &updateAccessTokenPayload + return r +} + +func (r ApiUpdateAccessTokenRequest) Execute() (*http.Response, error) { + return r.ApiService.UpdateAccessTokenExecute(r) +} + +/* +UpdateAccessToken Update Access Token + +Updates the given access token. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @param tId The access token UUID. + @return ApiUpdateAccessTokenRequest +*/ +func (a *DefaultAPIService) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// Execute executes the request +func (a *DefaultAPIService) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateAccessToken") + if err != nil { + return nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tId"+"}", url.PathEscape(parameterValueToString(r.tId, "tId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateAccessTokenPayload == nil { + return nil, reportError("updateAccessTokenPayload 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{"text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateAccessTokenPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return nil, 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 localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarHTTPResponse, newErr + return localVarHTTPResponse, newErr + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +type ApiUpdateLogsInstanceRequest struct { + ctx context.Context + ApiService DefaultAPI + projectId string + regionId string + instanceId string + updateLogsInstancePayload *UpdateLogsInstancePayload +} + +func (r ApiUpdateLogsInstanceRequest) UpdateLogsInstancePayload(updateLogsInstancePayload UpdateLogsInstancePayload) ApiUpdateLogsInstanceRequest { + r.updateLogsInstancePayload = &updateLogsInstancePayload + return r +} + +func (r ApiUpdateLogsInstanceRequest) Execute() (*LogsInstance, *http.Response, error) { + return r.ApiService.UpdateLogsInstanceExecute(r) +} + +/* +UpdateLogsInstance Update Logs instance + +Updates the given Logs instance. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId The STACKIT portal project UUID the resource is located in. + @param regionId The STACKIT region name the resource is located in. + @param instanceId The Logs Instance UUID. + @return ApiUpdateLogsInstanceRequest +*/ +func (a *DefaultAPIService) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return LogsInstance +func (a *DefaultAPIService) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *LogsInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultAPIService.UpdateLogsInstance") + if err != nil { + return localVarReturnValue, nil, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(parameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.updateLogsInstancePayload == nil { + return localVarReturnValue, nil, reportError("updateLogsInstancePayload 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", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.updateLogsInstancePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, nil, 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, localVarHTTPResponse, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + StatusCode: localVarHTTPResponse.StatusCode, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, localVarHTTPResponse, newErr + return localVarReturnValue, localVarHTTPResponse, newErr + } + return localVarReturnValue, localVarHTTPResponse, 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, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} diff --git a/services/logs/v1betaapi/api_default_mock.go b/services/logs/v1betaapi/api_default_mock.go new file mode 100644 index 000000000..6e8dc6296 --- /dev/null +++ b/services/logs/v1betaapi/api_default_mock.go @@ -0,0 +1,286 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "context" + "net/http" +) + +// assert the implementation matches the interface +var _ DefaultAPI = &DefaultAPIServiceMock{} + +// DefaultAPIServiceMock is meant to be used for testing only as a replacement for DefaultAPIService. +// By default all FooExecute() implementations are a no-op. Behavior of the mock can be customized by populating the callbacks in this struct. +type DefaultAPIServiceMock struct { + // CreateAccessTokenExecuteMock can be populated to implement the behavior of the CreateAccessTokenExecute function of this mock + CreateAccessTokenExecuteMock *func(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) + // CreateLogsInstanceExecuteMock can be populated to implement the behavior of the CreateLogsInstanceExecute function of this mock + CreateLogsInstanceExecuteMock *func(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // DeleteAccessTokenExecuteMock can be populated to implement the behavior of the DeleteAccessTokenExecute function of this mock + DeleteAccessTokenExecuteMock *func(r ApiDeleteAccessTokenRequest) (*http.Response, error) + // DeleteAllAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllAccessTokensExecute function of this mock + DeleteAllAccessTokensExecuteMock *func(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteAllExpiredAccessTokensExecuteMock can be populated to implement the behavior of the DeleteAllExpiredAccessTokensExecute function of this mock + DeleteAllExpiredAccessTokensExecuteMock *func(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // DeleteLogsInstanceExecuteMock can be populated to implement the behavior of the DeleteLogsInstanceExecute function of this mock + DeleteLogsInstanceExecuteMock *func(r ApiDeleteLogsInstanceRequest) (*http.Response, error) + // GetAccessTokenExecuteMock can be populated to implement the behavior of the GetAccessTokenExecute function of this mock + GetAccessTokenExecuteMock *func(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) + // GetLogsInstanceExecuteMock can be populated to implement the behavior of the GetLogsInstanceExecute function of this mock + GetLogsInstanceExecuteMock *func(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) + // ListAccessTokensExecuteMock can be populated to implement the behavior of the ListAccessTokensExecute function of this mock + ListAccessTokensExecuteMock *func(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) + // ListLogsInstancesExecuteMock can be populated to implement the behavior of the ListLogsInstancesExecute function of this mock + ListLogsInstancesExecuteMock *func(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) + // UpdateAccessTokenExecuteMock can be populated to implement the behavior of the UpdateAccessTokenExecute function of this mock + UpdateAccessTokenExecuteMock *func(r ApiUpdateAccessTokenRequest) (*http.Response, error) + // UpdateLogsInstanceExecuteMock can be populated to implement the behavior of the UpdateLogsInstanceExecute function of this mock + UpdateLogsInstanceExecuteMock *func(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) +} + +func (a DefaultAPIServiceMock) CreateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string) ApiCreateAccessTokenRequest { + return ApiCreateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// CreateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateAccessTokenExecute(r ApiCreateAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.CreateAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) CreateLogsInstance(ctx context.Context, projectId string, regionId string) ApiCreateLogsInstanceRequest { + return ApiCreateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// CreateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the CreateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) CreateLogsInstanceExecute(r ApiCreateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.CreateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.CreateLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiDeleteAccessTokenRequest { + return ApiDeleteAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// DeleteAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAccessTokenExecute(r ApiDeleteAccessTokenRequest) (*http.Response, error) { + if a.DeleteAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllAccessTokensRequest { + return ApiDeleteAllAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllAccessTokensExecute(r ApiDeleteAllAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteAllExpiredAccessTokensRequest { + return ApiDeleteAllExpiredAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteAllExpiredAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteAllExpiredAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteAllExpiredAccessTokensExecute(r ApiDeleteAllExpiredAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.DeleteAllExpiredAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.DeleteAllExpiredAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) DeleteLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiDeleteLogsInstanceRequest { + return ApiDeleteLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// DeleteLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the DeleteLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) DeleteLogsInstanceExecute(r ApiDeleteLogsInstanceRequest) (*http.Response, error) { + if a.DeleteLogsInstanceExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.DeleteLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiGetAccessTokenRequest { + return ApiGetAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// GetAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetAccessTokenExecute(r ApiGetAccessTokenRequest) (*AccessToken, *http.Response, error) { + if a.GetAccessTokenExecuteMock == nil { + var localVarReturnValue *AccessToken + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) GetLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiGetLogsInstanceRequest { + return ApiGetLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// GetLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the GetLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) GetLogsInstanceExecute(r ApiGetLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.GetLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.GetLogsInstanceExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListAccessTokens(ctx context.Context, projectId string, regionId string, instanceId string) ApiListAccessTokensRequest { + return ApiListAccessTokensRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// ListAccessTokensExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListAccessTokensExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListAccessTokensExecute(r ApiListAccessTokensRequest) (*AccessTokenList, *http.Response, error) { + if a.ListAccessTokensExecuteMock == nil { + var localVarReturnValue *AccessTokenList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListAccessTokensExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) ListLogsInstances(ctx context.Context, projectId string, regionId string) ApiListLogsInstancesRequest { + return ApiListLogsInstancesRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + } +} + +// ListLogsInstancesExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the ListLogsInstancesExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) ListLogsInstancesExecute(r ApiListLogsInstancesRequest) (*LogsInstancesList, *http.Response, error) { + if a.ListLogsInstancesExecuteMock == nil { + var localVarReturnValue *LogsInstancesList + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.ListLogsInstancesExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateAccessToken(ctx context.Context, projectId string, regionId string, instanceId string, tId string) ApiUpdateAccessTokenRequest { + return ApiUpdateAccessTokenRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + tId: tId, + } +} + +// UpdateAccessTokenExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateAccessTokenExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateAccessTokenExecute(r ApiUpdateAccessTokenRequest) (*http.Response, error) { + if a.UpdateAccessTokenExecuteMock == nil { + return &http.Response{}, nil + } + + return (*a.UpdateAccessTokenExecuteMock)(r) +} + +func (a DefaultAPIServiceMock) UpdateLogsInstance(ctx context.Context, projectId string, regionId string, instanceId string) ApiUpdateLogsInstanceRequest { + return ApiUpdateLogsInstanceRequest{ + ApiService: a, + ctx: ctx, + projectId: projectId, + regionId: regionId, + instanceId: instanceId, + } +} + +// UpdateLogsInstanceExecute is a no-op by default and will return only return nil values. Behavior can be controlled by populating the UpdateLogsInstanceExecuteMock field in the DefaultAPIServiceMock struct. +func (a DefaultAPIServiceMock) UpdateLogsInstanceExecute(r ApiUpdateLogsInstanceRequest) (*LogsInstance, *http.Response, error) { + if a.UpdateLogsInstanceExecuteMock == nil { + var localVarReturnValue *LogsInstance + return localVarReturnValue, &http.Response{}, nil + } + + return (*a.UpdateLogsInstanceExecuteMock)(r) +} diff --git a/services/logs/v1betaapi/client.go b/services/logs/v1betaapi/client.go new file mode 100644 index 000000000..1bcb3651f --- /dev/null +++ b/services/logs/v1betaapi/client.go @@ -0,0 +1,658 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" + + "github.com/stackitcloud/stackit-sdk-go/core/auth" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the STACKIT Logs API API v1beta.0.3 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *config.Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + DefaultAPI DefaultAPI +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) { + cfg := NewConfiguration() + + for _, option := range opts { + err := option(cfg) + if err != nil { + return nil, fmt.Errorf("configuring the client: %w", err) + } + } + + err := config.ConfigureRegion(cfg) + if err != nil { + return nil, fmt.Errorf("configuring region: %w", err) + } + + if cfg.HTTPClient == nil { + cfg.HTTPClient = &http.Client{} + } + + authRoundTripper, err := auth.SetupAuth(cfg) + if err != nil { + return nil, fmt.Errorf("setting up authentication: %w", err) + } + + roundTripper := authRoundTripper + if cfg.Middleware != nil { + roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...) + } + + cfg.HTTPClient.Transport = roundTripper + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.DefaultAPI = (*DefaultAPIService)(&c.common) + + return c, nil +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + if actualObj, ok := obj.(interface{ GetActualInstanceValue() interface{} }); ok { + return fmt.Sprintf("%v", actualObj.GetActualInstanceValue()) + } + + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *config.Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + defer file.Close() + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/services/logs/v1betaapi/configuration.go b/services/logs/v1betaapi/configuration.go new file mode 100644 index 000000000..c746a7052 --- /dev/null +++ b/services/logs/v1betaapi/configuration.go @@ -0,0 +1,37 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. +package v1betaapi + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/logs", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://logs.api.stackit.cloud", + Description: "No description provided", + Variables: map[string]config.ServerVariable{ + "region": { + Description: "No description provided", + DefaultValue: "global", + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + return cfg +} diff --git a/services/logs/v1betaapi/model_access_token.go b/services/logs/v1betaapi/model_access_token.go new file mode 100644 index 000000000..fef60a1e2 --- /dev/null +++ b/services/logs/v1betaapi/model_access_token.go @@ -0,0 +1,413 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the AccessToken type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessToken{} + +// AccessToken struct for AccessToken +type AccessToken struct { + // A generated access token. Only available on creation. + AccessToken *string `json:"accessToken,omitempty"` + // The user who created the access token. + Creator string `json:"creator"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // Indicates if the access token can expire. + Expires bool `json:"expires"` + // An auto generated unique id which identifies the access token. + Id string `json:"id"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` + Status string `json:"status"` + // The date and time util an access token is valid to (inclusively). + ValidUntil *time.Time `json:"validUntil,omitempty"` +} + +type _AccessToken AccessToken + +// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator string, displayName string, expires bool, id string, permissions []string, status string) *AccessToken { + this := AccessToken{} + this.Creator = creator + this.DisplayName = displayName + this.Expires = expires + this.Id = id + this.Permissions = permissions + this.Status = status + return &this +} + +// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken { + this := AccessToken{} + return &this +} + +// GetAccessToken returns the AccessToken field value if set, zero value otherwise. +func (o *AccessToken) GetAccessToken() string { + if o == nil || IsNil(o.AccessToken) { + var ret string + return ret + } + return *o.AccessToken +} + +// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetAccessTokenOk() (*string, bool) { + if o == nil || IsNil(o.AccessToken) { + return nil, false + } + return o.AccessToken, true +} + +// HasAccessToken returns a boolean if a field has been set. +func (o *AccessToken) HasAccessToken() bool { + if o != nil && !IsNil(o.AccessToken) { + return true + } + + return false +} + +// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field. +func (o *AccessToken) SetAccessToken(v string) { + o.AccessToken = &v +} + +// GetCreator returns the Creator field value +func (o *AccessToken) GetCreator() string { + if o == nil { + var ret string + return ret + } + + return o.Creator +} + +// GetCreatorOk returns a tuple with the Creator field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetCreatorOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Creator, true +} + +// SetCreator sets field value +func (o *AccessToken) SetCreator(v string) { + o.Creator = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *AccessToken) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *AccessToken) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *AccessToken) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *AccessToken) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *AccessToken) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetExpires returns the Expires field value +func (o *AccessToken) GetExpires() bool { + if o == nil { + var ret bool + return ret + } + + return o.Expires +} + +// GetExpiresOk returns a tuple with the Expires field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetExpiresOk() (*bool, bool) { + if o == nil { + return nil, false + } + return &o.Expires, true +} + +// SetExpires sets field value +func (o *AccessToken) SetExpires(v bool) { + o.Expires = v +} + +// GetId returns the Id field value +func (o *AccessToken) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *AccessToken) SetId(v string) { + o.Id = v +} + +// GetPermissions returns the Permissions field value +func (o *AccessToken) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *AccessToken) SetPermissions(v []string) { + o.Permissions = v +} + +// GetStatus returns the Status field value +func (o *AccessToken) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *AccessToken) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *AccessToken) SetStatus(v string) { + o.Status = v +} + +// GetValidUntil returns the ValidUntil field value if set, zero value otherwise. +func (o *AccessToken) GetValidUntil() time.Time { + if o == nil || IsNil(o.ValidUntil) { + var ret time.Time + return ret + } + return *o.ValidUntil +} + +// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AccessToken) GetValidUntilOk() (*time.Time, bool) { + if o == nil || IsNil(o.ValidUntil) { + return nil, false + } + return o.ValidUntil, true +} + +// HasValidUntil returns a boolean if a field has been set. +func (o *AccessToken) HasValidUntil() bool { + if o != nil && !IsNil(o.ValidUntil) { + return true + } + + return false +} + +// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field. +func (o *AccessToken) SetValidUntil(v time.Time) { + o.ValidUntil = &v +} + +func (o AccessToken) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessToken) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AccessToken) { + toSerialize["accessToken"] = o.AccessToken + } + toSerialize["creator"] = o.Creator + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["expires"] = o.Expires + toSerialize["id"] = o.Id + toSerialize["permissions"] = o.Permissions + toSerialize["status"] = o.Status + if !IsNil(o.ValidUntil) { + toSerialize["validUntil"] = o.ValidUntil + } + return toSerialize, nil +} + +func (o *AccessToken) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "creator", + "displayName", + "expires", + "id", + "permissions", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessToken := _AccessToken{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessToken) + + if err != nil { + return err + } + + *o = AccessToken(varAccessToken) + + return err +} + +type NullableAccessToken struct { + value *AccessToken + isSet bool +} + +func (v NullableAccessToken) Get() *AccessToken { + return v.value +} + +func (v *NullableAccessToken) Set(val *AccessToken) { + v.value = val + v.isSet = true +} + +func (v NullableAccessToken) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessToken) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessToken(val *AccessToken) *NullableAccessToken { + return &NullableAccessToken{value: val, isSet: true} +} + +func (v NullableAccessToken) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessToken) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_access_token_list.go b/services/logs/v1betaapi/model_access_token_list.go new file mode 100644 index 000000000..40d997352 --- /dev/null +++ b/services/logs/v1betaapi/model_access_token_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AccessTokenList{} + +// AccessTokenList struct for AccessTokenList +type AccessTokenList struct { + Tokens []AccessToken `json:"tokens"` +} + +type _AccessTokenList AccessTokenList + +// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens []AccessToken) *AccessTokenList { + this := AccessTokenList{} + this.Tokens = tokens + return &this +} + +// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList { + this := AccessTokenList{} + return &this +} + +// GetTokens returns the Tokens field value +func (o *AccessTokenList) GetTokens() []AccessToken { + if o == nil { + var ret []AccessToken + return ret + } + + return o.Tokens +} + +// GetTokensOk returns a tuple with the Tokens field value +// and a boolean to check if the value has been set. +func (o *AccessTokenList) GetTokensOk() ([]AccessToken, bool) { + if o == nil { + return nil, false + } + return o.Tokens, true +} + +// SetTokens sets field value +func (o *AccessTokenList) SetTokens(v []AccessToken) { + o.Tokens = v +} + +func (o AccessTokenList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AccessTokenList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["tokens"] = o.Tokens + return toSerialize, nil +} + +func (o *AccessTokenList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "tokens", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varAccessTokenList := _AccessTokenList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varAccessTokenList) + + if err != nil { + return err + } + + *o = AccessTokenList(varAccessTokenList) + + return err +} + +type NullableAccessTokenList struct { + value *AccessTokenList + isSet bool +} + +func (v NullableAccessTokenList) Get() *AccessTokenList { + return v.value +} + +func (v *NullableAccessTokenList) Set(val *AccessTokenList) { + v.value = val + v.isSet = true +} + +func (v NullableAccessTokenList) IsSet() bool { + return v.isSet +} + +func (v *NullableAccessTokenList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList { + return &NullableAccessTokenList{value: val, isSet: true} +} + +func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_create_access_token_payload.go b/services/logs/v1betaapi/model_create_access_token_payload.go new file mode 100644 index 000000000..929fc752b --- /dev/null +++ b/services/logs/v1betaapi/model_create_access_token_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateAccessTokenPayload{} + +// CreateAccessTokenPayload struct for CreateAccessTokenPayload +type CreateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A lifetime period for an access token in days. If unset the token will not expire. + Lifetime *int32 `json:"lifetime,omitempty"` + // The access permissions granted to the access token. + Permissions []string `json:"permissions"` +} + +type _CreateAccessTokenPayload CreateAccessTokenPayload + +// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName string, permissions []string) *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + this.DisplayName = displayName + this.Permissions = permissions + return &this +} + +// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload { + this := CreateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateAccessTokenPayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetLifetime returns the Lifetime field value if set, zero value otherwise. +func (o *CreateAccessTokenPayload) GetLifetime() int32 { + if o == nil || IsNil(o.Lifetime) { + var ret int32 + return ret + } + return *o.Lifetime +} + +// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetLifetimeOk() (*int32, bool) { + if o == nil || IsNil(o.Lifetime) { + return nil, false + } + return o.Lifetime, true +} + +// HasLifetime returns a boolean if a field has been set. +func (o *CreateAccessTokenPayload) HasLifetime() bool { + if o != nil && !IsNil(o.Lifetime) { + return true + } + + return false +} + +// SetLifetime gets a reference to the given int32 and assigns it to the Lifetime field. +func (o *CreateAccessTokenPayload) SetLifetime(v int32) { + o.Lifetime = &v +} + +// GetPermissions returns the Permissions field value +func (o *CreateAccessTokenPayload) GetPermissions() []string { + if o == nil { + var ret []string + return ret + } + + return o.Permissions +} + +// GetPermissionsOk returns a tuple with the Permissions field value +// and a boolean to check if the value has been set. +func (o *CreateAccessTokenPayload) GetPermissionsOk() ([]string, bool) { + if o == nil { + return nil, false + } + return o.Permissions, true +} + +// SetPermissions sets field value +func (o *CreateAccessTokenPayload) SetPermissions(v []string) { + o.Permissions = v +} + +func (o CreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + if !IsNil(o.Lifetime) { + toSerialize["lifetime"] = o.Lifetime + } + toSerialize["permissions"] = o.Permissions + return toSerialize, nil +} + +func (o *CreateAccessTokenPayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "permissions", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateAccessTokenPayload := _CreateAccessTokenPayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateAccessTokenPayload) + + if err != nil { + return err + } + + *o = CreateAccessTokenPayload(varCreateAccessTokenPayload) + + return err +} + +type NullableCreateAccessTokenPayload struct { + value *CreateAccessTokenPayload + isSet bool +} + +func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload { + return v.value +} + +func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload { + return &NullableCreateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_create_logs_instance_payload.go b/services/logs/v1betaapi/model_create_logs_instance_payload.go new file mode 100644 index 000000000..7ae93724f --- /dev/null +++ b/services/logs/v1betaapi/model_create_logs_instance_payload.go @@ -0,0 +1,260 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateLogsInstancePayload{} + +// CreateLogsInstancePayload struct for CreateLogsInstancePayload +type CreateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` +} + +type _CreateLogsInstancePayload CreateLogsInstancePayload + +// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName string, retentionDays int32) *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + this.DisplayName = displayName + this.RetentionDays = retentionDays + return &this +} + +// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload { + this := CreateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *CreateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *CreateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *CreateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *CreateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *CreateLogsInstancePayload) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *CreateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *CreateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *CreateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +func (o CreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["retentionDays"] = o.RetentionDays + return toSerialize, nil +} + +func (o *CreateLogsInstancePayload) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "displayName", + "retentionDays", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varCreateLogsInstancePayload := _CreateLogsInstancePayload{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varCreateLogsInstancePayload) + + if err != nil { + return err + } + + *o = CreateLogsInstancePayload(varCreateLogsInstancePayload) + + return err +} + +type NullableCreateLogsInstancePayload struct { + value *CreateLogsInstancePayload + isSet bool +} + +func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload { + return v.value +} + +func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload { + return &NullableCreateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_logs_instance.go b/services/logs/v1betaapi/model_logs_instance.go new file mode 100644 index 000000000..2ea7b43ed --- /dev/null +++ b/services/logs/v1betaapi/model_logs_instance.go @@ -0,0 +1,533 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "time" +) + +// checks if the LogsInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstance{} + +// LogsInstance struct for LogsInstance +type LogsInstance struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The date and time the creation of the Logs instance was triggered. + Created time.Time `json:"created"` + // The Logs instance's datasource URL, can be used in Grafana as a datasource URL + DatasourceUrl *string `json:"datasourceUrl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name of the Logs instance. + DisplayName string `json:"displayName" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // A auto generated unique id which identifies the Logs instance. + Id string `json:"id"` + // The Logs instance's ingest logs via OTLP URL + IngestOtlpUrl *string `json:"ingestOtlpUrl,omitempty"` + // The Logs instance's ingest logs URL + IngestUrl *string `json:"ingestUrl,omitempty"` + // The Logs instance's query range URL + QueryRangeUrl *string `json:"queryRangeUrl,omitempty"` + // The Logs instance's query URL + QueryUrl *string `json:"queryUrl,omitempty"` + // The log retention time in days. + RetentionDays int32 `json:"retentionDays"` + // The current status of the Logs instance. + Status string `json:"status"` +} + +type _LogsInstance LogsInstance + +// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created time.Time, displayName string, id string, retentionDays int32, status string) *LogsInstance { + this := LogsInstance{} + this.Created = created + this.DisplayName = displayName + this.Id = id + this.RetentionDays = retentionDays + this.Status = status + return &this +} + +// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance { + this := LogsInstance{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *LogsInstance) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *LogsInstance) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *LogsInstance) SetAcl(v []string) { + o.Acl = v +} + +// GetCreated returns the Created field value +func (o *LogsInstance) GetCreated() time.Time { + if o == nil { + var ret time.Time + return ret + } + + return o.Created +} + +// GetCreatedOk returns a tuple with the Created field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetCreatedOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.Created, true +} + +// SetCreated sets field value +func (o *LogsInstance) SetCreated(v time.Time) { + o.Created = v +} + +// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetDatasourceUrl() string { + if o == nil || IsNil(o.DatasourceUrl) { + var ret string + return ret + } + return *o.DatasourceUrl +} + +// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDatasourceUrlOk() (*string, bool) { + if o == nil || IsNil(o.DatasourceUrl) { + return nil, false + } + return o.DatasourceUrl, true +} + +// HasDatasourceUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasDatasourceUrl() bool { + if o != nil && !IsNil(o.DatasourceUrl) { + return true + } + + return false +} + +// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field. +func (o *LogsInstance) SetDatasourceUrl(v string) { + o.DatasourceUrl = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *LogsInstance) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *LogsInstance) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *LogsInstance) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *LogsInstance) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *LogsInstance) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetId returns the Id field value +func (o *LogsInstance) GetId() string { + if o == nil { + var ret string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value +func (o *LogsInstance) SetId(v string) { + o.Id = v +} + +// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestOtlpUrl() string { + if o == nil || IsNil(o.IngestOtlpUrl) { + var ret string + return ret + } + return *o.IngestOtlpUrl +} + +// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestOtlpUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestOtlpUrl) { + return nil, false + } + return o.IngestOtlpUrl, true +} + +// HasIngestOtlpUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestOtlpUrl() bool { + if o != nil && !IsNil(o.IngestOtlpUrl) { + return true + } + + return false +} + +// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field. +func (o *LogsInstance) SetIngestOtlpUrl(v string) { + o.IngestOtlpUrl = &v +} + +// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetIngestUrl() string { + if o == nil || IsNil(o.IngestUrl) { + var ret string + return ret + } + return *o.IngestUrl +} + +// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetIngestUrlOk() (*string, bool) { + if o == nil || IsNil(o.IngestUrl) { + return nil, false + } + return o.IngestUrl, true +} + +// HasIngestUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasIngestUrl() bool { + if o != nil && !IsNil(o.IngestUrl) { + return true + } + + return false +} + +// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field. +func (o *LogsInstance) SetIngestUrl(v string) { + o.IngestUrl = &v +} + +// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryRangeUrl() string { + if o == nil || IsNil(o.QueryRangeUrl) { + var ret string + return ret + } + return *o.QueryRangeUrl +} + +// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryRangeUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryRangeUrl) { + return nil, false + } + return o.QueryRangeUrl, true +} + +// HasQueryRangeUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryRangeUrl() bool { + if o != nil && !IsNil(o.QueryRangeUrl) { + return true + } + + return false +} + +// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field. +func (o *LogsInstance) SetQueryRangeUrl(v string) { + o.QueryRangeUrl = &v +} + +// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise. +func (o *LogsInstance) GetQueryUrl() string { + if o == nil || IsNil(o.QueryUrl) { + var ret string + return ret + } + return *o.QueryUrl +} + +// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetQueryUrlOk() (*string, bool) { + if o == nil || IsNil(o.QueryUrl) { + return nil, false + } + return o.QueryUrl, true +} + +// HasQueryUrl returns a boolean if a field has been set. +func (o *LogsInstance) HasQueryUrl() bool { + if o != nil && !IsNil(o.QueryUrl) { + return true + } + + return false +} + +// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field. +func (o *LogsInstance) SetQueryUrl(v string) { + o.QueryUrl = &v +} + +// GetRetentionDays returns the RetentionDays field value +func (o *LogsInstance) GetRetentionDays() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetRetentionDaysOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.RetentionDays, true +} + +// SetRetentionDays sets field value +func (o *LogsInstance) SetRetentionDays(v int32) { + o.RetentionDays = v +} + +// GetStatus returns the Status field value +func (o *LogsInstance) GetStatus() string { + if o == nil { + var ret string + return ret + } + + return o.Status +} + +// GetStatusOk returns a tuple with the Status field value +// and a boolean to check if the value has been set. +func (o *LogsInstance) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Status, true +} + +// SetStatus sets field value +func (o *LogsInstance) SetStatus(v string) { + o.Status = v +} + +func (o LogsInstance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + toSerialize["created"] = o.Created + if !IsNil(o.DatasourceUrl) { + toSerialize["datasourceUrl"] = o.DatasourceUrl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + toSerialize["displayName"] = o.DisplayName + toSerialize["id"] = o.Id + if !IsNil(o.IngestOtlpUrl) { + toSerialize["ingestOtlpUrl"] = o.IngestOtlpUrl + } + if !IsNil(o.IngestUrl) { + toSerialize["ingestUrl"] = o.IngestUrl + } + if !IsNil(o.QueryRangeUrl) { + toSerialize["queryRangeUrl"] = o.QueryRangeUrl + } + if !IsNil(o.QueryUrl) { + toSerialize["queryUrl"] = o.QueryUrl + } + toSerialize["retentionDays"] = o.RetentionDays + toSerialize["status"] = o.Status + return toSerialize, nil +} + +func (o *LogsInstance) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "created", + "displayName", + "id", + "retentionDays", + "status", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstance := _LogsInstance{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstance) + + if err != nil { + return err + } + + *o = LogsInstance(varLogsInstance) + + return err +} + +type NullableLogsInstance struct { + value *LogsInstance + isSet bool +} + +func (v NullableLogsInstance) Get() *LogsInstance { + return v.value +} + +func (v *NullableLogsInstance) Set(val *LogsInstance) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance { + return &NullableLogsInstance{value: val, isSet: true} +} + +func (v NullableLogsInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_logs_instances_list.go b/services/logs/v1betaapi/model_logs_instances_list.go new file mode 100644 index 000000000..f1d51448c --- /dev/null +++ b/services/logs/v1betaapi/model_logs_instances_list.go @@ -0,0 +1,156 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" +) + +// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &LogsInstancesList{} + +// LogsInstancesList struct for LogsInstancesList +type LogsInstancesList struct { + Instances []LogsInstance `json:"instances"` +} + +type _LogsInstancesList LogsInstancesList + +// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances []LogsInstance) *LogsInstancesList { + this := LogsInstancesList{} + this.Instances = instances + return &this +} + +// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList { + this := LogsInstancesList{} + return &this +} + +// GetInstances returns the Instances field value +func (o *LogsInstancesList) GetInstances() []LogsInstance { + if o == nil { + var ret []LogsInstance + return ret + } + + return o.Instances +} + +// GetInstancesOk returns a tuple with the Instances field value +// and a boolean to check if the value has been set. +func (o *LogsInstancesList) GetInstancesOk() ([]LogsInstance, bool) { + if o == nil { + return nil, false + } + return o.Instances, true +} + +// SetInstances sets field value +func (o *LogsInstancesList) SetInstances(v []LogsInstance) { + o.Instances = v +} + +func (o LogsInstancesList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o LogsInstancesList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["instances"] = o.Instances + return toSerialize, nil +} + +func (o *LogsInstancesList) UnmarshalJSON(data []byte) (err error) { + // This validates that all required properties are included in the JSON object + // by unmarshalling the object into a generic map with string keys and checking + // that every required field exists as a key in the generic map. + requiredProperties := []string{ + "instances", + } + + allProperties := make(map[string]interface{}) + + err = json.Unmarshal(data, &allProperties) + + if err != nil { + return err + } + + for _, requiredProperty := range requiredProperties { + if _, exists := allProperties[requiredProperty]; !exists { + return fmt.Errorf("no value given for required property %v", requiredProperty) + } + } + + varLogsInstancesList := _LogsInstancesList{} + + decoder := json.NewDecoder(bytes.NewReader(data)) + decoder.DisallowUnknownFields() + err = decoder.Decode(&varLogsInstancesList) + + if err != nil { + return err + } + + *o = LogsInstancesList(varLogsInstancesList) + + return err +} + +type NullableLogsInstancesList struct { + value *LogsInstancesList + isSet bool +} + +func (v NullableLogsInstancesList) Get() *LogsInstancesList { + return v.value +} + +func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) { + v.value = val + v.isSet = true +} + +func (v NullableLogsInstancesList) IsSet() bool { + return v.isSet +} + +func (v *NullableLogsInstancesList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList { + return &NullableLogsInstancesList{value: val, isSet: true} +} + +func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_update_access_token_payload.go b/services/logs/v1betaapi/model_update_access_token_payload.go new file mode 100644 index 000000000..6e2cb89ce --- /dev/null +++ b/services/logs/v1betaapi/model_update_access_token_payload.go @@ -0,0 +1,162 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateAccessTokenPayload{} + +// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload +type UpdateAccessTokenPayload struct { + // The description of the access token. + Description *string `json:"description,omitempty"` + // The displayed name of the access token. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` +} + +// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload { + this := UpdateAccessTokenPayload{} + return &this +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateAccessTokenPayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateAccessTokenPayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateAccessTokenPayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateAccessTokenPayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +func (o UpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + return toSerialize, nil +} + +type NullableUpdateAccessTokenPayload struct { + value *UpdateAccessTokenPayload + isSet bool +} + +func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload { + return v.value +} + +func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateAccessTokenPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateAccessTokenPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload { + return &NullableUpdateAccessTokenPayload{value: val, isSet: true} +} + +func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/model_update_logs_instance_payload.go b/services/logs/v1betaapi/model_update_logs_instance_payload.go new file mode 100644 index 000000000..e9f993a2c --- /dev/null +++ b/services/logs/v1betaapi/model_update_logs_instance_payload.go @@ -0,0 +1,236 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "encoding/json" +) + +// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateLogsInstancePayload{} + +// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload +type UpdateLogsInstancePayload struct { + // The access control list for the Logs instance. + Acl []string `json:"acl,omitempty"` + // The description of the Logs instance. + Description *string `json:"description,omitempty"` + // The displayed name to distinguish multiple Logs instances. + DisplayName *string `json:"displayName,omitempty" validate:"regexp=^[a-zA-Z][\\\\w -]*$"` + // The log retention time in days. + RetentionDays *int32 `json:"retentionDays,omitempty"` +} + +// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload { + this := UpdateLogsInstancePayload{} + return &this +} + +// GetAcl returns the Acl field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetAcl() []string { + if o == nil || IsNil(o.Acl) { + var ret []string + return ret + } + return o.Acl +} + +// GetAclOk returns a tuple with the Acl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetAclOk() ([]string, bool) { + if o == nil || IsNil(o.Acl) { + return nil, false + } + return o.Acl, true +} + +// HasAcl returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasAcl() bool { + if o != nil && !IsNil(o.Acl) { + return true + } + + return false +} + +// SetAcl gets a reference to the given []string and assigns it to the Acl field. +func (o *UpdateLogsInstancePayload) SetAcl(v []string) { + o.Acl = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *UpdateLogsInstancePayload) SetDescription(v string) { + o.Description = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *UpdateLogsInstancePayload) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise. +func (o *UpdateLogsInstancePayload) GetRetentionDays() int32 { + if o == nil || IsNil(o.RetentionDays) { + var ret int32 + return ret + } + return *o.RetentionDays +} + +// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (*int32, bool) { + if o == nil || IsNil(o.RetentionDays) { + return nil, false + } + return o.RetentionDays, true +} + +// HasRetentionDays returns a boolean if a field has been set. +func (o *UpdateLogsInstancePayload) HasRetentionDays() bool { + if o != nil && !IsNil(o.RetentionDays) { + return true + } + + return false +} + +// SetRetentionDays gets a reference to the given int32 and assigns it to the RetentionDays field. +func (o *UpdateLogsInstancePayload) SetRetentionDays(v int32) { + o.RetentionDays = &v +} + +func (o UpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Acl) { + toSerialize["acl"] = o.Acl + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.RetentionDays) { + toSerialize["retentionDays"] = o.RetentionDays + } + return toSerialize, nil +} + +type NullableUpdateLogsInstancePayload struct { + value *UpdateLogsInstancePayload + isSet bool +} + +func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload { + return v.value +} + +func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateLogsInstancePayload) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateLogsInstancePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload { + return &NullableUpdateLogsInstancePayload{value: val, isSet: true} +} + +func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/logs/v1betaapi/response.go b/services/logs/v1betaapi/response.go new file mode 100644 index 000000000..28ea889ed --- /dev/null +++ b/services/logs/v1betaapi/response.go @@ -0,0 +1,47 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/services/logs/v1betaapi/utils.go b/services/logs/v1betaapi/utils.go new file mode 100644 index 000000000..95e6d7953 --- /dev/null +++ b/services/logs/v1betaapi/utils.go @@ -0,0 +1,361 @@ +/* +STACKIT Logs API + +This API provides endpoints for managing STACKIT Logs. + +API version: 1beta.0.3 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package v1betaapi + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +} diff --git a/services/logs/wait/deprecation.go b/services/logs/wait/deprecation.go new file mode 100644 index 000000000..58f184c09 --- /dev/null +++ b/services/logs/wait/deprecation.go @@ -0,0 +1,2 @@ +// Deprecated: Will be removed after 2026-09-30. Move to the packages generated for each available API version instead +package wait