diff --git a/go.work b/go.work index ede5f74cc..9060334b3 100644 --- a/go.work +++ b/go.work @@ -32,6 +32,7 @@ use ( ./scripts ./services/archiving ./services/authorization + ./services/cdn ./services/certificates ./services/dns ./services/iaas diff --git a/services/cdn/.openapi-generator/VERSION b/services/cdn/.openapi-generator/VERSION new file mode 100644 index 000000000..cd802a1ec --- /dev/null +++ b/services/cdn/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/services/cdn/api_default.go b/services/cdn/api_default.go new file mode 100644 index 000000000..e2e0d32c1 --- /dev/null +++ b/services/cdn/api_default.go @@ -0,0 +1,2211 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "bytes" + "context" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/config" + "github.com/stackitcloud/stackit-sdk-go/core/oapierror" +) + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ApiCreateDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + createDistributionPayload *CreateDistributionPayload +} + +func (r ApiCreateDistributionRequest) CreateDistributionPayload(createDistributionPayload CreateDistributionPayload) ApiCreateDistributionRequest { + r.createDistributionPayload = &createDistributionPayload + return r +} + +func (r ApiCreateDistributionRequest) Execute() (*CreateDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *CreateDistributionResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.CreateDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.createDistributionPayload == nil { + return localVarReturnValue, fmt.Errorf("createDistributionPayload 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.createDistributionPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +CreateDistribution: Create new distribution + +CreateDistribution will create a new CDN distribution + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @return ApiCreateDistributionRequest +*/ +func (a *APIClient) CreateDistribution(ctx context.Context, projectId string) ApiCreateDistributionRequest { + return ApiCreateDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) CreateDistributionExecute(ctx context.Context, projectId string) (*CreateDistributionResponse, error) { + r := ApiCreateDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiDeleteCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string + intentId *string +} + +func (r ApiDeleteCustomDomainRequest) IntentId(intentId string) ApiDeleteCustomDomainRequest { + r.intentId = &intentId + return r +} + +func (r ApiDeleteCustomDomainRequest) Execute() (*DeleteCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteCustomDomainResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + if r.intentId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "intentId", r.intentId, "") + } + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteCustomDomain: Delete a custom domain + +# Removes a custom domain + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @param domain + @return ApiDeleteCustomDomainRequest +*/ +func (a *APIClient) DeleteCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiDeleteCustomDomainRequest { + return ApiDeleteCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) DeleteCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*DeleteCustomDomainResponse, error) { + r := ApiDeleteCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} + +type ApiDeleteDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + intentId *string +} + +// While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple DELETE-Requests with the same `intentId` are received, all but the first request are dropped. + +func (r ApiDeleteDistributionRequest) IntentId(intentId string) ApiDeleteDistributionRequest { + r.intentId = &intentId + return r +} + +func (r ApiDeleteDistributionRequest) Execute() (*DeleteDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *DeleteDistributionResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.DeleteDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.intentId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "intentId", r.intentId, "") + } + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +DeleteDistribution: Delete distribution + +DeleteDistribution accepts a project- and distribution-ID and will delete a distribution. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiDeleteDistributionRequest +*/ +func (a *APIClient) DeleteDistribution(ctx context.Context, projectId string, distributionId string) ApiDeleteDistributionRequest { + return ApiDeleteDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) DeleteDistributionExecute(ctx context.Context, projectId string, distributionId string) (*DeleteDistributionResponse, error) { + r := ApiDeleteDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiFindCachePathsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + path *string +} + +// A substring of the search query. + +func (r ApiFindCachePathsRequest) Path(path string) ApiFindCachePathsRequest { + r.path = &path + return r +} + +func (r ApiFindCachePathsRequest) Execute() (*FindCachePathsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *FindCachePathsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.FindCachePaths") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/paths" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.path == nil { + return localVarReturnValue, fmt.Errorf("path is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "path", r.path, "") + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +FindCachePaths: Return Paths that were purged + +This returns paths that are present in the cache purging history. +Only substrings of the provided input are returned. +The response is sorted in descending order by the most recent purge. + +So, assuming you have have the following purged for a distribution +- `/test/1` at `2025-01-01` +- `/test/2` at `2025-01-02` +- `/someOtherPath/1` at `2025-01-03` +- `/test/1` at `2025-01-04` +- `/test/3` at `2025-01-05`, +this would return the following paths, in the following order, assuming `/te` was the search parameter: +- `/test/3` +- `/test/1` +- `/test/2` + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiFindCachePathsRequest +*/ +func (a *APIClient) FindCachePaths(ctx context.Context, projectId string, distributionId string) ApiFindCachePathsRequest { + return ApiFindCachePathsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) FindCachePathsExecute(ctx context.Context, projectId string, distributionId string) (*FindCachePathsResponse, error) { + r := ApiFindCachePathsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiGetCacheInfoRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + purgePath *string +} + +func (r ApiGetCacheInfoRequest) PurgePath(purgePath string) ApiGetCacheInfoRequest { + r.purgePath = &purgePath + return r +} + +func (r ApiGetCacheInfoRequest) Execute() (*GetCacheInfoResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCacheInfoResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCacheInfo") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/cache" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.purgePath != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "purgePath", r.purgePath, "") + } + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCacheInfo: Get Infos about the Caching State + +Return caching info metadata, which contains the last cache purging time and a history of the most recent *full* purges. + +If (and only if) you provide the path query parameter, the history will also contain granular cache purges. +The request will not fail if no data about a path is found. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiGetCacheInfoRequest +*/ +func (a *APIClient) GetCacheInfo(ctx context.Context, projectId string, distributionId string) ApiGetCacheInfoRequest { + return ApiGetCacheInfoRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetCacheInfoExecute(ctx context.Context, projectId string, distributionId string) (*GetCacheInfoResponse, error) { + r := ApiGetCacheInfoRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiGetCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string +} + +func (r ApiGetCustomDomainRequest) Execute() (*GetCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetCustomDomainResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetCustomDomain: Retrieve a specific custom domain + +# Returns a 200 and the custom domain if this custom domain was associated to this distribution, else 404 + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @param domain + @return ApiGetCustomDomainRequest +*/ +func (a *APIClient) GetCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiGetCustomDomainRequest { + return ApiGetCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) GetCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*GetCustomDomainResponse, error) { + r := ApiGetCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} + +type ApiGetDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string +} + +func (r ApiGetDistributionRequest) Execute() (*GetDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetDistributionResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetDistribution: Get distribution by ID + +This returns a specific distribution by its ID. If no distribution with the given ID exists the endpoint returns 404. Trying to get a deleted distributions also return 404. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiGetDistributionRequest +*/ +func (a *APIClient) GetDistribution(ctx context.Context, projectId string, distributionId string) ApiGetDistributionRequest { + return ApiGetDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetDistributionExecute(ctx context.Context, projectId string, distributionId string) (*GetDistributionResponse, error) { + r := ApiGetDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiGetStatisticsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + from *time.Time + to *time.Time + interval *string +} + +// the start of the time range for which statistics should be returned + +func (r ApiGetStatisticsRequest) From(from time.Time) ApiGetStatisticsRequest { + r.from = &from + return r +} + +// the end of the time range for which statistics should be returned. If not specified, the end of the current time's interval is used, e.g. next day for daily, next month for monthly, and so on. + +func (r ApiGetStatisticsRequest) To(to time.Time) ApiGetStatisticsRequest { + r.to = &to + return r +} + +// Over which interval should statistics be aggregated? defaults to hourly resolution **NOTE**: Intervals are grouped in buckets that start and end based on a day in UTC+0 time. So for the `daily` interval, the group starts (inclusive) and ends (exclusive) at `00:00Z` + +func (r ApiGetStatisticsRequest) Interval(interval string) ApiGetStatisticsRequest { + r.interval = &interval + return r +} + +func (r ApiGetStatisticsRequest) Execute() (*GetStatisticsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *GetStatisticsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.GetStatistics") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/statistics" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.from == nil { + return localVarReturnValue, fmt.Errorf("from is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "from", r.from, "") + if r.to != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "to", r.to, "") + } + if r.interval != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "interval", r.interval, "") + } + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +GetStatistics: Retrieve the statistics of a distribution + +Returns the statistics of the distribution in the given +time range. The response is a list of statistics records. Each record aggregates the statistics for its time interval. +In case no statistics for a time interval exist, no record is returned. +The time range for which statistics should be returned can be configured using query parameters. + +Timestamps are assumed to be UTC. This is especially important for the "buckets" when you, for example, return daily information. A day always starts and ends at 00:00Z. + +**Important Note:** Lower bounds are inclusive, upper bounds are exclusive. If you, for example, want a daily grouped which starts on the 1st Jan and also contains the full 10th Jan day, you would define `2025-01-01T00:00:00Z` as the lower and `2025-01-11T00:00:00Z` as the upper bound. + +The upper bound is optional. If you omit it, the API will use the start of the next interval as the upper bound. +Example: if `interval` is `hourly`, `from` would default to the start of the next hour, if it's `daily`, `from` would default to the start of the next day, etc. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiGetStatisticsRequest +*/ +func (a *APIClient) GetStatistics(ctx context.Context, projectId string, distributionId string) ApiGetStatisticsRequest { + return ApiGetStatisticsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) GetStatisticsExecute(ctx context.Context, projectId string, distributionId string) (*GetStatisticsResponse, error) { + r := ApiGetStatisticsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiListDistributionsRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + pageSize *int32 + pageIdentifier *string + sortBy *string + sortOrder *string +} + +// Quantifies how many distributions should be returned on this page. Must be a natural number between 1 and 100 (inclusive) + +func (r ApiListDistributionsRequest) PageSize(pageSize int32) ApiListDistributionsRequest { + r.pageSize = &pageSize + return r +} + +// Identifier is returned by the previous response and is used to request the next page. As the `pageIdentifier` encodes an element, inserts during pagination will *not* shift the result. So a scenario like: - Start listing first page - Insert new element - Start listing second page will *never* result in an element from the first page to get \"pushed\" to the second page, like it could occur with basic limit + offset pagination. The identifier should be treated as an opaque string and never modified. Only pass values returned by the API. + +func (r ApiListDistributionsRequest) PageIdentifier(pageIdentifier string) ApiListDistributionsRequest { + r.pageIdentifier = &pageIdentifier + return r +} + +// The following sort options exist. We default to `createdAt` - `id` - Sort by the distributions's ID using String comparison - `updatedAt` - Sort by when the distribution's configuration was last modified, for example by changing the regions or response headers - `createdAt` - Sort by when the distribution was initially created. - `originUrl` - Sort by originURL using String comparison - `status` - Sort by looking at the distribution's status, using String comparison + +func (r ApiListDistributionsRequest) SortBy(sortBy string) ApiListDistributionsRequest { + r.sortBy = &sortBy + return r +} + +func (r ApiListDistributionsRequest) SortOrder(sortOrder string) ApiListDistributionsRequest { + r.sortOrder = &sortOrder + return r +} + +func (r ApiListDistributionsRequest) Execute() (*ListDistributionsResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListDistributionsResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListDistributions") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "") + } + if r.pageIdentifier != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageIdentifier", r.pageIdentifier, "") + } + if r.sortBy != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortBy", r.sortBy, "") + } + if r.sortOrder != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "sortOrder", r.sortOrder, "") + } + // 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, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListDistributions: List all distributions belonging to a specific project + +ListDistributions returns a list of all CDN distributions associated with +a given project, ordered by their distribution ID. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @return ApiListDistributionsRequest +*/ +func (a *APIClient) ListDistributions(ctx context.Context, projectId string) ApiListDistributionsRequest { + return ApiListDistributionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListDistributionsExecute(ctx context.Context, projectId string) (*ListDistributionsResponse, error) { + r := ApiListDistributionsRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} + +type ApiPatchDistributionRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + patchDistributionPayload *PatchDistributionPayload +} + +func (r ApiPatchDistributionRequest) PatchDistributionPayload(patchDistributionPayload PatchDistributionPayload) ApiPatchDistributionRequest { + r.patchDistributionPayload = &patchDistributionPayload + return r +} + +func (r ApiPatchDistributionRequest) Execute() (*PatchDistributionResponse, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PatchDistributionResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PatchDistribution") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.patchDistributionPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PatchDistribution: Update existing distribution + +Modify a CDN distribution with a partial update. Only the fields specified in the request will be modified. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiPatchDistributionRequest +*/ +func (a *APIClient) PatchDistribution(ctx context.Context, projectId string, distributionId string) ApiPatchDistributionRequest { + return ApiPatchDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) PatchDistributionExecute(ctx context.Context, projectId string, distributionId string) (*PatchDistributionResponse, error) { + r := ApiPatchDistributionRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiPurgeCacheRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + purgeCachePayload *PurgeCachePayload +} + +func (r ApiPurgeCacheRequest) PurgeCachePayload(purgeCachePayload PurgeCachePayload) ApiPurgeCacheRequest { + r.purgeCachePayload = &purgeCachePayload + return r +} + +func (r ApiPurgeCacheRequest) Execute() (map[string]interface{}, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PurgeCache") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/purge" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{"application/json"} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json", "text/plain"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + // body params + localVarPostBody = r.purgeCachePayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PurgeCache: Clear distribution's cache + +Clear the cache for this distribution. +All content, regardless of its staleness, will get refetched from the host. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @return ApiPurgeCacheRequest +*/ +func (a *APIClient) PurgeCache(ctx context.Context, projectId string, distributionId string) ApiPurgeCacheRequest { + return ApiPurgeCacheRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } +} + +func (a *APIClient) PurgeCacheExecute(ctx context.Context, projectId string, distributionId string) (map[string]interface{}, error) { + r := ApiPurgeCacheRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + } + return r.Execute() +} + +type ApiPutCustomDomainRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + distributionId string + domain string + putCustomDomainPayload *PutCustomDomainPayload +} + +func (r ApiPutCustomDomainRequest) PutCustomDomainPayload(putCustomDomainPayload PutCustomDomainPayload) ApiPutCustomDomainRequest { + r.putCustomDomainPayload = &putCustomDomainPayload + return r +} + +func (r ApiPutCustomDomainRequest) Execute() (*PutCustomDomainResponse, error) { + var ( + localVarHTTPMethod = http.MethodPut + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PutCustomDomainResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.PutCustomDomain") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + localVarPath = strings.Replace(localVarPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(r.projectId, "projectId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(r.distributionId, "distributionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(r.domain, "domain")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if strlen(r.domain) > 72 { + return localVarReturnValue, fmt.Errorf("domain must have less than 72 elements") + } + + // 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.putCustomDomainPayload + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 401 { + var v string + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 422 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + var v GenericJSONResponse + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +PutCustomDomain: Create or update a custom domain + +Creates a new custom domain. If it already exists, this will overwrite the previous custom domain's properties. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId Your STACKIT Project's ID + @param distributionId + @param domain + @return ApiPutCustomDomainRequest +*/ +func (a *APIClient) PutCustomDomain(ctx context.Context, projectId string, distributionId string, domain string) ApiPutCustomDomainRequest { + return ApiPutCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } +} + +func (a *APIClient) PutCustomDomainExecute(ctx context.Context, projectId string, distributionId string, domain string) (*PutCustomDomainResponse, error) { + r := ApiPutCustomDomainRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + distributionId: distributionId, + domain: domain, + } + return r.Execute() +} diff --git a/services/cdn/api_default_test.go b/services/cdn/api_default_test.go new file mode 100644 index 000000000..61fe1926a --- /dev/null +++ b/services/cdn/api_default_test.go @@ -0,0 +1,693 @@ +/* +CDN API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package cdn + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + "time" + + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_cdn_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService CreateDistribution", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := CreateDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + createDistributionPayload := CreateDistributionPayload{} + + resp, reqErr := apiClient.CreateDistribution(context.Background(), projectId).CreateDistributionPayload(createDistributionPayload).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteCustomDomain", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := "domain" + path = strings.Replace(path, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := DeleteCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + domain := "domain" + + resp, reqErr := apiClient.DeleteCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService DeleteDistribution", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := DeleteDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + + resp, reqErr := apiClient.DeleteDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService FindCachePaths", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/paths" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := FindCachePathsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + var path string + + resp, reqErr := apiClient.FindCachePaths(context.Background(), projectId, distributionId).Path(path).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCacheInfo", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetCacheInfoResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + + resp, reqErr := apiClient.GetCacheInfo(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetCustomDomain", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := "domain" + path = strings.Replace(path, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + domain := "domain" + + resp, reqErr := apiClient.GetCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetDistribution", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + + resp, reqErr := apiClient.GetDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService GetStatistics", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/statistics" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := GetStatisticsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + var from time.Time + + resp, reqErr := apiClient.GetStatistics(context.Background(), projectId, distributionId).From(from).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListDistributions", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := ListDistributionsResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + + resp, reqErr := apiClient.ListDistributions(context.Background(), projectId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PatchDistribution", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PatchDistributionResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + + resp, reqErr := apiClient.PatchDistribution(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PurgeCache", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/cache/purge" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := map[string]interface{}{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + + resp, reqErr := apiClient.PurgeCache(context.Background(), projectId, distributionId).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService PutCustomDomain", func(t *testing.T) { + path := "/v1beta/projects/{projectId}/distributions/{distributionId}/customDomains/{domain}" + projectIdValue := "projectId" + path = strings.Replace(path, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + distributionIdValue := "distributionId" + path = strings.Replace(path, "{"+"distributionId"+"}", url.PathEscape(ParameterValueToString(distributionIdValue, "distributionId")), -1) + domainValue := "domain" + path = strings.Replace(path, "{"+"domain"+"}", url.PathEscape(ParameterValueToString(domainValue, "domain")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PutCustomDomainResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for cdn_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + projectId := "projectId" + distributionId := "distributionId" + domain := "domain" + + resp, reqErr := apiClient.PutCustomDomain(context.Background(), projectId, distributionId, domain).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + +} diff --git a/services/cdn/client.go b/services/cdn/client.go new file mode 100644 index 000000000..b3ef722b3 --- /dev/null +++ b/services/cdn/client.go @@ -0,0 +1,631 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "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)/(?:vnd\.[^;]+\+)?json)`) + xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the CDN API API v1beta.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. + defaultApi *DefaultApiService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. +// Optionally receives configuration options +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 + 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 { + 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{}, 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, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), 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) + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), 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(), collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), 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, fmt.Errorf("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, fmt.Errorf("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 fmt.Errorf("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 fmt.Errorf("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 + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// 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) { + err = xml.NewEncoder(bodyBuf).Encode(body) + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s", 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) +} diff --git a/services/cdn/configuration.go b/services/cdn/configuration.go new file mode 100644 index 000000000..4c9a2b9b6 --- /dev/null +++ b/services/cdn/configuration.go @@ -0,0 +1,38 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +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: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://cdn.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/cdn/go.mod b/services/cdn/go.mod new file mode 100644 index 000000000..5e7588891 --- /dev/null +++ b/services/cdn/go.mod @@ -0,0 +1,11 @@ +module github.com/stackitcloud/stackit-sdk-go/services/cdn + +go 1.21 + +require github.com/stackitcloud/stackit-sdk-go/core v0.16.0 + +require ( + github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/uuid v1.6.0 // indirect +) diff --git a/services/cdn/go.sum b/services/cdn/go.sum new file mode 100644 index 000000000..39bc73464 --- /dev/null +++ b/services/cdn/go.sum @@ -0,0 +1,8 @@ +github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= +github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +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.16.0 h1:9caGZwGLZDyBBe6ojk9VR4B2m3/0H5It6znBz76sH1w= +github.com/stackitcloud/stackit-sdk-go/core v0.16.0/go.mod h1:LRheSoXTFRHWAyA8Q9skWtWBp3ZZ+bFAKiKuf4lTDkE= diff --git a/services/cdn/model_config.go b/services/cdn/model_config.go new file mode 100644 index 000000000..a21ac2e47 --- /dev/null +++ b/services/cdn/model_config.go @@ -0,0 +1,138 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the Config type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Config{} + +// Config struct for Config +type Config struct { + // REQUIRED + Backend *ConfigBackend `json:"backend"` + // REQUIRED + Regions *[]Region `json:"regions"` +} + +type _Config Config + +// NewConfig instantiates a new Config 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 NewConfig(backend *ConfigBackend, regions *[]Region) *Config { + this := Config{} + this.Backend = backend + this.Regions = regions + return &this +} + +// NewConfigWithDefaults instantiates a new Config 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 NewConfigWithDefaults() *Config { + this := Config{} + return &this +} + +// GetBackend returns the Backend field value +func (o *Config) GetBackend() *ConfigBackend { + if o == nil || IsNil(o.Backend) { + var ret *ConfigBackend + return ret + } + + return o.Backend +} + +// GetBackendOk returns a tuple with the Backend field value +// and a boolean to check if the value has been set. +func (o *Config) GetBackendOk() (*ConfigBackend, bool) { + if o == nil { + return nil, false + } + return o.Backend, true +} + +// SetBackend sets field value +func (o *Config) SetBackend(v *ConfigBackend) { + o.Backend = v +} + +// GetRegions returns the Regions field value +func (o *Config) GetRegions() *[]Region { + if o == nil || IsNil(o.Regions) { + var ret *[]Region + return ret + } + + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *Config) GetRegionsOk() (*[]Region, bool) { + if o == nil { + return nil, false + } + return o.Regions, true +} + +// SetRegions sets field value +func (o *Config) SetRegions(v *[]Region) { + o.Regions = v +} + +func (o Config) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["backend"] = o.Backend + toSerialize["regions"] = o.Regions + return toSerialize, nil +} + +type NullableConfig struct { + value *Config + isSet bool +} + +func (v NullableConfig) Get() *Config { + return v.value +} + +func (v *NullableConfig) Set(val *Config) { + v.value = val + v.isSet = true +} + +func (v NullableConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfig(val *Config) *NullableConfig { + return &NullableConfig{value: val, isSet: true} +} + +func (v NullableConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_config_backend.go b/services/cdn/model_config_backend.go new file mode 100644 index 000000000..d9fecb340 --- /dev/null +++ b/services/cdn/model_config_backend.go @@ -0,0 +1,115 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// ConfigBackend - struct for ConfigBackend +type ConfigBackend struct { + HttpBackend *HttpBackend +} + +// HttpBackendAsConfigBackend is a convenience function that returns HttpBackend wrapped in ConfigBackend +func HttpBackendAsConfigBackend(v *HttpBackend) ConfigBackend { + return ConfigBackend{ + HttpBackend: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigBackend) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into HttpBackend + err = newStrictDecoder(data).Decode(&dst.HttpBackend) + if err == nil { + jsonHttpBackend, _ := json.Marshal(dst.HttpBackend) + if string(jsonHttpBackend) == "{}" { // empty struct + dst.HttpBackend = nil + } else { + match++ + } + } else { + dst.HttpBackend = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.HttpBackend = nil + + return fmt.Errorf("data matches more than one schema in oneOf(ConfigBackend)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(ConfigBackend)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigBackend) MarshalJSON() ([]byte, error) { + if src.HttpBackend != nil { + return json.Marshal(&src.HttpBackend) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigBackend) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.HttpBackend != nil { + return obj.HttpBackend + } + + // all schemas are nil + return nil +} + +type NullableConfigBackend struct { + value *ConfigBackend + isSet bool +} + +func (v NullableConfigBackend) Get() *ConfigBackend { + return v.value +} + +func (v *NullableConfigBackend) Set(val *ConfigBackend) { + v.value = val + v.isSet = true +} + +func (v NullableConfigBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigBackend(val *ConfigBackend) *NullableConfigBackend { + return &NullableConfigBackend{value: val, isSet: true} +} + +func (v NullableConfigBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_config_patch.go b/services/cdn/model_config_patch.go new file mode 100644 index 000000000..5cb2c4a3c --- /dev/null +++ b/services/cdn/model_config_patch.go @@ -0,0 +1,152 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the ConfigPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ConfigPatch{} + +// ConfigPatch struct for ConfigPatch +type ConfigPatch struct { + Backend *ConfigPatchBackend `json:"backend,omitempty"` + Regions *[]Region `json:"regions,omitempty"` +} + +// NewConfigPatch instantiates a new ConfigPatch 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 NewConfigPatch() *ConfigPatch { + this := ConfigPatch{} + return &this +} + +// NewConfigPatchWithDefaults instantiates a new ConfigPatch 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 NewConfigPatchWithDefaults() *ConfigPatch { + this := ConfigPatch{} + return &this +} + +// GetBackend returns the Backend field value if set, zero value otherwise. +func (o *ConfigPatch) GetBackend() *ConfigPatchBackend { + if o == nil || IsNil(o.Backend) { + var ret *ConfigPatchBackend + return ret + } + return o.Backend +} + +// GetBackendOk returns a tuple with the Backend field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetBackendOk() (*ConfigPatchBackend, bool) { + if o == nil || IsNil(o.Backend) { + return nil, false + } + return o.Backend, true +} + +// HasBackend returns a boolean if a field has been set. +func (o *ConfigPatch) HasBackend() bool { + if o != nil && !IsNil(o.Backend) { + return true + } + + return false +} + +// SetBackend gets a reference to the given ConfigPatchBackend and assigns it to the Backend field. +func (o *ConfigPatch) SetBackend(v *ConfigPatchBackend) { + o.Backend = v +} + +// GetRegions returns the Regions field value if set, zero value otherwise. +func (o *ConfigPatch) GetRegions() *[]Region { + if o == nil || IsNil(o.Regions) { + var ret *[]Region + return ret + } + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ConfigPatch) GetRegionsOk() (*[]Region, bool) { + if o == nil || IsNil(o.Regions) { + return nil, false + } + return o.Regions, true +} + +// HasRegions returns a boolean if a field has been set. +func (o *ConfigPatch) HasRegions() bool { + if o != nil && !IsNil(o.Regions) { + return true + } + + return false +} + +// SetRegions gets a reference to the given []Region and assigns it to the Regions field. +func (o *ConfigPatch) SetRegions(v *[]Region) { + o.Regions = v +} + +func (o ConfigPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Backend) { + toSerialize["backend"] = o.Backend + } + if !IsNil(o.Regions) { + toSerialize["regions"] = o.Regions + } + return toSerialize, nil +} + +type NullableConfigPatch struct { + value *ConfigPatch + isSet bool +} + +func (v NullableConfigPatch) Get() *ConfigPatch { + return v.value +} + +func (v *NullableConfigPatch) Set(val *ConfigPatch) { + v.value = val + v.isSet = true +} + +func (v NullableConfigPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigPatch(val *ConfigPatch) *NullableConfigPatch { + return &NullableConfigPatch{value: val, isSet: true} +} + +func (v NullableConfigPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_config_patch_backend.go b/services/cdn/model_config_patch_backend.go new file mode 100644 index 000000000..aab1c4242 --- /dev/null +++ b/services/cdn/model_config_patch_backend.go @@ -0,0 +1,115 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// ConfigPatchBackend - struct for ConfigPatchBackend +type ConfigPatchBackend struct { + HttpBackendPatch *HttpBackendPatch +} + +// HttpBackendPatchAsConfigPatchBackend is a convenience function that returns HttpBackendPatch wrapped in ConfigPatchBackend +func HttpBackendPatchAsConfigPatchBackend(v *HttpBackendPatch) ConfigPatchBackend { + return ConfigPatchBackend{ + HttpBackendPatch: v, + } +} + +// Unmarshal JSON data into one of the pointers in the struct +func (dst *ConfigPatchBackend) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into HttpBackendPatch + err = newStrictDecoder(data).Decode(&dst.HttpBackendPatch) + if err == nil { + jsonHttpBackendPatch, _ := json.Marshal(dst.HttpBackendPatch) + if string(jsonHttpBackendPatch) == "{}" { // empty struct + dst.HttpBackendPatch = nil + } else { + match++ + } + } else { + dst.HttpBackendPatch = nil + } + + if match > 1 { // more than 1 match + // reset to nil + dst.HttpBackendPatch = nil + + return fmt.Errorf("data matches more than one schema in oneOf(ConfigPatchBackend)") + } else if match == 1 { + return nil // exactly one match + } else { // no match + return fmt.Errorf("data failed to match schemas in oneOf(ConfigPatchBackend)") + } +} + +// Marshal data from the first non-nil pointers in the struct to JSON +func (src ConfigPatchBackend) MarshalJSON() ([]byte, error) { + if src.HttpBackendPatch != nil { + return json.Marshal(&src.HttpBackendPatch) + } + + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object +} + +// Get the actual instance +func (obj *ConfigPatchBackend) GetActualInstance() interface{} { + if obj == nil { + return nil + } + if obj.HttpBackendPatch != nil { + return obj.HttpBackendPatch + } + + // all schemas are nil + return nil +} + +type NullableConfigPatchBackend struct { + value *ConfigPatchBackend + isSet bool +} + +func (v NullableConfigPatchBackend) Get() *ConfigPatchBackend { + return v.value +} + +func (v *NullableConfigPatchBackend) Set(val *ConfigPatchBackend) { + v.value = val + v.isSet = true +} + +func (v NullableConfigPatchBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableConfigPatchBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableConfigPatchBackend(val *ConfigPatchBackend) *NullableConfigPatchBackend { + return &NullableConfigPatchBackend{value: val, isSet: true} +} + +func (v NullableConfigPatchBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableConfigPatchBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_create_distribution_payload.go b/services/cdn/model_create_distribution_payload.go new file mode 100644 index 000000000..14ef92871 --- /dev/null +++ b/services/cdn/model_create_distribution_payload.go @@ -0,0 +1,214 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the CreateDistributionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDistributionPayload{} + +// CreateDistributionPayload struct for CreateDistributionPayload +type CreateDistributionPayload struct { + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple POST-Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId *string `json:"intentId,omitempty"` + // Headers that will be sent with every request to the configured origin. WARNING: Do not store sensitive values in the headers. The data is stores as plain text. + OriginRequestHeaders *map[string]string `json:"originRequestHeaders,omitempty"` + // The origin of the content that should be made available through the CDN. Note that the path and query parameters are ignored. Ports are allowed. If no protocol is provided, `https` is assumed. So `www.example.com:1234/somePath?q=123` is normalized to `https://www.example.com:1234` + // REQUIRED + OriginUrl *string `json:"originUrl"` + // Define in which regions you would like your content to be cached. + // REQUIRED + Regions *[]Region `json:"regions"` +} + +type _CreateDistributionPayload CreateDistributionPayload + +// NewCreateDistributionPayload instantiates a new CreateDistributionPayload 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 NewCreateDistributionPayload(originUrl *string, regions *[]Region) *CreateDistributionPayload { + this := CreateDistributionPayload{} + this.OriginUrl = originUrl + this.Regions = regions + return &this +} + +// NewCreateDistributionPayloadWithDefaults instantiates a new CreateDistributionPayload 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 NewCreateDistributionPayloadWithDefaults() *CreateDistributionPayload { + this := CreateDistributionPayload{} + return &this +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetIntentId() *string { + if o == nil || IsNil(o.IntentId) { + var ret *string + return ret + } + return o.IntentId +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetIntentIdOk() (*string, bool) { + if o == nil || IsNil(o.IntentId) { + return nil, false + } + return o.IntentId, true +} + +// HasIntentId returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasIntentId() bool { + if o != nil && !IsNil(o.IntentId) { + return true + } + + return false +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *CreateDistributionPayload) SetIntentId(v *string) { + o.IntentId = v +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value if set, zero value otherwise. +func (o *CreateDistributionPayload) GetOriginRequestHeaders() *map[string]string { + if o == nil || IsNil(o.OriginRequestHeaders) { + var ret *map[string]string + return ret + } + return o.OriginRequestHeaders +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetOriginRequestHeadersOk() (*map[string]string, bool) { + if o == nil || IsNil(o.OriginRequestHeaders) { + return nil, false + } + return o.OriginRequestHeaders, true +} + +// HasOriginRequestHeaders returns a boolean if a field has been set. +func (o *CreateDistributionPayload) HasOriginRequestHeaders() bool { + if o != nil && !IsNil(o.OriginRequestHeaders) { + return true + } + + return false +} + +// SetOriginRequestHeaders gets a reference to the given map[string]string and assigns it to the OriginRequestHeaders field. +func (o *CreateDistributionPayload) SetOriginRequestHeaders(v *map[string]string) { + o.OriginRequestHeaders = v +} + +// GetOriginUrl returns the OriginUrl field value +func (o *CreateDistributionPayload) GetOriginUrl() *string { + if o == nil || IsNil(o.OriginUrl) { + var ret *string + return ret + } + + return o.OriginUrl +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetOriginUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OriginUrl, true +} + +// SetOriginUrl sets field value +func (o *CreateDistributionPayload) SetOriginUrl(v *string) { + o.OriginUrl = v +} + +// GetRegions returns the Regions field value +func (o *CreateDistributionPayload) GetRegions() *[]Region { + if o == nil || IsNil(o.Regions) { + var ret *[]Region + return ret + } + + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionPayload) GetRegionsOk() (*[]Region, bool) { + if o == nil { + return nil, false + } + return o.Regions, true +} + +// SetRegions sets field value +func (o *CreateDistributionPayload) SetRegions(v *[]Region) { + o.Regions = v +} + +func (o CreateDistributionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IntentId) { + toSerialize["intentId"] = o.IntentId + } + if !IsNil(o.OriginRequestHeaders) { + toSerialize["originRequestHeaders"] = o.OriginRequestHeaders + } + toSerialize["originUrl"] = o.OriginUrl + toSerialize["regions"] = o.Regions + return toSerialize, nil +} + +type NullableCreateDistributionPayload struct { + value *CreateDistributionPayload + isSet bool +} + +func (v NullableCreateDistributionPayload) Get() *CreateDistributionPayload { + return v.value +} + +func (v *NullableCreateDistributionPayload) Set(val *CreateDistributionPayload) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionPayload(val *CreateDistributionPayload) *NullableCreateDistributionPayload { + return &NullableCreateDistributionPayload{value: val, isSet: true} +} + +func (v NullableCreateDistributionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_create_distribution_response.go b/services/cdn/model_create_distribution_response.go new file mode 100644 index 000000000..195d6ce4d --- /dev/null +++ b/services/cdn/model_create_distribution_response.go @@ -0,0 +1,110 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the CreateDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CreateDistributionResponse{} + +// CreateDistributionResponse struct for CreateDistributionResponse +type CreateDistributionResponse struct { + // REQUIRED + Distribution *Distribution `json:"distribution"` +} + +type _CreateDistributionResponse CreateDistributionResponse + +// NewCreateDistributionResponse instantiates a new CreateDistributionResponse 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 NewCreateDistributionResponse(distribution *Distribution) *CreateDistributionResponse { + this := CreateDistributionResponse{} + this.Distribution = distribution + return &this +} + +// NewCreateDistributionResponseWithDefaults instantiates a new CreateDistributionResponse 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 NewCreateDistributionResponseWithDefaults() *CreateDistributionResponse { + this := CreateDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *CreateDistributionResponse) GetDistribution() *Distribution { + if o == nil || IsNil(o.Distribution) { + var ret *Distribution + return ret + } + + return o.Distribution +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *CreateDistributionResponse) GetDistributionOk() (*Distribution, bool) { + if o == nil { + return nil, false + } + return o.Distribution, true +} + +// SetDistribution sets field value +func (o *CreateDistributionResponse) SetDistribution(v *Distribution) { + o.Distribution = v +} + +func (o CreateDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["distribution"] = o.Distribution + return toSerialize, nil +} + +type NullableCreateDistributionResponse struct { + value *CreateDistributionResponse + isSet bool +} + +func (v NullableCreateDistributionResponse) Get() *CreateDistributionResponse { + return v.value +} + +func (v *NullableCreateDistributionResponse) Set(val *CreateDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableCreateDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableCreateDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCreateDistributionResponse(val *CreateDistributionResponse) *NullableCreateDistributionResponse { + return &NullableCreateDistributionResponse{value: val, isSet: true} +} + +func (v NullableCreateDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCreateDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_custom_domain.go b/services/cdn/model_custom_domain.go new file mode 100644 index 000000000..6fa99d78b --- /dev/null +++ b/services/cdn/model_custom_domain.go @@ -0,0 +1,176 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the CustomDomain type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &CustomDomain{} + +// CustomDomain Definition of a custom domain +type CustomDomain struct { + // This object is present if the custom domain has errors. + Errors *[]StatusError `json:"errors,omitempty"` + // The domain. Can be used as input for the GetCustomDomain endpoint + // REQUIRED + Name *string `json:"name"` + // REQUIRED + Status *DomainStatus `json:"status"` +} + +type _CustomDomain CustomDomain + +// NewCustomDomain instantiates a new CustomDomain 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 NewCustomDomain(name *string, status *DomainStatus) *CustomDomain { + this := CustomDomain{} + this.Name = name + this.Status = status + return &this +} + +// NewCustomDomainWithDefaults instantiates a new CustomDomain 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 NewCustomDomainWithDefaults() *CustomDomain { + this := CustomDomain{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *CustomDomain) GetErrors() *[]StatusError { + if o == nil || IsNil(o.Errors) { + var ret *[]StatusError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CustomDomain) GetErrorsOk() (*[]StatusError, bool) { + if o == nil || IsNil(o.Errors) { + return nil, false + } + return o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *CustomDomain) HasErrors() bool { + if o != nil && !IsNil(o.Errors) { + return true + } + + return false +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *CustomDomain) SetErrors(v *[]StatusError) { + o.Errors = v +} + +// GetName returns the Name field value +func (o *CustomDomain) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *CustomDomain) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *CustomDomain) SetName(v *string) { + o.Name = v +} + +// GetStatus returns the Status field value +func (o *CustomDomain) GetStatus() *DomainStatus { + if o == nil || IsNil(o.Status) { + var ret *DomainStatus + 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 *CustomDomain) GetStatusOk() (*DomainStatus, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *CustomDomain) SetStatus(v *DomainStatus) { + o.Status = v +} + +func (o CustomDomain) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Errors) { + toSerialize["errors"] = o.Errors + } + toSerialize["name"] = o.Name + toSerialize["status"] = o.Status + return toSerialize, nil +} + +type NullableCustomDomain struct { + value *CustomDomain + isSet bool +} + +func (v NullableCustomDomain) Get() *CustomDomain { + return v.value +} + +func (v *NullableCustomDomain) Set(val *CustomDomain) { + v.value = val + v.isSet = true +} + +func (v NullableCustomDomain) IsSet() bool { + return v.isSet +} + +func (v *NullableCustomDomain) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCustomDomain(val *CustomDomain) *NullableCustomDomain { + return &NullableCustomDomain{value: val, isSet: true} +} + +func (v NullableCustomDomain) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCustomDomain) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_delete_custom_domain_response.go b/services/cdn/model_delete_custom_domain_response.go new file mode 100644 index 000000000..db17e851c --- /dev/null +++ b/services/cdn/model_delete_custom_domain_response.go @@ -0,0 +1,116 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the DeleteCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteCustomDomainResponse{} + +// DeleteCustomDomainResponse Returns the custom domain that was deleted while the deletion has not completed yet. After the deletion was successful the response will be empty. +type DeleteCustomDomainResponse struct { + CustomDomain *CustomDomain `json:"customDomain,omitempty"` +} + +// NewDeleteCustomDomainResponse instantiates a new DeleteCustomDomainResponse 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 NewDeleteCustomDomainResponse() *DeleteCustomDomainResponse { + this := DeleteCustomDomainResponse{} + return &this +} + +// NewDeleteCustomDomainResponseWithDefaults instantiates a new DeleteCustomDomainResponse 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 NewDeleteCustomDomainResponseWithDefaults() *DeleteCustomDomainResponse { + this := DeleteCustomDomainResponse{} + return &this +} + +// GetCustomDomain returns the CustomDomain field value if set, zero value otherwise. +func (o *DeleteCustomDomainResponse) GetCustomDomain() *CustomDomain { + if o == nil || IsNil(o.CustomDomain) { + var ret *CustomDomain + return ret + } + return o.CustomDomain +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteCustomDomainResponse) GetCustomDomainOk() (*CustomDomain, bool) { + if o == nil || IsNil(o.CustomDomain) { + return nil, false + } + return o.CustomDomain, true +} + +// HasCustomDomain returns a boolean if a field has been set. +func (o *DeleteCustomDomainResponse) HasCustomDomain() bool { + if o != nil && !IsNil(o.CustomDomain) { + return true + } + + return false +} + +// SetCustomDomain gets a reference to the given CustomDomain and assigns it to the CustomDomain field. +func (o *DeleteCustomDomainResponse) SetCustomDomain(v *CustomDomain) { + o.CustomDomain = v +} + +func (o DeleteCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CustomDomain) { + toSerialize["customDomain"] = o.CustomDomain + } + return toSerialize, nil +} + +type NullableDeleteCustomDomainResponse struct { + value *DeleteCustomDomainResponse + isSet bool +} + +func (v NullableDeleteCustomDomainResponse) Get() *DeleteCustomDomainResponse { + return v.value +} + +func (v *NullableDeleteCustomDomainResponse) Set(val *DeleteCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteCustomDomainResponse(val *DeleteCustomDomainResponse) *NullableDeleteCustomDomainResponse { + return &NullableDeleteCustomDomainResponse{value: val, isSet: true} +} + +func (v NullableDeleteCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_delete_distribution_response.go b/services/cdn/model_delete_distribution_response.go new file mode 100644 index 000000000..410d86add --- /dev/null +++ b/services/cdn/model_delete_distribution_response.go @@ -0,0 +1,116 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the DeleteDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DeleteDistributionResponse{} + +// DeleteDistributionResponse struct for DeleteDistributionResponse +type DeleteDistributionResponse struct { + Distribution *Distribution `json:"distribution,omitempty"` +} + +// NewDeleteDistributionResponse instantiates a new DeleteDistributionResponse 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 NewDeleteDistributionResponse() *DeleteDistributionResponse { + this := DeleteDistributionResponse{} + return &this +} + +// NewDeleteDistributionResponseWithDefaults instantiates a new DeleteDistributionResponse 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 NewDeleteDistributionResponseWithDefaults() *DeleteDistributionResponse { + this := DeleteDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value if set, zero value otherwise. +func (o *DeleteDistributionResponse) GetDistribution() *Distribution { + if o == nil || IsNil(o.Distribution) { + var ret *Distribution + return ret + } + return o.Distribution +} + +// GetDistributionOk returns a tuple with the Distribution field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DeleteDistributionResponse) GetDistributionOk() (*Distribution, bool) { + if o == nil || IsNil(o.Distribution) { + return nil, false + } + return o.Distribution, true +} + +// HasDistribution returns a boolean if a field has been set. +func (o *DeleteDistributionResponse) HasDistribution() bool { + if o != nil && !IsNil(o.Distribution) { + return true + } + + return false +} + +// SetDistribution gets a reference to the given Distribution and assigns it to the Distribution field. +func (o *DeleteDistributionResponse) SetDistribution(v *Distribution) { + o.Distribution = v +} + +func (o DeleteDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Distribution) { + toSerialize["distribution"] = o.Distribution + } + return toSerialize, nil +} + +type NullableDeleteDistributionResponse struct { + value *DeleteDistributionResponse + isSet bool +} + +func (v NullableDeleteDistributionResponse) Get() *DeleteDistributionResponse { + return v.value +} + +func (v *NullableDeleteDistributionResponse) Set(val *DeleteDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDeleteDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDeleteDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDeleteDistributionResponse(val *DeleteDistributionResponse) *NullableDeleteDistributionResponse { + return &NullableDeleteDistributionResponse{value: val, isSet: true} +} + +func (v NullableDeleteDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDeleteDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_distribution.go b/services/cdn/model_distribution.go new file mode 100644 index 000000000..50b81dc0c --- /dev/null +++ b/services/cdn/model_distribution.go @@ -0,0 +1,319 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "time" +) + +// checks if the Distribution type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Distribution{} + +// Distribution struct for Distribution +type Distribution struct { + // REQUIRED + Config *Config `json:"config"` + // RFC3339 string defining when the distribution was created + // REQUIRED + CreatedAt *time.Time `json:"createdAt"` + // REQUIRED + Domains *[]Domain `json:"domains"` + // This object may be present if, and only if the distribution has encountered an error state. + Errors *[]StatusError `json:"errors,omitempty"` + // REQUIRED + Id *string `json:"id"` + // REQUIRED + ProjectId *string `json:"projectId"` + // - `CREATING`: The distribution was just created. All the relevant resources are created in the background. Once fully reconciled, this switches to `ACTIVE`. If there are any issues, the status changes to `ERROR`. You can look at the `errors` array to get more infos. - `ACTIVE`: The usual state. The desired configuration is synced, there are no errors - `UPDATING`: The state when there is a discrepancy between the desired and actual configuration state. This occurs right after an update. Will switch to `ACTIVE` or `ERROR`, depending on if synchronizing succeeds or not. - `DELETING`: The state right after a delete request was received. The distribution will stay in this status until all resources have been successfully removed, or until we encounter an `ERROR` state. **NOTE:** You can keep fetching the distribution while it is deleting. After successful deletion, trying to get a distribution will return a 404 Not Found response - `ERROR`: The error state. Look at the `errors` array for more info. + // REQUIRED + Status *string `json:"status"` + // RFC3339 string which returns the last time the distribution's configuration was modified. + // REQUIRED + UpdatedAt *time.Time `json:"updatedAt"` +} + +type _Distribution Distribution + +// NewDistribution instantiates a new Distribution 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 NewDistribution(config *Config, createdAt *time.Time, domains *[]Domain, id *string, projectId *string, status *string, updatedAt *time.Time) *Distribution { + this := Distribution{} + this.Config = config + this.CreatedAt = createdAt + this.Domains = domains + this.Id = id + this.ProjectId = projectId + this.Status = status + this.UpdatedAt = updatedAt + return &this +} + +// NewDistributionWithDefaults instantiates a new Distribution 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 NewDistributionWithDefaults() *Distribution { + this := Distribution{} + return &this +} + +// GetConfig returns the Config field value +func (o *Distribution) GetConfig() *Config { + if o == nil || IsNil(o.Config) { + var ret *Config + return ret + } + + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetConfigOk() (*Config, bool) { + if o == nil { + return nil, false + } + return o.Config, true +} + +// SetConfig sets field value +func (o *Distribution) SetConfig(v *Config) { + o.Config = v +} + +// GetCreatedAt returns the CreatedAt field value +func (o *Distribution) GetCreatedAt() *time.Time { + if o == nil || IsNil(o.CreatedAt) { + var ret *time.Time + return ret + } + + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.CreatedAt, true +} + +// SetCreatedAt sets field value +func (o *Distribution) SetCreatedAt(v *time.Time) { + o.CreatedAt = v +} + +// GetDomains returns the Domains field value +func (o *Distribution) GetDomains() *[]Domain { + if o == nil || IsNil(o.Domains) { + var ret *[]Domain + return ret + } + + return o.Domains +} + +// GetDomainsOk returns a tuple with the Domains field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetDomainsOk() (*[]Domain, bool) { + if o == nil { + return nil, false + } + return o.Domains, true +} + +// SetDomains sets field value +func (o *Distribution) SetDomains(v *[]Domain) { + o.Domains = v +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *Distribution) GetErrors() *[]StatusError { + if o == nil || IsNil(o.Errors) { + var ret *[]StatusError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Distribution) GetErrorsOk() (*[]StatusError, bool) { + if o == nil || IsNil(o.Errors) { + return nil, false + } + return o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *Distribution) HasErrors() bool { + if o != nil && !IsNil(o.Errors) { + return true + } + + return false +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *Distribution) SetErrors(v *[]StatusError) { + o.Errors = v +} + +// GetId returns the Id field value +func (o *Distribution) GetId() *string { + if o == nil || IsNil(o.Id) { + var ret *string + return ret + } + + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Id, true +} + +// SetId sets field value +func (o *Distribution) SetId(v *string) { + o.Id = v +} + +// GetProjectId returns the ProjectId field value +func (o *Distribution) GetProjectId() *string { + if o == nil || IsNil(o.ProjectId) { + var ret *string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.ProjectId, true +} + +// SetProjectId sets field value +func (o *Distribution) SetProjectId(v *string) { + o.ProjectId = v +} + +// GetStatus returns the Status field value +func (o *Distribution) GetStatus() *string { + if o == nil || IsNil(o.Status) { + 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 *Distribution) GetStatusOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *Distribution) SetStatus(v *string) { + o.Status = v +} + +// GetUpdatedAt returns the UpdatedAt field value +func (o *Distribution) GetUpdatedAt() *time.Time { + if o == nil || IsNil(o.UpdatedAt) { + var ret *time.Time + return ret + } + + return o.UpdatedAt +} + +// GetUpdatedAtOk returns a tuple with the UpdatedAt field value +// and a boolean to check if the value has been set. +func (o *Distribution) GetUpdatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.UpdatedAt, true +} + +// SetUpdatedAt sets field value +func (o *Distribution) SetUpdatedAt(v *time.Time) { + o.UpdatedAt = v +} + +func (o Distribution) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["config"] = o.Config + toSerialize["createdAt"] = o.CreatedAt + toSerialize["domains"] = o.Domains + if !IsNil(o.Errors) { + toSerialize["errors"] = o.Errors + } + toSerialize["id"] = o.Id + toSerialize["projectId"] = o.ProjectId + toSerialize["status"] = o.Status + toSerialize["updatedAt"] = o.UpdatedAt + return toSerialize, nil +} + +type NullableDistribution struct { + value *Distribution + isSet bool +} + +func (v NullableDistribution) Get() *Distribution { + return v.value +} + +func (v *NullableDistribution) Set(val *Distribution) { + v.value = val + v.isSet = true +} + +func (v NullableDistribution) IsSet() bool { + return v.isSet +} + +func (v *NullableDistribution) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistribution(val *Distribution) *NullableDistribution { + return &NullableDistribution{value: val, isSet: true} +} + +func (v NullableDistribution) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistribution) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_distribution_statistics_record.go b/services/cdn/model_distribution_statistics_record.go new file mode 100644 index 000000000..8cde57492 --- /dev/null +++ b/services/cdn/model_distribution_statistics_record.go @@ -0,0 +1,256 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "time" +) + +// checks if the DistributionStatisticsRecord type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecord{} + +// DistributionStatisticsRecord Aggregated statistics of a distribution during a time interval +type DistributionStatisticsRecord struct { + // Number of cached requests that were served + // REQUIRED + CachedRequests *int64 `json:"cachedRequests"` + // Total number of requests that were served + // REQUIRED + TotalRequests *int64 `json:"totalRequests"` + // Total traffic in bytes that occurred during the time interval + // REQUIRED + TotalTrafficBytes *int64 `json:"totalTrafficBytes"` + // Exclusive end of the time interval the statistics refer to + // REQUIRED + End *time.Time `json:"end"` + // REQUIRED + Regions *DistributionStatisticsRecordRegions `json:"regions"` + // Start of the time interval the statistics refer to + // REQUIRED + Start *time.Time `json:"start"` +} + +type _DistributionStatisticsRecord DistributionStatisticsRecord + +// NewDistributionStatisticsRecord instantiates a new DistributionStatisticsRecord 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 NewDistributionStatisticsRecord(cachedRequests *int64, totalRequests *int64, totalTrafficBytes *int64, end *time.Time, regions *DistributionStatisticsRecordRegions, start *time.Time) *DistributionStatisticsRecord { + this := DistributionStatisticsRecord{} + this.CachedRequests = cachedRequests + this.TotalRequests = totalRequests + this.TotalTrafficBytes = totalTrafficBytes + this.End = end + this.Regions = regions + this.Start = start + return &this +} + +// NewDistributionStatisticsRecordWithDefaults instantiates a new DistributionStatisticsRecord 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 NewDistributionStatisticsRecordWithDefaults() *DistributionStatisticsRecord { + this := DistributionStatisticsRecord{} + return &this +} + +// GetCachedRequests returns the CachedRequests field value +func (o *DistributionStatisticsRecord) GetCachedRequests() *int64 { + if o == nil || IsNil(o.CachedRequests) { + var ret *int64 + return ret + } + + return o.CachedRequests +} + +// GetCachedRequestsOk returns a tuple with the CachedRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetCachedRequestsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.CachedRequests, true +} + +// SetCachedRequests sets field value +func (o *DistributionStatisticsRecord) SetCachedRequests(v *int64) { + o.CachedRequests = v +} + +// GetTotalRequests returns the TotalRequests field value +func (o *DistributionStatisticsRecord) GetTotalRequests() *int64 { + if o == nil || IsNil(o.TotalRequests) { + var ret *int64 + return ret + } + + return o.TotalRequests +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetTotalRequestsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.TotalRequests, true +} + +// SetTotalRequests sets field value +func (o *DistributionStatisticsRecord) SetTotalRequests(v *int64) { + o.TotalRequests = v +} + +// GetTotalTrafficBytes returns the TotalTrafficBytes field value +func (o *DistributionStatisticsRecord) GetTotalTrafficBytes() *int64 { + if o == nil || IsNil(o.TotalTrafficBytes) { + var ret *int64 + return ret + } + + return o.TotalTrafficBytes +} + +// GetTotalTrafficBytesOk returns a tuple with the TotalTrafficBytes field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetTotalTrafficBytesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.TotalTrafficBytes, true +} + +// SetTotalTrafficBytes sets field value +func (o *DistributionStatisticsRecord) SetTotalTrafficBytes(v *int64) { + o.TotalTrafficBytes = v +} + +// GetEnd returns the End field value +func (o *DistributionStatisticsRecord) GetEnd() *time.Time { + if o == nil || IsNil(o.End) { + var ret *time.Time + return ret + } + + return o.End +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End, true +} + +// SetEnd sets field value +func (o *DistributionStatisticsRecord) SetEnd(v *time.Time) { + o.End = v +} + +// GetRegions returns the Regions field value +func (o *DistributionStatisticsRecord) GetRegions() *DistributionStatisticsRecordRegions { + if o == nil || IsNil(o.Regions) { + var ret *DistributionStatisticsRecordRegions + return ret + } + + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetRegionsOk() (*DistributionStatisticsRecordRegions, bool) { + if o == nil { + return nil, false + } + return o.Regions, true +} + +// SetRegions sets field value +func (o *DistributionStatisticsRecord) SetRegions(v *DistributionStatisticsRecordRegions) { + o.Regions = v +} + +// GetStart returns the Start field value +func (o *DistributionStatisticsRecord) GetStart() *time.Time { + if o == nil || IsNil(o.Start) { + var ret *time.Time + return ret + } + + return o.Start +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecord) GetStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Start, true +} + +// SetStart sets field value +func (o *DistributionStatisticsRecord) SetStart(v *time.Time) { + o.Start = v +} + +func (o DistributionStatisticsRecord) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cachedRequests"] = o.CachedRequests + toSerialize["totalRequests"] = o.TotalRequests + toSerialize["totalTrafficBytes"] = o.TotalTrafficBytes + toSerialize["end"] = o.End + toSerialize["regions"] = o.Regions + toSerialize["start"] = o.Start + return toSerialize, nil +} + +type NullableDistributionStatisticsRecord struct { + value *DistributionStatisticsRecord + isSet bool +} + +func (v NullableDistributionStatisticsRecord) Get() *DistributionStatisticsRecord { + return v.value +} + +func (v *NullableDistributionStatisticsRecord) Set(val *DistributionStatisticsRecord) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecord) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecord) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecord(val *DistributionStatisticsRecord) *NullableDistributionStatisticsRecord { + return &NullableDistributionStatisticsRecord{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecord) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecord) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_distribution_statistics_record_all_of.go b/services/cdn/model_distribution_statistics_record_all_of.go new file mode 100644 index 000000000..904fb5be7 --- /dev/null +++ b/services/cdn/model_distribution_statistics_record_all_of.go @@ -0,0 +1,169 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "time" +) + +// checks if the DistributionStatisticsRecordAllOf type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordAllOf{} + +// DistributionStatisticsRecordAllOf struct for DistributionStatisticsRecordAllOf +type DistributionStatisticsRecordAllOf struct { + // Exclusive end of the time interval the statistics refer to + // REQUIRED + End *time.Time `json:"end"` + // REQUIRED + Regions *DistributionStatisticsRecordRegions `json:"regions"` + // Start of the time interval the statistics refer to + // REQUIRED + Start *time.Time `json:"start"` +} + +type _DistributionStatisticsRecordAllOf DistributionStatisticsRecordAllOf + +// NewDistributionStatisticsRecordAllOf instantiates a new DistributionStatisticsRecordAllOf 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 NewDistributionStatisticsRecordAllOf(end *time.Time, regions *DistributionStatisticsRecordRegions, start *time.Time) *DistributionStatisticsRecordAllOf { + this := DistributionStatisticsRecordAllOf{} + this.End = end + this.Regions = regions + this.Start = start + return &this +} + +// NewDistributionStatisticsRecordAllOfWithDefaults instantiates a new DistributionStatisticsRecordAllOf 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 NewDistributionStatisticsRecordAllOfWithDefaults() *DistributionStatisticsRecordAllOf { + this := DistributionStatisticsRecordAllOf{} + return &this +} + +// GetEnd returns the End field value +func (o *DistributionStatisticsRecordAllOf) GetEnd() *time.Time { + if o == nil || IsNil(o.End) { + var ret *time.Time + return ret + } + + return o.End +} + +// GetEndOk returns a tuple with the End field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetEndOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.End, true +} + +// SetEnd sets field value +func (o *DistributionStatisticsRecordAllOf) SetEnd(v *time.Time) { + o.End = v +} + +// GetRegions returns the Regions field value +func (o *DistributionStatisticsRecordAllOf) GetRegions() *DistributionStatisticsRecordRegions { + if o == nil || IsNil(o.Regions) { + var ret *DistributionStatisticsRecordRegions + return ret + } + + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetRegionsOk() (*DistributionStatisticsRecordRegions, bool) { + if o == nil { + return nil, false + } + return o.Regions, true +} + +// SetRegions sets field value +func (o *DistributionStatisticsRecordAllOf) SetRegions(v *DistributionStatisticsRecordRegions) { + o.Regions = v +} + +// GetStart returns the Start field value +func (o *DistributionStatisticsRecordAllOf) GetStart() *time.Time { + if o == nil || IsNil(o.Start) { + var ret *time.Time + return ret + } + + return o.Start +} + +// GetStartOk returns a tuple with the Start field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordAllOf) GetStartOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.Start, true +} + +// SetStart sets field value +func (o *DistributionStatisticsRecordAllOf) SetStart(v *time.Time) { + o.Start = v +} + +func (o DistributionStatisticsRecordAllOf) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["end"] = o.End + toSerialize["regions"] = o.Regions + toSerialize["start"] = o.Start + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordAllOf struct { + value *DistributionStatisticsRecordAllOf + isSet bool +} + +func (v NullableDistributionStatisticsRecordAllOf) Get() *DistributionStatisticsRecordAllOf { + return v.value +} + +func (v *NullableDistributionStatisticsRecordAllOf) Set(val *DistributionStatisticsRecordAllOf) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordAllOf) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordAllOf) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordAllOf(val *DistributionStatisticsRecordAllOf) *NullableDistributionStatisticsRecordAllOf { + return &NullableDistributionStatisticsRecordAllOf{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordAllOf) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordAllOf) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_distribution_statistics_record_entry.go b/services/cdn/model_distribution_statistics_record_entry.go new file mode 100644 index 000000000..40f0b2378 --- /dev/null +++ b/services/cdn/model_distribution_statistics_record_entry.go @@ -0,0 +1,169 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the DistributionStatisticsRecordEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordEntry{} + +// DistributionStatisticsRecordEntry struct for DistributionStatisticsRecordEntry +type DistributionStatisticsRecordEntry struct { + // Number of cached requests that were served + // REQUIRED + CachedRequests *int64 `json:"cachedRequests"` + // Total number of requests that were served + // REQUIRED + TotalRequests *int64 `json:"totalRequests"` + // Total traffic in bytes that occurred during the time interval + // REQUIRED + TotalTrafficBytes *int64 `json:"totalTrafficBytes"` +} + +type _DistributionStatisticsRecordEntry DistributionStatisticsRecordEntry + +// NewDistributionStatisticsRecordEntry instantiates a new DistributionStatisticsRecordEntry 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 NewDistributionStatisticsRecordEntry(cachedRequests *int64, totalRequests *int64, totalTrafficBytes *int64) *DistributionStatisticsRecordEntry { + this := DistributionStatisticsRecordEntry{} + this.CachedRequests = cachedRequests + this.TotalRequests = totalRequests + this.TotalTrafficBytes = totalTrafficBytes + return &this +} + +// NewDistributionStatisticsRecordEntryWithDefaults instantiates a new DistributionStatisticsRecordEntry 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 NewDistributionStatisticsRecordEntryWithDefaults() *DistributionStatisticsRecordEntry { + this := DistributionStatisticsRecordEntry{} + return &this +} + +// GetCachedRequests returns the CachedRequests field value +func (o *DistributionStatisticsRecordEntry) GetCachedRequests() *int64 { + if o == nil || IsNil(o.CachedRequests) { + var ret *int64 + return ret + } + + return o.CachedRequests +} + +// GetCachedRequestsOk returns a tuple with the CachedRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetCachedRequestsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.CachedRequests, true +} + +// SetCachedRequests sets field value +func (o *DistributionStatisticsRecordEntry) SetCachedRequests(v *int64) { + o.CachedRequests = v +} + +// GetTotalRequests returns the TotalRequests field value +func (o *DistributionStatisticsRecordEntry) GetTotalRequests() *int64 { + if o == nil || IsNil(o.TotalRequests) { + var ret *int64 + return ret + } + + return o.TotalRequests +} + +// GetTotalRequestsOk returns a tuple with the TotalRequests field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetTotalRequestsOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.TotalRequests, true +} + +// SetTotalRequests sets field value +func (o *DistributionStatisticsRecordEntry) SetTotalRequests(v *int64) { + o.TotalRequests = v +} + +// GetTotalTrafficBytes returns the TotalTrafficBytes field value +func (o *DistributionStatisticsRecordEntry) GetTotalTrafficBytes() *int64 { + if o == nil || IsNil(o.TotalTrafficBytes) { + var ret *int64 + return ret + } + + return o.TotalTrafficBytes +} + +// GetTotalTrafficBytesOk returns a tuple with the TotalTrafficBytes field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordEntry) GetTotalTrafficBytesOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.TotalTrafficBytes, true +} + +// SetTotalTrafficBytes sets field value +func (o *DistributionStatisticsRecordEntry) SetTotalTrafficBytes(v *int64) { + o.TotalTrafficBytes = v +} + +func (o DistributionStatisticsRecordEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cachedRequests"] = o.CachedRequests + toSerialize["totalRequests"] = o.TotalRequests + toSerialize["totalTrafficBytes"] = o.TotalTrafficBytes + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordEntry struct { + value *DistributionStatisticsRecordEntry + isSet bool +} + +func (v NullableDistributionStatisticsRecordEntry) Get() *DistributionStatisticsRecordEntry { + return v.value +} + +func (v *NullableDistributionStatisticsRecordEntry) Set(val *DistributionStatisticsRecordEntry) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordEntry(val *DistributionStatisticsRecordEntry) *NullableDistributionStatisticsRecordEntry { + return &NullableDistributionStatisticsRecordEntry{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_distribution_statistics_record_regions.go b/services/cdn/model_distribution_statistics_record_regions.go new file mode 100644 index 000000000..442f1ee6d --- /dev/null +++ b/services/cdn/model_distribution_statistics_record_regions.go @@ -0,0 +1,222 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the DistributionStatisticsRecordRegions type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DistributionStatisticsRecordRegions{} + +// DistributionStatisticsRecordRegions Mapping of regions to the metrics for this region for the defined time interval All regions are always present. If no traffic was reported for a region, it will still contain 0-filled properties +type DistributionStatisticsRecordRegions struct { + // REQUIRED + AF *DistributionStatisticsRecordEntry `json:"AF"` + // REQUIRED + ASIA *DistributionStatisticsRecordEntry `json:"ASIA"` + // REQUIRED + EU *DistributionStatisticsRecordEntry `json:"EU"` + // REQUIRED + SA *DistributionStatisticsRecordEntry `json:"SA"` + // REQUIRED + US *DistributionStatisticsRecordEntry `json:"US"` +} + +type _DistributionStatisticsRecordRegions DistributionStatisticsRecordRegions + +// NewDistributionStatisticsRecordRegions instantiates a new DistributionStatisticsRecordRegions 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 NewDistributionStatisticsRecordRegions(aF *DistributionStatisticsRecordEntry, aSIA *DistributionStatisticsRecordEntry, eU *DistributionStatisticsRecordEntry, sA *DistributionStatisticsRecordEntry, uS *DistributionStatisticsRecordEntry) *DistributionStatisticsRecordRegions { + this := DistributionStatisticsRecordRegions{} + this.AF = aF + this.ASIA = aSIA + this.EU = eU + this.SA = sA + this.US = uS + return &this +} + +// NewDistributionStatisticsRecordRegionsWithDefaults instantiates a new DistributionStatisticsRecordRegions 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 NewDistributionStatisticsRecordRegionsWithDefaults() *DistributionStatisticsRecordRegions { + this := DistributionStatisticsRecordRegions{} + return &this +} + +// GetAF returns the AF field value +func (o *DistributionStatisticsRecordRegions) GetAF() *DistributionStatisticsRecordEntry { + if o == nil || IsNil(o.AF) { + var ret *DistributionStatisticsRecordEntry + return ret + } + + return o.AF +} + +// GetAFOk returns a tuple with the AF field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetAFOk() (*DistributionStatisticsRecordEntry, bool) { + if o == nil { + return nil, false + } + return o.AF, true +} + +// SetAF sets field value +func (o *DistributionStatisticsRecordRegions) SetAF(v *DistributionStatisticsRecordEntry) { + o.AF = v +} + +// GetASIA returns the ASIA field value +func (o *DistributionStatisticsRecordRegions) GetASIA() *DistributionStatisticsRecordEntry { + if o == nil || IsNil(o.ASIA) { + var ret *DistributionStatisticsRecordEntry + return ret + } + + return o.ASIA +} + +// GetASIAOk returns a tuple with the ASIA field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetASIAOk() (*DistributionStatisticsRecordEntry, bool) { + if o == nil { + return nil, false + } + return o.ASIA, true +} + +// SetASIA sets field value +func (o *DistributionStatisticsRecordRegions) SetASIA(v *DistributionStatisticsRecordEntry) { + o.ASIA = v +} + +// GetEU returns the EU field value +func (o *DistributionStatisticsRecordRegions) GetEU() *DistributionStatisticsRecordEntry { + if o == nil || IsNil(o.EU) { + var ret *DistributionStatisticsRecordEntry + return ret + } + + return o.EU +} + +// GetEUOk returns a tuple with the EU field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetEUOk() (*DistributionStatisticsRecordEntry, bool) { + if o == nil { + return nil, false + } + return o.EU, true +} + +// SetEU sets field value +func (o *DistributionStatisticsRecordRegions) SetEU(v *DistributionStatisticsRecordEntry) { + o.EU = v +} + +// GetSA returns the SA field value +func (o *DistributionStatisticsRecordRegions) GetSA() *DistributionStatisticsRecordEntry { + if o == nil || IsNil(o.SA) { + var ret *DistributionStatisticsRecordEntry + return ret + } + + return o.SA +} + +// GetSAOk returns a tuple with the SA field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetSAOk() (*DistributionStatisticsRecordEntry, bool) { + if o == nil { + return nil, false + } + return o.SA, true +} + +// SetSA sets field value +func (o *DistributionStatisticsRecordRegions) SetSA(v *DistributionStatisticsRecordEntry) { + o.SA = v +} + +// GetUS returns the US field value +func (o *DistributionStatisticsRecordRegions) GetUS() *DistributionStatisticsRecordEntry { + if o == nil || IsNil(o.US) { + var ret *DistributionStatisticsRecordEntry + return ret + } + + return o.US +} + +// GetUSOk returns a tuple with the US field value +// and a boolean to check if the value has been set. +func (o *DistributionStatisticsRecordRegions) GetUSOk() (*DistributionStatisticsRecordEntry, bool) { + if o == nil { + return nil, false + } + return o.US, true +} + +// SetUS sets field value +func (o *DistributionStatisticsRecordRegions) SetUS(v *DistributionStatisticsRecordEntry) { + o.US = v +} + +func (o DistributionStatisticsRecordRegions) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["AF"] = o.AF + toSerialize["ASIA"] = o.ASIA + toSerialize["EU"] = o.EU + toSerialize["SA"] = o.SA + toSerialize["US"] = o.US + return toSerialize, nil +} + +type NullableDistributionStatisticsRecordRegions struct { + value *DistributionStatisticsRecordRegions + isSet bool +} + +func (v NullableDistributionStatisticsRecordRegions) Get() *DistributionStatisticsRecordRegions { + return v.value +} + +func (v *NullableDistributionStatisticsRecordRegions) Set(val *DistributionStatisticsRecordRegions) { + v.value = val + v.isSet = true +} + +func (v NullableDistributionStatisticsRecordRegions) IsSet() bool { + return v.isSet +} + +func (v *NullableDistributionStatisticsRecordRegions) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDistributionStatisticsRecordRegions(val *DistributionStatisticsRecordRegions) *NullableDistributionStatisticsRecordRegions { + return &NullableDistributionStatisticsRecordRegions{value: val, isSet: true} +} + +func (v NullableDistributionStatisticsRecordRegions) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDistributionStatisticsRecordRegions) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_domain.go b/services/cdn/model_domain.go new file mode 100644 index 000000000..a297bce61 --- /dev/null +++ b/services/cdn/model_domain.go @@ -0,0 +1,205 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the Domain type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Domain{} + +// Domain Definition of a custom or managed domain without any certificates or keys +type Domain struct { + // This object is present if the custom domain has errors. + Errors *[]StatusError `json:"errors,omitempty"` + // The domain. If this is a custom domain, you can call the GetCustomDomain Endpoint + // REQUIRED + Name *string `json:"name"` + // REQUIRED + Status *DomainStatus `json:"status"` + // Specifies the type of this Domain. Custom Domain can be further queries using the GetCustomDomain Endpoint + // REQUIRED + Type *string `json:"type"` +} + +type _Domain Domain + +// NewDomain instantiates a new Domain 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 NewDomain(name *string, status *DomainStatus, type_ *string) *Domain { + this := Domain{} + this.Name = name + this.Status = status + this.Type = type_ + return &this +} + +// NewDomainWithDefaults instantiates a new Domain 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 NewDomainWithDefaults() *Domain { + this := Domain{} + return &this +} + +// GetErrors returns the Errors field value if set, zero value otherwise. +func (o *Domain) GetErrors() *[]StatusError { + if o == nil || IsNil(o.Errors) { + var ret *[]StatusError + return ret + } + return o.Errors +} + +// GetErrorsOk returns a tuple with the Errors field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Domain) GetErrorsOk() (*[]StatusError, bool) { + if o == nil || IsNil(o.Errors) { + return nil, false + } + return o.Errors, true +} + +// HasErrors returns a boolean if a field has been set. +func (o *Domain) HasErrors() bool { + if o != nil && !IsNil(o.Errors) { + return true + } + + return false +} + +// SetErrors gets a reference to the given []StatusError and assigns it to the Errors field. +func (o *Domain) SetErrors(v *[]StatusError) { + o.Errors = v +} + +// GetName returns the Name field value +func (o *Domain) GetName() *string { + if o == nil || IsNil(o.Name) { + var ret *string + return ret + } + + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *Domain) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Name, true +} + +// SetName sets field value +func (o *Domain) SetName(v *string) { + o.Name = v +} + +// GetStatus returns the Status field value +func (o *Domain) GetStatus() *DomainStatus { + if o == nil || IsNil(o.Status) { + var ret *DomainStatus + 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 *Domain) GetStatusOk() (*DomainStatus, bool) { + if o == nil { + return nil, false + } + return o.Status, true +} + +// SetStatus sets field value +func (o *Domain) SetStatus(v *DomainStatus) { + o.Status = v +} + +// GetType returns the Type field value +func (o *Domain) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *Domain) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *Domain) SetType(v *string) { + o.Type = v +} + +func (o Domain) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Errors) { + toSerialize["errors"] = o.Errors + } + toSerialize["name"] = o.Name + toSerialize["status"] = o.Status + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableDomain struct { + value *Domain + isSet bool +} + +func (v NullableDomain) Get() *Domain { + return v.value +} + +func (v *NullableDomain) Set(val *Domain) { + v.value = val + v.isSet = true +} + +func (v NullableDomain) IsSet() bool { + return v.isSet +} + +func (v *NullableDomain) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomain(val *Domain) *NullableDomain { + return &NullableDomain{value: val, isSet: true} +} + +func (v NullableDomain) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomain) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_domain_status.go b/services/cdn/model_domain_status.go new file mode 100644 index 000000000..7b648ebe4 --- /dev/null +++ b/services/cdn/model_domain_status.go @@ -0,0 +1,121 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// DomainStatus The status of the domain: CREATING indicates that the custom domain is being set up. UPDATING means that requested changes are being applied to the custom domain. ACTIVE means the custom domain is currently configured and active. DELETING means that the domain is in the process of being removed from the distribution. In case the domain has the ERROR state, more information will be available in the errors list. +type DomainStatus string + +// List of DomainStatus +const ( + DOMAINSTATUS_CREATING DomainStatus = "CREATING" + DOMAINSTATUS_ACTIVE DomainStatus = "ACTIVE" + DOMAINSTATUS_UPDATING DomainStatus = "UPDATING" + DOMAINSTATUS_DELETING DomainStatus = "DELETING" + DOMAINSTATUS_ERROR DomainStatus = "ERROR" +) + +// All allowed values of DomainStatus enum +var AllowedDomainStatusEnumValues = []DomainStatus{ + "CREATING", + "ACTIVE", + "UPDATING", + "DELETING", + "ERROR", +} + +func (v *DomainStatus) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := DomainStatus(value) + for _, existing := range AllowedDomainStatusEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid DomainStatus", value) +} + +// NewDomainStatusFromValue returns a pointer to a valid DomainStatus +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDomainStatusFromValue(v string) (*DomainStatus, error) { + ev := DomainStatus(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for DomainStatus: valid values are %v", v, AllowedDomainStatusEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v DomainStatus) IsValid() bool { + for _, existing := range AllowedDomainStatusEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to DomainStatus value +func (v DomainStatus) Ptr() *DomainStatus { + return &v +} + +type NullableDomainStatus struct { + value *DomainStatus + isSet bool +} + +func (v NullableDomainStatus) Get() *DomainStatus { + return v.value +} + +func (v *NullableDomainStatus) Set(val *DomainStatus) { + v.value = val + v.isSet = true +} + +func (v NullableDomainStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableDomainStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDomainStatus(val *DomainStatus) *NullableDomainStatus { + return &NullableDomainStatus{value: val, isSet: true} +} + +func (v NullableDomainStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDomainStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_find_cache_paths_response.go b/services/cdn/model_find_cache_paths_response.go new file mode 100644 index 000000000..cb17fd00b --- /dev/null +++ b/services/cdn/model_find_cache_paths_response.go @@ -0,0 +1,110 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the FindCachePathsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindCachePathsResponse{} + +// FindCachePathsResponse struct for FindCachePathsResponse +type FindCachePathsResponse struct { + // REQUIRED + Response *[]FindCachePathsResponseEntry `json:"response"` +} + +type _FindCachePathsResponse FindCachePathsResponse + +// NewFindCachePathsResponse instantiates a new FindCachePathsResponse 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 NewFindCachePathsResponse(response *[]FindCachePathsResponseEntry) *FindCachePathsResponse { + this := FindCachePathsResponse{} + this.Response = response + return &this +} + +// NewFindCachePathsResponseWithDefaults instantiates a new FindCachePathsResponse 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 NewFindCachePathsResponseWithDefaults() *FindCachePathsResponse { + this := FindCachePathsResponse{} + return &this +} + +// GetResponse returns the Response field value +func (o *FindCachePathsResponse) GetResponse() *[]FindCachePathsResponseEntry { + if o == nil || IsNil(o.Response) { + var ret *[]FindCachePathsResponseEntry + return ret + } + + return o.Response +} + +// GetResponseOk returns a tuple with the Response field value +// and a boolean to check if the value has been set. +func (o *FindCachePathsResponse) GetResponseOk() (*[]FindCachePathsResponseEntry, bool) { + if o == nil { + return nil, false + } + return o.Response, true +} + +// SetResponse sets field value +func (o *FindCachePathsResponse) SetResponse(v *[]FindCachePathsResponseEntry) { + o.Response = v +} + +func (o FindCachePathsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["response"] = o.Response + return toSerialize, nil +} + +type NullableFindCachePathsResponse struct { + value *FindCachePathsResponse + isSet bool +} + +func (v NullableFindCachePathsResponse) Get() *FindCachePathsResponse { + return v.value +} + +func (v *NullableFindCachePathsResponse) Set(val *FindCachePathsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableFindCachePathsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableFindCachePathsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindCachePathsResponse(val *FindCachePathsResponse) *NullableFindCachePathsResponse { + return &NullableFindCachePathsResponse{value: val, isSet: true} +} + +func (v NullableFindCachePathsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindCachePathsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_find_cache_paths_response_entry.go b/services/cdn/model_find_cache_paths_response_entry.go new file mode 100644 index 000000000..fa300b63e --- /dev/null +++ b/services/cdn/model_find_cache_paths_response_entry.go @@ -0,0 +1,111 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the FindCachePathsResponseEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &FindCachePathsResponseEntry{} + +// FindCachePathsResponseEntry struct for FindCachePathsResponseEntry +type FindCachePathsResponseEntry struct { + // Defines one path that was previously used as part of a granular purge + // REQUIRED + Path *string `json:"path"` +} + +type _FindCachePathsResponseEntry FindCachePathsResponseEntry + +// NewFindCachePathsResponseEntry instantiates a new FindCachePathsResponseEntry 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 NewFindCachePathsResponseEntry(path *string) *FindCachePathsResponseEntry { + this := FindCachePathsResponseEntry{} + this.Path = path + return &this +} + +// NewFindCachePathsResponseEntryWithDefaults instantiates a new FindCachePathsResponseEntry 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 NewFindCachePathsResponseEntryWithDefaults() *FindCachePathsResponseEntry { + this := FindCachePathsResponseEntry{} + return &this +} + +// GetPath returns the Path field value +func (o *FindCachePathsResponseEntry) GetPath() *string { + if o == nil || IsNil(o.Path) { + var ret *string + return ret + } + + return o.Path +} + +// GetPathOk returns a tuple with the Path field value +// and a boolean to check if the value has been set. +func (o *FindCachePathsResponseEntry) GetPathOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Path, true +} + +// SetPath sets field value +func (o *FindCachePathsResponseEntry) SetPath(v *string) { + o.Path = v +} + +func (o FindCachePathsResponseEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["path"] = o.Path + return toSerialize, nil +} + +type NullableFindCachePathsResponseEntry struct { + value *FindCachePathsResponseEntry + isSet bool +} + +func (v NullableFindCachePathsResponseEntry) Get() *FindCachePathsResponseEntry { + return v.value +} + +func (v *NullableFindCachePathsResponseEntry) Set(val *FindCachePathsResponseEntry) { + v.value = val + v.isSet = true +} + +func (v NullableFindCachePathsResponseEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableFindCachePathsResponseEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFindCachePathsResponseEntry(val *FindCachePathsResponseEntry) *NullableFindCachePathsResponseEntry { + return &NullableFindCachePathsResponseEntry{value: val, isSet: true} +} + +func (v NullableFindCachePathsResponseEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFindCachePathsResponseEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_generic_json_response.go b/services/cdn/model_generic_json_response.go new file mode 100644 index 000000000..c2828e0bc --- /dev/null +++ b/services/cdn/model_generic_json_response.go @@ -0,0 +1,147 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GenericJSONResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericJSONResponse{} + +// GenericJSONResponse struct for GenericJSONResponse +type GenericJSONResponse struct { + // Listing of issues with your request + Details *[]GenericJSONResponseDetailsInner `json:"details,omitempty"` + // REQUIRED + Message *string `json:"message"` +} + +type _GenericJSONResponse GenericJSONResponse + +// NewGenericJSONResponse instantiates a new GenericJSONResponse 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 NewGenericJSONResponse(message *string) *GenericJSONResponse { + this := GenericJSONResponse{} + this.Message = message + return &this +} + +// NewGenericJSONResponseWithDefaults instantiates a new GenericJSONResponse 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 NewGenericJSONResponseWithDefaults() *GenericJSONResponse { + this := GenericJSONResponse{} + return &this +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *GenericJSONResponse) GetDetails() *[]GenericJSONResponseDetailsInner { + if o == nil || IsNil(o.Details) { + var ret *[]GenericJSONResponseDetailsInner + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GenericJSONResponse) GetDetailsOk() (*[]GenericJSONResponseDetailsInner, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *GenericJSONResponse) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []GenericJSONResponseDetailsInner and assigns it to the Details field. +func (o *GenericJSONResponse) SetDetails(v *[]GenericJSONResponseDetailsInner) { + o.Details = v +} + +// GetMessage returns the Message field value +func (o *GenericJSONResponse) GetMessage() *string { + if o == nil || IsNil(o.Message) { + var ret *string + return ret + } + + return o.Message +} + +// GetMessageOk returns a tuple with the Message field value +// and a boolean to check if the value has been set. +func (o *GenericJSONResponse) GetMessageOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Message, true +} + +// SetMessage sets field value +func (o *GenericJSONResponse) SetMessage(v *string) { + o.Message = v +} + +func (o GenericJSONResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + toSerialize["message"] = o.Message + return toSerialize, nil +} + +type NullableGenericJSONResponse struct { + value *GenericJSONResponse + isSet bool +} + +func (v NullableGenericJSONResponse) Get() *GenericJSONResponse { + return v.value +} + +func (v *NullableGenericJSONResponse) Set(val *GenericJSONResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGenericJSONResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericJSONResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericJSONResponse(val *GenericJSONResponse) *NullableGenericJSONResponse { + return &NullableGenericJSONResponse{value: val, isSet: true} +} + +func (v NullableGenericJSONResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericJSONResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_generic_json_response_details_inner.go b/services/cdn/model_generic_json_response_details_inner.go new file mode 100644 index 000000000..192335835 --- /dev/null +++ b/services/cdn/model_generic_json_response_details_inner.go @@ -0,0 +1,138 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GenericJSONResponseDetailsInner type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GenericJSONResponseDetailsInner{} + +// GenericJSONResponseDetailsInner struct for GenericJSONResponseDetailsInner +type GenericJSONResponseDetailsInner struct { + // REQUIRED + Description *string `json:"description"` + // REQUIRED + Field *string `json:"field"` +} + +type _GenericJSONResponseDetailsInner GenericJSONResponseDetailsInner + +// NewGenericJSONResponseDetailsInner instantiates a new GenericJSONResponseDetailsInner 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 NewGenericJSONResponseDetailsInner(description *string, field *string) *GenericJSONResponseDetailsInner { + this := GenericJSONResponseDetailsInner{} + this.Description = description + this.Field = field + return &this +} + +// NewGenericJSONResponseDetailsInnerWithDefaults instantiates a new GenericJSONResponseDetailsInner 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 NewGenericJSONResponseDetailsInnerWithDefaults() *GenericJSONResponseDetailsInner { + this := GenericJSONResponseDetailsInner{} + return &this +} + +// GetDescription returns the Description field value +func (o *GenericJSONResponseDetailsInner) 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 +// and a boolean to check if the value has been set. +func (o *GenericJSONResponseDetailsInner) GetDescriptionOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Description, true +} + +// SetDescription sets field value +func (o *GenericJSONResponseDetailsInner) SetDescription(v *string) { + o.Description = v +} + +// GetField returns the Field field value +func (o *GenericJSONResponseDetailsInner) GetField() *string { + if o == nil || IsNil(o.Field) { + var ret *string + return ret + } + + return o.Field +} + +// GetFieldOk returns a tuple with the Field field value +// and a boolean to check if the value has been set. +func (o *GenericJSONResponseDetailsInner) GetFieldOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Field, true +} + +// SetField sets field value +func (o *GenericJSONResponseDetailsInner) SetField(v *string) { + o.Field = v +} + +func (o GenericJSONResponseDetailsInner) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["description"] = o.Description + toSerialize["field"] = o.Field + return toSerialize, nil +} + +type NullableGenericJSONResponseDetailsInner struct { + value *GenericJSONResponseDetailsInner + isSet bool +} + +func (v NullableGenericJSONResponseDetailsInner) Get() *GenericJSONResponseDetailsInner { + return v.value +} + +func (v *NullableGenericJSONResponseDetailsInner) Set(val *GenericJSONResponseDetailsInner) { + v.value = val + v.isSet = true +} + +func (v NullableGenericJSONResponseDetailsInner) IsSet() bool { + return v.isSet +} + +func (v *NullableGenericJSONResponseDetailsInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGenericJSONResponseDetailsInner(val *GenericJSONResponseDetailsInner) *NullableGenericJSONResponseDetailsInner { + return &NullableGenericJSONResponseDetailsInner{value: val, isSet: true} +} + +func (v NullableGenericJSONResponseDetailsInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGenericJSONResponseDetailsInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_cache_info_response.go b/services/cdn/model_get_cache_info_response.go new file mode 100644 index 000000000..77b7c2662 --- /dev/null +++ b/services/cdn/model_get_cache_info_response.go @@ -0,0 +1,145 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "time" +) + +// checks if the GetCacheInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCacheInfoResponse{} + +// GetCacheInfoResponse struct for GetCacheInfoResponse +type GetCacheInfoResponse struct { + // REQUIRED + History *[]GetCacheInfoResponseHistoryEntry `json:"history"` + // Returns the last time the cache was purged by calling the PurgeCache endpoint. Time represented as RFC3339 compliant string. If the cache was never purged, this returns `null` + // REQUIRED + LastPurgeTime *NullableTime `json:"lastPurgeTime"` +} + +type _GetCacheInfoResponse GetCacheInfoResponse + +// NewGetCacheInfoResponse instantiates a new GetCacheInfoResponse 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 NewGetCacheInfoResponse(history *[]GetCacheInfoResponseHistoryEntry, lastPurgeTime *NullableTime) *GetCacheInfoResponse { + this := GetCacheInfoResponse{} + this.History = history + this.LastPurgeTime = lastPurgeTime + return &this +} + +// NewGetCacheInfoResponseWithDefaults instantiates a new GetCacheInfoResponse 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 NewGetCacheInfoResponseWithDefaults() *GetCacheInfoResponse { + this := GetCacheInfoResponse{} + return &this +} + +// GetHistory returns the History field value +func (o *GetCacheInfoResponse) GetHistory() *[]GetCacheInfoResponseHistoryEntry { + if o == nil || IsNil(o.History) { + var ret *[]GetCacheInfoResponseHistoryEntry + return ret + } + + return o.History +} + +// GetHistoryOk returns a tuple with the History field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponse) GetHistoryOk() (*[]GetCacheInfoResponseHistoryEntry, bool) { + if o == nil { + return nil, false + } + return o.History, true +} + +// SetHistory sets field value +func (o *GetCacheInfoResponse) SetHistory(v *[]GetCacheInfoResponseHistoryEntry) { + o.History = v +} + +// GetLastPurgeTime returns the LastPurgeTime field value +// If the value is explicit nil, the zero value for time.Time will be returned +func (o *GetCacheInfoResponse) GetLastPurgeTime() *time.Time { + if o == nil || IsNil(o.LastPurgeTime) || o.LastPurgeTime.Get() == nil { + var ret *time.Time + return ret + } + + return o.LastPurgeTime.Get() +} + +// GetLastPurgeTimeOk returns a tuple with the LastPurgeTime field value +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned +func (o *GetCacheInfoResponse) GetLastPurgeTimeOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.LastPurgeTime.Get(), o.LastPurgeTime.IsSet() +} + +// SetLastPurgeTime sets field value +func (o *GetCacheInfoResponse) SetLastPurgeTime(v *time.Time) { + if IsNil(o.LastPurgeTime) { + o.LastPurgeTime = new(NullableTime) + } + o.LastPurgeTime.Set(v) +} + +func (o GetCacheInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["history"] = o.History + toSerialize["lastPurgeTime"] = o.LastPurgeTime.Get() + return toSerialize, nil +} + +type NullableGetCacheInfoResponse struct { + value *GetCacheInfoResponse + isSet bool +} + +func (v NullableGetCacheInfoResponse) Get() *GetCacheInfoResponse { + return v.value +} + +func (v *NullableGetCacheInfoResponse) Set(val *GetCacheInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponse(val *GetCacheInfoResponse) *NullableGetCacheInfoResponse { + return &NullableGetCacheInfoResponse{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_cache_info_response_history_entry.go b/services/cdn/model_get_cache_info_response_history_entry.go new file mode 100644 index 000000000..8fdc8c340 --- /dev/null +++ b/services/cdn/model_get_cache_info_response_history_entry.go @@ -0,0 +1,171 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "time" +) + +// checks if the GetCacheInfoResponseHistoryEntry type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCacheInfoResponseHistoryEntry{} + +// GetCacheInfoResponseHistoryEntry struct for GetCacheInfoResponseHistoryEntry +type GetCacheInfoResponseHistoryEntry struct { + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + OccuredAt *time.Time `json:"occuredAt"` + // REQUIRED + OccurredAt *time.Time `json:"occurredAt"` + // REQUIRED + Type *string `json:"type"` +} + +type _GetCacheInfoResponseHistoryEntry GetCacheInfoResponseHistoryEntry + +// NewGetCacheInfoResponseHistoryEntry instantiates a new GetCacheInfoResponseHistoryEntry 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 NewGetCacheInfoResponseHistoryEntry(occuredAt *time.Time, occurredAt *time.Time, type_ *string) *GetCacheInfoResponseHistoryEntry { + this := GetCacheInfoResponseHistoryEntry{} + this.OccuredAt = occuredAt + this.OccurredAt = occurredAt + this.Type = type_ + return &this +} + +// NewGetCacheInfoResponseHistoryEntryWithDefaults instantiates a new GetCacheInfoResponseHistoryEntry 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 NewGetCacheInfoResponseHistoryEntryWithDefaults() *GetCacheInfoResponseHistoryEntry { + this := GetCacheInfoResponseHistoryEntry{} + return &this +} + +// GetOccuredAt returns the OccuredAt field value +// Deprecated +func (o *GetCacheInfoResponseHistoryEntry) GetOccuredAt() *time.Time { + if o == nil || IsNil(o.OccuredAt) { + var ret *time.Time + return ret + } + + return o.OccuredAt +} + +// GetOccuredAtOk returns a tuple with the OccuredAt field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *GetCacheInfoResponseHistoryEntry) GetOccuredAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.OccuredAt, true +} + +// SetOccuredAt sets field value +// Deprecated +func (o *GetCacheInfoResponseHistoryEntry) SetOccuredAt(v *time.Time) { + o.OccuredAt = v +} + +// GetOccurredAt returns the OccurredAt field value +func (o *GetCacheInfoResponseHistoryEntry) GetOccurredAt() *time.Time { + if o == nil || IsNil(o.OccurredAt) { + var ret *time.Time + return ret + } + + return o.OccurredAt +} + +// GetOccurredAtOk returns a tuple with the OccurredAt field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponseHistoryEntry) GetOccurredAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return o.OccurredAt, true +} + +// SetOccurredAt sets field value +func (o *GetCacheInfoResponseHistoryEntry) SetOccurredAt(v *time.Time) { + o.OccurredAt = v +} + +// GetType returns the Type field value +func (o *GetCacheInfoResponseHistoryEntry) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *GetCacheInfoResponseHistoryEntry) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *GetCacheInfoResponseHistoryEntry) SetType(v *string) { + o.Type = v +} + +func (o GetCacheInfoResponseHistoryEntry) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["occuredAt"] = o.OccuredAt + toSerialize["occurredAt"] = o.OccurredAt + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableGetCacheInfoResponseHistoryEntry struct { + value *GetCacheInfoResponseHistoryEntry + isSet bool +} + +func (v NullableGetCacheInfoResponseHistoryEntry) Get() *GetCacheInfoResponseHistoryEntry { + return v.value +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) Set(val *GetCacheInfoResponseHistoryEntry) { + v.value = val + v.isSet = true +} + +func (v NullableGetCacheInfoResponseHistoryEntry) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCacheInfoResponseHistoryEntry(val *GetCacheInfoResponseHistoryEntry) *NullableGetCacheInfoResponseHistoryEntry { + return &NullableGetCacheInfoResponseHistoryEntry{value: val, isSet: true} +} + +func (v NullableGetCacheInfoResponseHistoryEntry) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCacheInfoResponseHistoryEntry) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_custom_domain_response.go b/services/cdn/model_get_custom_domain_response.go new file mode 100644 index 000000000..af66a0cd8 --- /dev/null +++ b/services/cdn/model_get_custom_domain_response.go @@ -0,0 +1,142 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GetCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetCustomDomainResponse{} + +// GetCustomDomainResponse struct for GetCustomDomainResponse +type GetCustomDomainResponse struct { + // REQUIRED + CustomDomain *CustomDomain `json:"customDomain"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Domain *string `json:"domain"` +} + +type _GetCustomDomainResponse GetCustomDomainResponse + +// NewGetCustomDomainResponse instantiates a new GetCustomDomainResponse 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 NewGetCustomDomainResponse(customDomain *CustomDomain, domain *string) *GetCustomDomainResponse { + this := GetCustomDomainResponse{} + this.CustomDomain = customDomain + this.Domain = domain + return &this +} + +// NewGetCustomDomainResponseWithDefaults instantiates a new GetCustomDomainResponse 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 NewGetCustomDomainResponseWithDefaults() *GetCustomDomainResponse { + this := GetCustomDomainResponse{} + return &this +} + +// GetCustomDomain returns the CustomDomain field value +func (o *GetCustomDomainResponse) GetCustomDomain() *CustomDomain { + if o == nil || IsNil(o.CustomDomain) { + var ret *CustomDomain + return ret + } + + return o.CustomDomain +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value +// and a boolean to check if the value has been set. +func (o *GetCustomDomainResponse) GetCustomDomainOk() (*CustomDomain, bool) { + if o == nil { + return nil, false + } + return o.CustomDomain, true +} + +// SetCustomDomain sets field value +func (o *GetCustomDomainResponse) SetCustomDomain(v *CustomDomain) { + o.CustomDomain = v +} + +// GetDomain returns the Domain field value +// Deprecated +func (o *GetCustomDomainResponse) GetDomain() *string { + if o == nil || IsNil(o.Domain) { + var ret *string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *GetCustomDomainResponse) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Domain, true +} + +// SetDomain sets field value +// Deprecated +func (o *GetCustomDomainResponse) SetDomain(v *string) { + o.Domain = v +} + +func (o GetCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["customDomain"] = o.CustomDomain + toSerialize["domain"] = o.Domain + return toSerialize, nil +} + +type NullableGetCustomDomainResponse struct { + value *GetCustomDomainResponse + isSet bool +} + +func (v NullableGetCustomDomainResponse) Get() *GetCustomDomainResponse { + return v.value +} + +func (v *NullableGetCustomDomainResponse) Set(val *GetCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetCustomDomainResponse(val *GetCustomDomainResponse) *NullableGetCustomDomainResponse { + return &NullableGetCustomDomainResponse{value: val, isSet: true} +} + +func (v NullableGetCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_distribution_response.go b/services/cdn/model_get_distribution_response.go new file mode 100644 index 000000000..dd67ac1da --- /dev/null +++ b/services/cdn/model_get_distribution_response.go @@ -0,0 +1,110 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GetDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetDistributionResponse{} + +// GetDistributionResponse struct for GetDistributionResponse +type GetDistributionResponse struct { + // REQUIRED + Distribution *Distribution `json:"distribution"` +} + +type _GetDistributionResponse GetDistributionResponse + +// NewGetDistributionResponse instantiates a new GetDistributionResponse 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 NewGetDistributionResponse(distribution *Distribution) *GetDistributionResponse { + this := GetDistributionResponse{} + this.Distribution = distribution + return &this +} + +// NewGetDistributionResponseWithDefaults instantiates a new GetDistributionResponse 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 NewGetDistributionResponseWithDefaults() *GetDistributionResponse { + this := GetDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *GetDistributionResponse) GetDistribution() *Distribution { + if o == nil || IsNil(o.Distribution) { + var ret *Distribution + return ret + } + + return o.Distribution +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *GetDistributionResponse) GetDistributionOk() (*Distribution, bool) { + if o == nil { + return nil, false + } + return o.Distribution, true +} + +// SetDistribution sets field value +func (o *GetDistributionResponse) SetDistribution(v *Distribution) { + o.Distribution = v +} + +func (o GetDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["distribution"] = o.Distribution + return toSerialize, nil +} + +type NullableGetDistributionResponse struct { + value *GetDistributionResponse + isSet bool +} + +func (v NullableGetDistributionResponse) Get() *GetDistributionResponse { + return v.value +} + +func (v *NullableGetDistributionResponse) Set(val *GetDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetDistributionResponse(val *GetDistributionResponse) *NullableGetDistributionResponse { + return &NullableGetDistributionResponse{value: val, isSet: true} +} + +func (v NullableGetDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_get_statistics_response.go b/services/cdn/model_get_statistics_response.go new file mode 100644 index 000000000..8714792d4 --- /dev/null +++ b/services/cdn/model_get_statistics_response.go @@ -0,0 +1,110 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the GetStatisticsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GetStatisticsResponse{} + +// GetStatisticsResponse struct for GetStatisticsResponse +type GetStatisticsResponse struct { + // REQUIRED + Records *[]DistributionStatisticsRecord `json:"records"` +} + +type _GetStatisticsResponse GetStatisticsResponse + +// NewGetStatisticsResponse instantiates a new GetStatisticsResponse 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 NewGetStatisticsResponse(records *[]DistributionStatisticsRecord) *GetStatisticsResponse { + this := GetStatisticsResponse{} + this.Records = records + return &this +} + +// NewGetStatisticsResponseWithDefaults instantiates a new GetStatisticsResponse 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 NewGetStatisticsResponseWithDefaults() *GetStatisticsResponse { + this := GetStatisticsResponse{} + return &this +} + +// GetRecords returns the Records field value +func (o *GetStatisticsResponse) GetRecords() *[]DistributionStatisticsRecord { + if o == nil || IsNil(o.Records) { + var ret *[]DistributionStatisticsRecord + return ret + } + + return o.Records +} + +// GetRecordsOk returns a tuple with the Records field value +// and a boolean to check if the value has been set. +func (o *GetStatisticsResponse) GetRecordsOk() (*[]DistributionStatisticsRecord, bool) { + if o == nil { + return nil, false + } + return o.Records, true +} + +// SetRecords sets field value +func (o *GetStatisticsResponse) SetRecords(v *[]DistributionStatisticsRecord) { + o.Records = v +} + +func (o GetStatisticsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["records"] = o.Records + return toSerialize, nil +} + +type NullableGetStatisticsResponse struct { + value *GetStatisticsResponse + isSet bool +} + +func (v NullableGetStatisticsResponse) Get() *GetStatisticsResponse { + return v.value +} + +func (v *NullableGetStatisticsResponse) Set(val *GetStatisticsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGetStatisticsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGetStatisticsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGetStatisticsResponse(val *GetStatisticsResponse) *NullableGetStatisticsResponse { + return &NullableGetStatisticsResponse{value: val, isSet: true} +} + +func (v NullableGetStatisticsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGetStatisticsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_http_backend.go b/services/cdn/model_http_backend.go new file mode 100644 index 000000000..5d3a369f1 --- /dev/null +++ b/services/cdn/model_http_backend.go @@ -0,0 +1,167 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the HttpBackend type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpBackend{} + +// HttpBackend struct for HttpBackend +type HttpBackend struct { + // Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. + // REQUIRED + OriginRequestHeaders *map[string]string `json:"originRequestHeaders"` + // REQUIRED + OriginUrl *string `json:"originUrl"` + // REQUIRED + Type *string `json:"type"` +} + +type _HttpBackend HttpBackend + +// NewHttpBackend instantiates a new HttpBackend 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 NewHttpBackend(originRequestHeaders *map[string]string, originUrl *string, type_ *string) *HttpBackend { + this := HttpBackend{} + this.OriginRequestHeaders = originRequestHeaders + this.OriginUrl = originUrl + this.Type = type_ + return &this +} + +// NewHttpBackendWithDefaults instantiates a new HttpBackend 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 NewHttpBackendWithDefaults() *HttpBackend { + this := HttpBackend{} + return &this +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value +func (o *HttpBackend) GetOriginRequestHeaders() *map[string]string { + if o == nil || IsNil(o.OriginRequestHeaders) { + var ret *map[string]string + return ret + } + + return o.OriginRequestHeaders +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetOriginRequestHeadersOk() (*map[string]string, bool) { + if o == nil { + return nil, false + } + return o.OriginRequestHeaders, true +} + +// SetOriginRequestHeaders sets field value +func (o *HttpBackend) SetOriginRequestHeaders(v *map[string]string) { + o.OriginRequestHeaders = v +} + +// GetOriginUrl returns the OriginUrl field value +func (o *HttpBackend) GetOriginUrl() *string { + if o == nil || IsNil(o.OriginUrl) { + var ret *string + return ret + } + + return o.OriginUrl +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetOriginUrlOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.OriginUrl, true +} + +// SetOriginUrl sets field value +func (o *HttpBackend) SetOriginUrl(v *string) { + o.OriginUrl = v +} + +// GetType returns the Type field value +func (o *HttpBackend) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HttpBackend) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *HttpBackend) SetType(v *string) { + o.Type = v +} + +func (o HttpBackend) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["originRequestHeaders"] = o.OriginRequestHeaders + toSerialize["originUrl"] = o.OriginUrl + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableHttpBackend struct { + value *HttpBackend + isSet bool +} + +func (v NullableHttpBackend) Get() *HttpBackend { + return v.value +} + +func (v *NullableHttpBackend) Set(val *HttpBackend) { + v.value = val + v.isSet = true +} + +func (v NullableHttpBackend) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpBackend) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpBackend(val *HttpBackend) *NullableHttpBackend { + return &NullableHttpBackend{value: val, isSet: true} +} + +func (v NullableHttpBackend) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpBackend) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_http_backend_patch.go b/services/cdn/model_http_backend_patch.go new file mode 100644 index 000000000..3313e72d5 --- /dev/null +++ b/services/cdn/model_http_backend_patch.go @@ -0,0 +1,184 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the HttpBackendPatch type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &HttpBackendPatch{} + +// HttpBackendPatch A partial HTTP Backend +type HttpBackendPatch struct { + // Headers that will be sent with every request to the configured origin. **WARNING**: Do not store sensitive values in the headers. The configuration is stored as plain text. + OriginRequestHeaders *map[string]string `json:"originRequestHeaders,omitempty"` + OriginUrl *string `json:"originUrl,omitempty"` + // This property is required to determine the used backend type. + // REQUIRED + Type *string `json:"type"` +} + +type _HttpBackendPatch HttpBackendPatch + +// NewHttpBackendPatch instantiates a new HttpBackendPatch 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 NewHttpBackendPatch(type_ *string) *HttpBackendPatch { + this := HttpBackendPatch{} + this.Type = type_ + return &this +} + +// NewHttpBackendPatchWithDefaults instantiates a new HttpBackendPatch 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 NewHttpBackendPatchWithDefaults() *HttpBackendPatch { + this := HttpBackendPatch{} + return &this +} + +// GetOriginRequestHeaders returns the OriginRequestHeaders field value if set, zero value otherwise. +func (o *HttpBackendPatch) GetOriginRequestHeaders() *map[string]string { + if o == nil || IsNil(o.OriginRequestHeaders) { + var ret *map[string]string + return ret + } + return o.OriginRequestHeaders +} + +// GetOriginRequestHeadersOk returns a tuple with the OriginRequestHeaders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetOriginRequestHeadersOk() (*map[string]string, bool) { + if o == nil || IsNil(o.OriginRequestHeaders) { + return nil, false + } + return o.OriginRequestHeaders, true +} + +// HasOriginRequestHeaders returns a boolean if a field has been set. +func (o *HttpBackendPatch) HasOriginRequestHeaders() bool { + if o != nil && !IsNil(o.OriginRequestHeaders) { + return true + } + + return false +} + +// SetOriginRequestHeaders gets a reference to the given map[string]string and assigns it to the OriginRequestHeaders field. +func (o *HttpBackendPatch) SetOriginRequestHeaders(v *map[string]string) { + o.OriginRequestHeaders = v +} + +// GetOriginUrl returns the OriginUrl field value if set, zero value otherwise. +func (o *HttpBackendPatch) GetOriginUrl() *string { + if o == nil || IsNil(o.OriginUrl) { + var ret *string + return ret + } + return o.OriginUrl +} + +// GetOriginUrlOk returns a tuple with the OriginUrl field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetOriginUrlOk() (*string, bool) { + if o == nil || IsNil(o.OriginUrl) { + return nil, false + } + return o.OriginUrl, true +} + +// HasOriginUrl returns a boolean if a field has been set. +func (o *HttpBackendPatch) HasOriginUrl() bool { + if o != nil && !IsNil(o.OriginUrl) { + return true + } + + return false +} + +// SetOriginUrl gets a reference to the given string and assigns it to the OriginUrl field. +func (o *HttpBackendPatch) SetOriginUrl(v *string) { + o.OriginUrl = v +} + +// GetType returns the Type field value +func (o *HttpBackendPatch) GetType() *string { + if o == nil || IsNil(o.Type) { + var ret *string + return ret + } + + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *HttpBackendPatch) GetTypeOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Type, true +} + +// SetType sets field value +func (o *HttpBackendPatch) SetType(v *string) { + o.Type = v +} + +func (o HttpBackendPatch) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.OriginRequestHeaders) { + toSerialize["originRequestHeaders"] = o.OriginRequestHeaders + } + if !IsNil(o.OriginUrl) { + toSerialize["originUrl"] = o.OriginUrl + } + toSerialize["type"] = o.Type + return toSerialize, nil +} + +type NullableHttpBackendPatch struct { + value *HttpBackendPatch + isSet bool +} + +func (v NullableHttpBackendPatch) Get() *HttpBackendPatch { + return v.value +} + +func (v *NullableHttpBackendPatch) Set(val *HttpBackendPatch) { + v.value = val + v.isSet = true +} + +func (v NullableHttpBackendPatch) IsSet() bool { + return v.isSet +} + +func (v *NullableHttpBackendPatch) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableHttpBackendPatch(val *HttpBackendPatch) *NullableHttpBackendPatch { + return &NullableHttpBackendPatch{value: val, isSet: true} +} + +func (v NullableHttpBackendPatch) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableHttpBackendPatch) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_list_distributions_response.go b/services/cdn/model_list_distributions_response.go new file mode 100644 index 000000000..4acf61494 --- /dev/null +++ b/services/cdn/model_list_distributions_response.go @@ -0,0 +1,146 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the ListDistributionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListDistributionsResponse{} + +// ListDistributionsResponse struct for ListDistributionsResponse +type ListDistributionsResponse struct { + // REQUIRED + Distributions *[]Distribution `json:"distributions"` + NextPageIdentifier *string `json:"nextPageIdentifier,omitempty"` +} + +type _ListDistributionsResponse ListDistributionsResponse + +// NewListDistributionsResponse instantiates a new ListDistributionsResponse 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 NewListDistributionsResponse(distributions *[]Distribution) *ListDistributionsResponse { + this := ListDistributionsResponse{} + this.Distributions = distributions + return &this +} + +// NewListDistributionsResponseWithDefaults instantiates a new ListDistributionsResponse 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 NewListDistributionsResponseWithDefaults() *ListDistributionsResponse { + this := ListDistributionsResponse{} + return &this +} + +// GetDistributions returns the Distributions field value +func (o *ListDistributionsResponse) GetDistributions() *[]Distribution { + if o == nil || IsNil(o.Distributions) { + var ret *[]Distribution + return ret + } + + return o.Distributions +} + +// GetDistributionsOk returns a tuple with the Distributions field value +// and a boolean to check if the value has been set. +func (o *ListDistributionsResponse) GetDistributionsOk() (*[]Distribution, bool) { + if o == nil { + return nil, false + } + return o.Distributions, true +} + +// SetDistributions sets field value +func (o *ListDistributionsResponse) SetDistributions(v *[]Distribution) { + o.Distributions = v +} + +// GetNextPageIdentifier returns the NextPageIdentifier field value if set, zero value otherwise. +func (o *ListDistributionsResponse) GetNextPageIdentifier() *string { + if o == nil || IsNil(o.NextPageIdentifier) { + var ret *string + return ret + } + return o.NextPageIdentifier +} + +// GetNextPageIdentifierOk returns a tuple with the NextPageIdentifier field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListDistributionsResponse) GetNextPageIdentifierOk() (*string, bool) { + if o == nil || IsNil(o.NextPageIdentifier) { + return nil, false + } + return o.NextPageIdentifier, true +} + +// HasNextPageIdentifier returns a boolean if a field has been set. +func (o *ListDistributionsResponse) HasNextPageIdentifier() bool { + if o != nil && !IsNil(o.NextPageIdentifier) { + return true + } + + return false +} + +// SetNextPageIdentifier gets a reference to the given string and assigns it to the NextPageIdentifier field. +func (o *ListDistributionsResponse) SetNextPageIdentifier(v *string) { + o.NextPageIdentifier = v +} + +func (o ListDistributionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["distributions"] = o.Distributions + if !IsNil(o.NextPageIdentifier) { + toSerialize["nextPageIdentifier"] = o.NextPageIdentifier + } + return toSerialize, nil +} + +type NullableListDistributionsResponse struct { + value *ListDistributionsResponse + isSet bool +} + +func (v NullableListDistributionsResponse) Get() *ListDistributionsResponse { + return v.value +} + +func (v *NullableListDistributionsResponse) Set(val *ListDistributionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListDistributionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListDistributionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListDistributionsResponse(val *ListDistributionsResponse) *NullableListDistributionsResponse { + return &NullableListDistributionsResponse{value: val, isSet: true} +} + +func (v NullableListDistributionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListDistributionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_patch_distribution_payload.go b/services/cdn/model_patch_distribution_payload.go new file mode 100644 index 000000000..066e47273 --- /dev/null +++ b/services/cdn/model_patch_distribution_payload.go @@ -0,0 +1,153 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PatchDistributionPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchDistributionPayload{} + +// PatchDistributionPayload Defines a partial distribution. Set values +type PatchDistributionPayload struct { + Config *ConfigPatch `json:"config,omitempty"` + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple modifying requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId *string `json:"intentId,omitempty"` +} + +// NewPatchDistributionPayload instantiates a new PatchDistributionPayload 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 NewPatchDistributionPayload() *PatchDistributionPayload { + this := PatchDistributionPayload{} + return &this +} + +// NewPatchDistributionPayloadWithDefaults instantiates a new PatchDistributionPayload 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 NewPatchDistributionPayloadWithDefaults() *PatchDistributionPayload { + this := PatchDistributionPayload{} + return &this +} + +// GetConfig returns the Config field value if set, zero value otherwise. +func (o *PatchDistributionPayload) GetConfig() *ConfigPatch { + if o == nil || IsNil(o.Config) { + var ret *ConfigPatch + return ret + } + return o.Config +} + +// GetConfigOk returns a tuple with the Config field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchDistributionPayload) GetConfigOk() (*ConfigPatch, bool) { + if o == nil || IsNil(o.Config) { + return nil, false + } + return o.Config, true +} + +// HasConfig returns a boolean if a field has been set. +func (o *PatchDistributionPayload) HasConfig() bool { + if o != nil && !IsNil(o.Config) { + return true + } + + return false +} + +// SetConfig gets a reference to the given ConfigPatch and assigns it to the Config field. +func (o *PatchDistributionPayload) SetConfig(v *ConfigPatch) { + o.Config = v +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *PatchDistributionPayload) GetIntentId() *string { + if o == nil || IsNil(o.IntentId) { + var ret *string + return ret + } + return o.IntentId +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PatchDistributionPayload) GetIntentIdOk() (*string, bool) { + if o == nil || IsNil(o.IntentId) { + return nil, false + } + return o.IntentId, true +} + +// HasIntentId returns a boolean if a field has been set. +func (o *PatchDistributionPayload) HasIntentId() bool { + if o != nil && !IsNil(o.IntentId) { + return true + } + + return false +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *PatchDistributionPayload) SetIntentId(v *string) { + o.IntentId = v +} + +func (o PatchDistributionPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Config) { + toSerialize["config"] = o.Config + } + if !IsNil(o.IntentId) { + toSerialize["intentId"] = o.IntentId + } + return toSerialize, nil +} + +type NullablePatchDistributionPayload struct { + value *PatchDistributionPayload + isSet bool +} + +func (v NullablePatchDistributionPayload) Get() *PatchDistributionPayload { + return v.value +} + +func (v *NullablePatchDistributionPayload) Set(val *PatchDistributionPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePatchDistributionPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchDistributionPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchDistributionPayload(val *PatchDistributionPayload) *NullablePatchDistributionPayload { + return &NullablePatchDistributionPayload{value: val, isSet: true} +} + +func (v NullablePatchDistributionPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchDistributionPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_patch_distribution_response.go b/services/cdn/model_patch_distribution_response.go new file mode 100644 index 000000000..ef912c24c --- /dev/null +++ b/services/cdn/model_patch_distribution_response.go @@ -0,0 +1,110 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PatchDistributionResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PatchDistributionResponse{} + +// PatchDistributionResponse struct for PatchDistributionResponse +type PatchDistributionResponse struct { + // REQUIRED + Distribution *Distribution `json:"distribution"` +} + +type _PatchDistributionResponse PatchDistributionResponse + +// NewPatchDistributionResponse instantiates a new PatchDistributionResponse 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 NewPatchDistributionResponse(distribution *Distribution) *PatchDistributionResponse { + this := PatchDistributionResponse{} + this.Distribution = distribution + return &this +} + +// NewPatchDistributionResponseWithDefaults instantiates a new PatchDistributionResponse 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 NewPatchDistributionResponseWithDefaults() *PatchDistributionResponse { + this := PatchDistributionResponse{} + return &this +} + +// GetDistribution returns the Distribution field value +func (o *PatchDistributionResponse) GetDistribution() *Distribution { + if o == nil || IsNil(o.Distribution) { + var ret *Distribution + return ret + } + + return o.Distribution +} + +// GetDistributionOk returns a tuple with the Distribution field value +// and a boolean to check if the value has been set. +func (o *PatchDistributionResponse) GetDistributionOk() (*Distribution, bool) { + if o == nil { + return nil, false + } + return o.Distribution, true +} + +// SetDistribution sets field value +func (o *PatchDistributionResponse) SetDistribution(v *Distribution) { + o.Distribution = v +} + +func (o PatchDistributionResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["distribution"] = o.Distribution + return toSerialize, nil +} + +type NullablePatchDistributionResponse struct { + value *PatchDistributionResponse + isSet bool +} + +func (v NullablePatchDistributionResponse) Get() *PatchDistributionResponse { + return v.value +} + +func (v *NullablePatchDistributionResponse) Set(val *PatchDistributionResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePatchDistributionResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePatchDistributionResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePatchDistributionResponse(val *PatchDistributionResponse) *NullablePatchDistributionResponse { + return &NullablePatchDistributionResponse{value: val, isSet: true} +} + +func (v NullablePatchDistributionResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePatchDistributionResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_purge_cache_payload.go b/services/cdn/model_purge_cache_payload.go new file mode 100644 index 000000000..9cc56a7ab --- /dev/null +++ b/services/cdn/model_purge_cache_payload.go @@ -0,0 +1,117 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PurgeCachePayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PurgeCachePayload{} + +// PurgeCachePayload struct for PurgeCachePayload +type PurgeCachePayload struct { + // Defines an optional path. If this is set, a granular purge is done. If missing, the entire cache is invalidated. During a granular cache purge, only the provided path is purged. Please do not that for example `/some/path` and `/some/path.txt` are considered different paths. + Path *string `json:"path,omitempty"` +} + +// NewPurgeCachePayload instantiates a new PurgeCachePayload 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 NewPurgeCachePayload() *PurgeCachePayload { + this := PurgeCachePayload{} + return &this +} + +// NewPurgeCachePayloadWithDefaults instantiates a new PurgeCachePayload 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 NewPurgeCachePayloadWithDefaults() *PurgeCachePayload { + this := PurgeCachePayload{} + return &this +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *PurgeCachePayload) GetPath() *string { + if o == nil || IsNil(o.Path) { + var ret *string + return ret + } + return o.Path +} + +// GetPathOk returns a tuple with the Path field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PurgeCachePayload) GetPathOk() (*string, bool) { + if o == nil || IsNil(o.Path) { + return nil, false + } + return o.Path, true +} + +// HasPath returns a boolean if a field has been set. +func (o *PurgeCachePayload) HasPath() bool { + if o != nil && !IsNil(o.Path) { + return true + } + + return false +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *PurgeCachePayload) SetPath(v *string) { + o.Path = v +} + +func (o PurgeCachePayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Path) { + toSerialize["path"] = o.Path + } + return toSerialize, nil +} + +type NullablePurgeCachePayload struct { + value *PurgeCachePayload + isSet bool +} + +func (v NullablePurgeCachePayload) Get() *PurgeCachePayload { + return v.value +} + +func (v *NullablePurgeCachePayload) Set(val *PurgeCachePayload) { + v.value = val + v.isSet = true +} + +func (v NullablePurgeCachePayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePurgeCachePayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePurgeCachePayload(val *PurgeCachePayload) *NullablePurgeCachePayload { + return &NullablePurgeCachePayload{value: val, isSet: true} +} + +func (v NullablePurgeCachePayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePurgeCachePayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_payload.go b/services/cdn/model_put_custom_domain_payload.go new file mode 100644 index 000000000..945c84156 --- /dev/null +++ b/services/cdn/model_put_custom_domain_payload.go @@ -0,0 +1,117 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainPayload type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainPayload{} + +// PutCustomDomainPayload struct for PutCustomDomainPayload +type PutCustomDomainPayload struct { + // While optional, it is greatly encouraged to provide an `intentId`. This is used to deduplicate requests. If multiple modifying Requests with the same `intentId` for a given `projectId` are received, all but the first request are dropped. + IntentId *string `json:"intentId,omitempty"` +} + +// NewPutCustomDomainPayload instantiates a new PutCustomDomainPayload 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 NewPutCustomDomainPayload() *PutCustomDomainPayload { + this := PutCustomDomainPayload{} + return &this +} + +// NewPutCustomDomainPayloadWithDefaults instantiates a new PutCustomDomainPayload 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 NewPutCustomDomainPayloadWithDefaults() *PutCustomDomainPayload { + this := PutCustomDomainPayload{} + return &this +} + +// GetIntentId returns the IntentId field value if set, zero value otherwise. +func (o *PutCustomDomainPayload) GetIntentId() *string { + if o == nil || IsNil(o.IntentId) { + var ret *string + return ret + } + return o.IntentId +} + +// GetIntentIdOk returns a tuple with the IntentId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PutCustomDomainPayload) GetIntentIdOk() (*string, bool) { + if o == nil || IsNil(o.IntentId) { + return nil, false + } + return o.IntentId, true +} + +// HasIntentId returns a boolean if a field has been set. +func (o *PutCustomDomainPayload) HasIntentId() bool { + if o != nil && !IsNil(o.IntentId) { + return true + } + + return false +} + +// SetIntentId gets a reference to the given string and assigns it to the IntentId field. +func (o *PutCustomDomainPayload) SetIntentId(v *string) { + o.IntentId = v +} + +func (o PutCustomDomainPayload) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IntentId) { + toSerialize["intentId"] = o.IntentId + } + return toSerialize, nil +} + +type NullablePutCustomDomainPayload struct { + value *PutCustomDomainPayload + isSet bool +} + +func (v NullablePutCustomDomainPayload) Get() *PutCustomDomainPayload { + return v.value +} + +func (v *NullablePutCustomDomainPayload) Set(val *PutCustomDomainPayload) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainPayload) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainPayload) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainPayload(val *PutCustomDomainPayload) *NullablePutCustomDomainPayload { + return &NullablePutCustomDomainPayload{value: val, isSet: true} +} + +func (v NullablePutCustomDomainPayload) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainPayload) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_put_custom_domain_response.go b/services/cdn/model_put_custom_domain_response.go new file mode 100644 index 000000000..204176782 --- /dev/null +++ b/services/cdn/model_put_custom_domain_response.go @@ -0,0 +1,142 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the PutCustomDomainResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PutCustomDomainResponse{} + +// PutCustomDomainResponse struct for PutCustomDomainResponse +type PutCustomDomainResponse struct { + // REQUIRED + CustomDomain *CustomDomain `json:"customDomain"` + // Deprecated: Check the GitHub changelog for alternatives + // REQUIRED + Domain *string `json:"domain"` +} + +type _PutCustomDomainResponse PutCustomDomainResponse + +// NewPutCustomDomainResponse instantiates a new PutCustomDomainResponse 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 NewPutCustomDomainResponse(customDomain *CustomDomain, domain *string) *PutCustomDomainResponse { + this := PutCustomDomainResponse{} + this.CustomDomain = customDomain + this.Domain = domain + return &this +} + +// NewPutCustomDomainResponseWithDefaults instantiates a new PutCustomDomainResponse 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 NewPutCustomDomainResponseWithDefaults() *PutCustomDomainResponse { + this := PutCustomDomainResponse{} + return &this +} + +// GetCustomDomain returns the CustomDomain field value +func (o *PutCustomDomainResponse) GetCustomDomain() *CustomDomain { + if o == nil || IsNil(o.CustomDomain) { + var ret *CustomDomain + return ret + } + + return o.CustomDomain +} + +// GetCustomDomainOk returns a tuple with the CustomDomain field value +// and a boolean to check if the value has been set. +func (o *PutCustomDomainResponse) GetCustomDomainOk() (*CustomDomain, bool) { + if o == nil { + return nil, false + } + return o.CustomDomain, true +} + +// SetCustomDomain sets field value +func (o *PutCustomDomainResponse) SetCustomDomain(v *CustomDomain) { + o.CustomDomain = v +} + +// GetDomain returns the Domain field value +// Deprecated +func (o *PutCustomDomainResponse) GetDomain() *string { + if o == nil || IsNil(o.Domain) { + var ret *string + return ret + } + + return o.Domain +} + +// GetDomainOk returns a tuple with the Domain field value +// and a boolean to check if the value has been set. +// Deprecated +func (o *PutCustomDomainResponse) GetDomainOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Domain, true +} + +// SetDomain sets field value +// Deprecated +func (o *PutCustomDomainResponse) SetDomain(v *string) { + o.Domain = v +} + +func (o PutCustomDomainResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["customDomain"] = o.CustomDomain + toSerialize["domain"] = o.Domain + return toSerialize, nil +} + +type NullablePutCustomDomainResponse struct { + value *PutCustomDomainResponse + isSet bool +} + +func (v NullablePutCustomDomainResponse) Get() *PutCustomDomainResponse { + return v.value +} + +func (v *NullablePutCustomDomainResponse) Set(val *PutCustomDomainResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePutCustomDomainResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePutCustomDomainResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePutCustomDomainResponse(val *PutCustomDomainResponse) *NullablePutCustomDomainResponse { + return &NullablePutCustomDomainResponse{value: val, isSet: true} +} + +func (v NullablePutCustomDomainResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePutCustomDomainResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_region.go b/services/cdn/model_region.go new file mode 100644 index 000000000..004f9c91c --- /dev/null +++ b/services/cdn/model_region.go @@ -0,0 +1,121 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "fmt" +) + +// Region The following regions exist: - `EU` - Europe - `US` - United States / North America - `AF` - Africa - `SA` - South America - `ASIA` - Asia and Oceania +type Region string + +// List of Region +const ( + REGION_EU Region = "EU" + REGION_US Region = "US" + REGION_AF Region = "AF" + REGION_SA Region = "SA" + REGION_ASIA Region = "ASIA" +) + +// All allowed values of Region enum +var AllowedRegionEnumValues = []Region{ + "EU", + "US", + "AF", + "SA", + "ASIA", +} + +func (v *Region) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue string + if value == zeroValue { + return nil + } + enumTypeValue := Region(value) + for _, existing := range AllowedRegionEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Region", value) +} + +// NewRegionFromValue returns a pointer to a valid Region +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewRegionFromValue(v string) (*Region, error) { + ev := Region(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Region: valid values are %v", v, AllowedRegionEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Region) IsValid() bool { + for _, existing := range AllowedRegionEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to Region value +func (v Region) Ptr() *Region { + return &v +} + +type NullableRegion struct { + value *Region + isSet bool +} + +func (v NullableRegion) Get() *Region { + return v.value +} + +func (v *NullableRegion) Set(val *Region) { + v.value = val + v.isSet = true +} + +func (v NullableRegion) IsSet() bool { + return v.isSet +} + +func (v *NullableRegion) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableRegion(val *Region) *NullableRegion { + return &NullableRegion{value: val, isSet: true} +} + +func (v NullableRegion) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableRegion) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/model_status_error.go b/services/cdn/model_status_error.go new file mode 100644 index 000000000..cb96d63fc --- /dev/null +++ b/services/cdn/model_status_error.go @@ -0,0 +1,177 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" +) + +// checks if the StatusError type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &StatusError{} + +// StatusError struct for StatusError +type StatusError struct { + // A german translation string corresponding to the error key. Note that we do not guarantee german translations are present. + De *string `json:"de,omitempty"` + // An english translation string corresponding to the error key. An english translation key is always present. + // REQUIRED + En *string `json:"en"` + // An enum value that describes a Status Error. + // REQUIRED + Key *string `json:"key"` +} + +type _StatusError StatusError + +// NewStatusError instantiates a new StatusError 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 NewStatusError(en *string, key *string) *StatusError { + this := StatusError{} + this.En = en + this.Key = key + return &this +} + +// NewStatusErrorWithDefaults instantiates a new StatusError 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 NewStatusErrorWithDefaults() *StatusError { + this := StatusError{} + return &this +} + +// GetDe returns the De field value if set, zero value otherwise. +func (o *StatusError) GetDe() *string { + if o == nil || IsNil(o.De) { + var ret *string + return ret + } + return o.De +} + +// GetDeOk returns a tuple with the De field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *StatusError) GetDeOk() (*string, bool) { + if o == nil || IsNil(o.De) { + return nil, false + } + return o.De, true +} + +// HasDe returns a boolean if a field has been set. +func (o *StatusError) HasDe() bool { + if o != nil && !IsNil(o.De) { + return true + } + + return false +} + +// SetDe gets a reference to the given string and assigns it to the De field. +func (o *StatusError) SetDe(v *string) { + o.De = v +} + +// GetEn returns the En field value +func (o *StatusError) GetEn() *string { + if o == nil || IsNil(o.En) { + var ret *string + return ret + } + + return o.En +} + +// GetEnOk returns a tuple with the En field value +// and a boolean to check if the value has been set. +func (o *StatusError) GetEnOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.En, true +} + +// SetEn sets field value +func (o *StatusError) SetEn(v *string) { + o.En = v +} + +// GetKey returns the Key field value +func (o *StatusError) GetKey() *string { + if o == nil || IsNil(o.Key) { + var ret *string + return ret + } + + return o.Key +} + +// GetKeyOk returns a tuple with the Key field value +// and a boolean to check if the value has been set. +func (o *StatusError) GetKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Key, true +} + +// SetKey sets field value +func (o *StatusError) SetKey(v *string) { + o.Key = v +} + +func (o StatusError) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.De) { + toSerialize["de"] = o.De + } + toSerialize["en"] = o.En + toSerialize["key"] = o.Key + return toSerialize, nil +} + +type NullableStatusError struct { + value *StatusError + isSet bool +} + +func (v NullableStatusError) Get() *StatusError { + return v.value +} + +func (v *NullableStatusError) Set(val *StatusError) { + v.value = val + v.isSet = true +} + +func (v NullableStatusError) IsSet() bool { + return v.isSet +} + +func (v *NullableStatusError) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableStatusError(val *StatusError) *NullableStatusError { + return &NullableStatusError{value: val, isSet: true} +} + +func (v NullableStatusError) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableStatusError) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/cdn/utils.go b/services/cdn/utils.go new file mode 100644 index 000000000..7f68e9148 --- /dev/null +++ b/services/cdn/utils.go @@ -0,0 +1,347 @@ +/* +CDN API + +API used to create and manage your CDN distributions. + +API version: 1beta.0.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package cdn + +import ( + "encoding/json" + "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 v.value.MarshalJSON() +} + +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) +} diff --git a/services/iaas/api_default.go b/services/iaas/api_default.go index 49b527a7b..1e05c1643 100644 --- a/services/iaas/api_default.go +++ b/services/iaas/api_default.go @@ -13015,9 +13015,17 @@ type ApiListImagesRequest struct { ctx context.Context apiService *DefaultApiService projectId string + all *bool labelSelector *string } +// List all Images. + +func (r ApiListImagesRequest) All(all bool) ApiListImagesRequest { + r.all = &all + return r +} + // Filter resources by labels. func (r ApiListImagesRequest) LabelSelector(labelSelector string) ApiListImagesRequest { @@ -13051,6 +13059,9 @@ func (r ApiListImagesRequest) Execute() (*ImageListResponse, error) { return localVarReturnValue, fmt.Errorf("projectId must have less than 36 elements") } + if r.all != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "all", r.all, "") + } if r.labelSelector != nil { parameterAddToHeaderOrQuery(localVarQueryParams, "label_selector", r.labelSelector, "") } @@ -15079,6 +15090,172 @@ func (a *APIClient) ListPublicIPsExecute(ctx context.Context, projectId string) return r.Execute() } +type ApiListPublicIpRangesRequest struct { + ctx context.Context + apiService *DefaultApiService +} + +func (r ApiListPublicIpRangesRequest) Execute() (*PublicNetworkListResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *PublicNetworkListResponse + ) + a := r.apiService + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListPublicIpRanges") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v1beta1/networks/public-ip-ranges" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles) + if err != nil { + return localVarReturnValue, err + } + + contextHTTPRequest, ok := r.ctx.Value(config.ContextHTTPRequest).(**http.Request) + if ok { + *contextHTTPRequest = req + } + + localVarHTTPResponse, err := a.client.callAPI(req) + contextHTTPResponse, ok := r.ctx.Value(config.ContextHTTPResponse).(**http.Response) + if ok { + *contextHTTPResponse = localVarHTTPResponse + } + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, err + } + + localVarBody, err := io.ReadAll(localVarHTTPResponse.Body) + localVarHTTPResponse.Body.Close() + localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody)) + if err != nil { + return localVarReturnValue, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 403 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 500 { + var v Error + err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := &oapierror.GenericOpenAPIError{ + StatusCode: localVarHTTPResponse.StatusCode, + Body: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, newErr + } + + return localVarReturnValue, nil +} + +/* +ListPublicIpRanges: List all public IP ranges. + +Get a list of all public IP ranges that STACKIT uses. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiListPublicIpRangesRequest +*/ +func (a *APIClient) ListPublicIpRanges(ctx context.Context) ApiListPublicIpRangesRequest { + return ApiListPublicIpRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } +} + +func (a *APIClient) ListPublicIpRangesExecute(ctx context.Context) (*PublicNetworkListResponse, error) { + r := ApiListPublicIpRangesRequest{ + apiService: a.defaultApi, + ctx: ctx, + } + return r.Execute() +} + type ApiListQuotasRequest struct { ctx context.Context apiService *DefaultApiService diff --git a/services/iaas/api_default_test.go b/services/iaas/api_default_test.go index bc2e57b25..d5d7ab2c2 100644 --- a/services/iaas/api_default_test.go +++ b/services/iaas/api_default_test.go @@ -4222,6 +4222,54 @@ func Test_iaas_DefaultApiService(t *testing.T) { } }) + t.Run("Test DefaultApiService ListPublicIpRanges", func(t *testing.T) { + path := "/v1beta1/networks/public-ip-ranges" + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(path, func(w http.ResponseWriter, req *http.Request) { + data := PublicNetworkListResponse{} + w.Header().Add("Content-Type", "application/json") + json.NewEncoder(w).Encode(data) + }) + testServer := httptest.NewServer(testDefaultApiServeMux) + defer testServer.Close() + + configuration := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Region: "test_region", + Servers: config.ServerConfigurations{ + { + URL: testServer.URL, + Description: "Localhost for iaas_DefaultApi", + Variables: map[string]config.ServerVariable{ + "region": { + DefaultValue: "test_region.", + EnumValues: []string{ + "test_region.", + }, + }, + }, + }, + }, + OperationServers: map[string]config.ServerConfigurations{}, + } + apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication()) + if err != nil { + t.Fatalf("creating API client: %v", err) + } + + resp, reqErr := apiClient.ListPublicIpRanges(context.Background()).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if resp == nil { + t.Fatalf("response not present") + } + }) + t.Run("Test DefaultApiService ListQuotas", func(t *testing.T) { path := "/v1beta1/projects/{projectId}/quotas" projectIdValue := "projectId" diff --git a/services/iaas/model_add_volume_to_server_payload.go b/services/iaas/model_add_volume_to_server_payload.go index 2649cd96e..bc8ca90b7 100644 --- a/services/iaas/model_add_volume_to_server_payload.go +++ b/services/iaas/model_add_volume_to_server_payload.go @@ -33,8 +33,6 @@ type AddVolumeToServerPayload struct { // will change when the set of required properties is changed func NewAddVolumeToServerPayload() *AddVolumeToServerPayload { this := AddVolumeToServerPayload{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } @@ -43,8 +41,6 @@ func NewAddVolumeToServerPayload() *AddVolumeToServerPayload { // but it doesn't guarantee that properties required by API are set func NewAddVolumeToServerPayloadWithDefaults() *AddVolumeToServerPayload { this := AddVolumeToServerPayload{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } diff --git a/services/iaas/model_affinity_group.go b/services/iaas/model_affinity_group.go index bc2ebd1ca..944aef774 100644 --- a/services/iaas/model_affinity_group.go +++ b/services/iaas/model_affinity_group.go @@ -26,7 +26,7 @@ type AffinityGroup struct { // The name for a General Object. Matches Names and also UUIDs. // REQUIRED Name *string `json:"name"` - // The affinity group policy. + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. // REQUIRED Policy *string `json:"policy"` } diff --git a/services/iaas/model_allowed_addresses_inner.go b/services/iaas/model_allowed_addresses_inner.go index e590b6eb5..d46b83031 100644 --- a/services/iaas/model_allowed_addresses_inner.go +++ b/services/iaas/model_allowed_addresses_inner.go @@ -62,7 +62,7 @@ func (src AllowedAddressesInner) MarshalJSON() ([]byte, error) { return json.Marshal(&src.String) } - return nil, nil // no data in oneOf schemas + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object } // Get the actual instance diff --git a/services/iaas/model_backup.go b/services/iaas/model_backup.go index c2f226f3a..ef904a79d 100644 --- a/services/iaas/model_backup.go +++ b/services/iaas/model_backup.go @@ -26,7 +26,7 @@ type Backup struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` @@ -34,7 +34,7 @@ type Backup struct { Size *int64 `json:"size,omitempty"` // Universally Unique Identifier (UUID). SnapshotId *string `json:"snapshotId,omitempty"` - // The status of a backup object. + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_backup_source.go b/services/iaas/model_backup_source.go index bb40f8c40..d6b729009 100644 --- a/services/iaas/model_backup_source.go +++ b/services/iaas/model_backup_source.go @@ -22,7 +22,7 @@ type BackupSource struct { // Universally Unique Identifier (UUID). // REQUIRED Id *string `json:"id"` - // The source types of a backup. + // The source types of a backup. Possible values: `volume`, `snapshot`. // REQUIRED Type *string `json:"type"` } diff --git a/services/iaas/model_boot_volume.go b/services/iaas/model_boot_volume.go index 1fb2b1aae..b883774ee 100644 --- a/services/iaas/model_boot_volume.go +++ b/services/iaas/model_boot_volume.go @@ -36,8 +36,6 @@ type BootVolume struct { // will change when the set of required properties is changed func NewBootVolume() *BootVolume { this := BootVolume{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } @@ -46,8 +44,6 @@ func NewBootVolume() *BootVolume { // but it doesn't guarantee that properties required by API are set func NewBootVolumeWithDefaults() *BootVolume { this := BootVolume{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } diff --git a/services/iaas/model_boot_volume_source.go b/services/iaas/model_boot_volume_source.go index 0b6dbe85a..a05088ee4 100644 --- a/services/iaas/model_boot_volume_source.go +++ b/services/iaas/model_boot_volume_source.go @@ -22,7 +22,7 @@ type BootVolumeSource struct { // Universally Unique Identifier (UUID). // REQUIRED Id *string `json:"id"` - // The source types of a boot volume. + // The source types of a boot volume. Possible values: `image`, `volume`. // REQUIRED Type *string `json:"type"` } diff --git a/services/iaas/model_create_affinity_group_payload.go b/services/iaas/model_create_affinity_group_payload.go index 1f9d11329..b51a05fd6 100644 --- a/services/iaas/model_create_affinity_group_payload.go +++ b/services/iaas/model_create_affinity_group_payload.go @@ -26,7 +26,7 @@ type CreateAffinityGroupPayload struct { // The name for a General Object. Matches Names and also UUIDs. // REQUIRED Name *string `json:"name"` - // The affinity group policy. + // The affinity group policy. `hard-affinity`: All servers in this group will be hosted on the same compute node. `soft-affinity`: All servers in this group will be hosted on as few compute nodes as possible. `hard-anti-affinity`: All servers in this group will be hosted on different compute nodes. `soft-anti-affinity`: All servers in this group will be hosted on as many compute nodes as possible. Possible values: `hard-anti-affinity`, `hard-affinity`, `soft-anti-affinity`, `soft-affinity`. // REQUIRED Policy *string `json:"policy"` } diff --git a/services/iaas/model_create_backup_payload.go b/services/iaas/model_create_backup_payload.go index d195676d5..b3b401bce 100644 --- a/services/iaas/model_create_backup_payload.go +++ b/services/iaas/model_create_backup_payload.go @@ -19,7 +19,7 @@ var _ MappedNullable = &CreateBackupPayload{} // CreateBackupPayload Object that represents a backup create request body. type CreateBackupPayload struct { - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_create_image_payload.go b/services/iaas/model_create_image_payload.go index 118ab95c2..f2eae6970 100644 --- a/services/iaas/model_create_image_payload.go +++ b/services/iaas/model_create_image_payload.go @@ -24,12 +24,12 @@ type CreateImagePayload struct { Config *ImageConfig `json:"config,omitempty"` // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` - // Object that represents a disk format. + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. // REQUIRED DiskFormat *string `json:"diskFormat"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Size in Gigabyte. MinDiskSize *int64 `json:"minDiskSize,omitempty"` @@ -41,9 +41,11 @@ type CreateImagePayload struct { // Universally Unique Identifier (UUID). Owner *string `json:"owner,omitempty"` Protected *bool `json:"protected,omitempty"` - // Scope of an Image. + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. Scope *string `json:"scope,omitempty"` - // The status of an image object. + // Size in bytes. + Size *int64 `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` @@ -438,6 +440,38 @@ func (o *CreateImagePayload) SetScope(v *string) { o.Scope = v } +// GetSize returns the Size field value if set, zero value otherwise. +func (o *CreateImagePayload) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *CreateImagePayload) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *CreateImagePayload) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *CreateImagePayload) SetSize(v *int64) { + o.Size = v +} + // GetStatus returns the Status field value if set, zero value otherwise. func (o *CreateImagePayload) GetStatus() *string { if o == nil || IsNil(o.Status) { @@ -536,6 +570,9 @@ func (o CreateImagePayload) ToMap() (map[string]interface{}, error) { if !IsNil(o.Scope) { toSerialize["scope"] = o.Scope } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } if !IsNil(o.Status) { toSerialize["status"] = o.Status } diff --git a/services/iaas/model_create_key_pair_payload.go b/services/iaas/model_create_key_pair_payload.go index 7375ba887..48c27576f 100644 --- a/services/iaas/model_create_key_pair_payload.go +++ b/services/iaas/model_create_key_pair_payload.go @@ -24,7 +24,7 @@ type CreateKeyPairPayload struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Object that represents an SSH keypair MD5 fingerprint. Fingerprint *string `json:"fingerprint,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_create_network_area_payload.go b/services/iaas/model_create_network_area_payload.go index 6b09cfc23..bcf2d0cd4 100644 --- a/services/iaas/model_create_network_area_payload.go +++ b/services/iaas/model_create_network_area_payload.go @@ -21,7 +21,7 @@ var _ MappedNullable = &CreateNetworkAreaPayload{} type CreateNetworkAreaPayload struct { // REQUIRED AddressFamily *CreateAreaAddressFamily `json:"addressFamily"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED diff --git a/services/iaas/model_create_network_payload.go b/services/iaas/model_create_network_payload.go index 3681ff3a8..e79a1cd68 100644 --- a/services/iaas/model_create_network_payload.go +++ b/services/iaas/model_create_network_payload.go @@ -20,7 +20,7 @@ var _ MappedNullable = &CreateNetworkPayload{} // CreateNetworkPayload Object that represents the request body for a network create. type CreateNetworkPayload struct { AddressFamily *CreateNetworkAddressFamily `json:"addressFamily,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED diff --git a/services/iaas/model_create_nic_payload.go b/services/iaas/model_create_nic_payload.go index f1a67dc98..54916f4e6 100644 --- a/services/iaas/model_create_nic_payload.go +++ b/services/iaas/model_create_nic_payload.go @@ -29,7 +29,7 @@ type CreateNicPayload struct { Ipv4 *string `json:"ipv4,omitempty"` // Object that represents an IPv6 address. Ipv6 *string `json:"ipv6,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Object that represents an MAC address. Mac *string `json:"mac,omitempty"` diff --git a/services/iaas/model_create_protocol.go b/services/iaas/model_create_protocol.go index 4b0f5b47f..4683d54ab 100644 --- a/services/iaas/model_create_protocol.go +++ b/services/iaas/model_create_protocol.go @@ -88,7 +88,7 @@ func (src CreateProtocol) MarshalJSON() ([]byte, error) { return json.Marshal(&src.String) } - return nil, nil // no data in oneOf schemas + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object } // Get the actual instance diff --git a/services/iaas/model_create_public_ip_payload.go b/services/iaas/model_create_public_ip_payload.go index be131c151..132f20122 100644 --- a/services/iaas/model_create_public_ip_payload.go +++ b/services/iaas/model_create_public_ip_payload.go @@ -23,7 +23,7 @@ type CreatePublicIPPayload struct { Id *string `json:"id,omitempty"` // Object that represents an IP address. Ip *string `json:"ip,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Universally Unique Identifier (UUID). NetworkInterface *NullableString `json:"networkInterface,omitempty"` diff --git a/services/iaas/model_create_security_group_payload.go b/services/iaas/model_create_security_group_payload.go index 6f6acba9b..ff3ffb293 100644 --- a/services/iaas/model_create_security_group_payload.go +++ b/services/iaas/model_create_security_group_payload.go @@ -26,7 +26,7 @@ type CreateSecurityGroupPayload struct { Description *string `json:"description,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED diff --git a/services/iaas/model_create_server_payload.go b/services/iaas/model_create_server_payload.go index 5bed30b12..b711f12cd 100644 --- a/services/iaas/model_create_server_payload.go +++ b/services/iaas/model_create_server_payload.go @@ -33,9 +33,9 @@ type CreateServerPayload struct { Id *string `json:"id,omitempty"` // Universally Unique Identifier (UUID). ImageId *string `json:"imageId,omitempty"` - // The name for a General Object. Matches Names and also UUIDs. + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. KeypairName *string `json:"keypairName,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Date-time when resource was launched. LaunchedAt *time.Time `json:"launchedAt,omitempty"` @@ -49,13 +49,13 @@ type CreateServerPayload struct { Networking *CreateServerPayloadNetworking `json:"networking,omitempty"` // A list of networks attached to a server. Nics *[]ServerNetwork `json:"nics,omitempty"` - // The power status of a server. + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. PowerStatus *string `json:"powerStatus,omitempty"` // A list of General Objects. SecurityGroups *[]string `json:"securityGroups,omitempty"` // A list of service account mails. ServiceAccountMails *[]string `json:"serviceAccountMails,omitempty"` - // The status of a server object. + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_create_server_payload_boot_volume.go b/services/iaas/model_create_server_payload_boot_volume.go index 26184c318..ace4dceb1 100644 --- a/services/iaas/model_create_server_payload_boot_volume.go +++ b/services/iaas/model_create_server_payload_boot_volume.go @@ -36,8 +36,6 @@ type CreateServerPayloadBootVolume struct { // will change when the set of required properties is changed func NewCreateServerPayloadBootVolume() *CreateServerPayloadBootVolume { this := CreateServerPayloadBootVolume{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } @@ -46,8 +44,6 @@ func NewCreateServerPayloadBootVolume() *CreateServerPayloadBootVolume { // but it doesn't guarantee that properties required by API are set func NewCreateServerPayloadBootVolumeWithDefaults() *CreateServerPayloadBootVolume { this := CreateServerPayloadBootVolume{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } diff --git a/services/iaas/model_create_server_payload_networking.go b/services/iaas/model_create_server_payload_networking.go index 8bebe2e97..965fe1224 100644 --- a/services/iaas/model_create_server_payload_networking.go +++ b/services/iaas/model_create_server_payload_networking.go @@ -88,7 +88,7 @@ func (src CreateServerPayloadNetworking) MarshalJSON() ([]byte, error) { return json.Marshal(&src.CreateServerNetworkingWithNics) } - return nil, nil // no data in oneOf schemas + return []byte("{}"), nil // no data in oneOf schemas => empty JSON object } // Get the actual instance diff --git a/services/iaas/model_create_snapshot_payload.go b/services/iaas/model_create_snapshot_payload.go index 8ceeae256..f361f0340 100644 --- a/services/iaas/model_create_snapshot_payload.go +++ b/services/iaas/model_create_snapshot_payload.go @@ -24,13 +24,13 @@ type CreateSnapshotPayload struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` // Size in Gigabyte. Size *int64 `json:"size,omitempty"` - // The status of a snapshot object. + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_create_volume_payload.go b/services/iaas/model_create_volume_payload.go index 10f332e8e..6c8238c21 100644 --- a/services/iaas/model_create_volume_payload.go +++ b/services/iaas/model_create_volume_payload.go @@ -32,7 +32,7 @@ type CreateVolumePayload struct { // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` ImageConfig *ImageConfig `json:"imageConfig,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` @@ -43,7 +43,7 @@ type CreateVolumePayload struct { // Size in Gigabyte. Size *int64 `json:"size,omitempty"` Source *VolumeSource `json:"source,omitempty"` - // The status of a volume object. + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_image.go b/services/iaas/model_image.go index 6d1bf2236..09a171728 100644 --- a/services/iaas/model_image.go +++ b/services/iaas/model_image.go @@ -24,12 +24,12 @@ type Image struct { Config *ImageConfig `json:"config,omitempty"` // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` - // Object that represents a disk format. + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. // REQUIRED DiskFormat *string `json:"diskFormat"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Size in Gigabyte. MinDiskSize *int64 `json:"minDiskSize,omitempty"` @@ -41,9 +41,11 @@ type Image struct { // Universally Unique Identifier (UUID). Owner *string `json:"owner,omitempty"` Protected *bool `json:"protected,omitempty"` - // Scope of an Image. + // Scope of an Image. Possible values: `public`, `local`, `projects`, `organization`. Scope *string `json:"scope,omitempty"` - // The status of an image object. + // Size in bytes. + Size *int64 `json:"size,omitempty"` + // The status of an image object. Possible values: `AVAILABLE`, `CREATING`, `DEACTIVATED`, `DELETED`, `DELETING`, `ERROR`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` @@ -438,6 +440,38 @@ func (o *Image) SetScope(v *string) { o.Scope = v } +// GetSize returns the Size field value if set, zero value otherwise. +func (o *Image) GetSize() *int64 { + if o == nil || IsNil(o.Size) { + var ret *int64 + return ret + } + return o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Image) GetSizeOk() (*int64, bool) { + if o == nil || IsNil(o.Size) { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *Image) HasSize() bool { + if o != nil && !IsNil(o.Size) { + return true + } + + return false +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *Image) SetSize(v *int64) { + o.Size = v +} + // GetStatus returns the Status field value if set, zero value otherwise. func (o *Image) GetStatus() *string { if o == nil || IsNil(o.Status) { @@ -536,6 +570,9 @@ func (o Image) ToMap() (map[string]interface{}, error) { if !IsNil(o.Scope) { toSerialize["scope"] = o.Scope } + if !IsNil(o.Size) { + toSerialize["size"] = o.Size + } if !IsNil(o.Status) { toSerialize["status"] = o.Status } diff --git a/services/iaas/model_image_config.go b/services/iaas/model_image_config.go index 484c0eb84..78a974393 100644 --- a/services/iaas/model_image_config.go +++ b/services/iaas/model_image_config.go @@ -19,7 +19,9 @@ var _ MappedNullable = &ImageConfig{} // ImageConfig Properties to set hardware and scheduling settings for an Image. type ImageConfig struct { - // Enables the BIOS bootmenu. + // Represents CPU architecture. The default for new images is x86. + Architecture *string `json:"architecture,omitempty"` + // Enables the BIOS bootmenu. The default for new images is disabled. BootMenu *bool `json:"bootMenu,omitempty"` // Sets CDROM bus controller type. CdromBus *NullableString `json:"cdromBus,omitempty"` @@ -37,13 +39,13 @@ type ImageConfig struct { RescueBus *NullableString `json:"rescueBus,omitempty"` // Sets the device when the image is used as a rescue image. RescueDevice *NullableString `json:"rescueDevice,omitempty"` - // Enables Secure Boot. + // Enables Secure Boot. The default for new images is disabled. SecureBoot *bool `json:"secureBoot,omitempty"` - // Enables UEFI boot. + // Configure UEFI boot. The default for new images is enabled. Uefi *bool `json:"uefi,omitempty"` // Sets Graphic device model. VideoModel *NullableString `json:"videoModel,omitempty"` - // Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block. + // Enables the use of VirtIO SCSI to provide block device access. By default servers use VirtIO Block. VirtioScsi *bool `json:"virtioScsi,omitempty"` } @@ -53,14 +55,6 @@ type ImageConfig struct { // will change when the set of required properties is changed func NewImageConfig() *ImageConfig { this := ImageConfig{} - var bootMenu bool = false - this.BootMenu = &bootMenu - var secureBoot bool = false - this.SecureBoot = &secureBoot - var uefi bool = false - this.Uefi = &uefi - var virtioScsi bool = false - this.VirtioScsi = &virtioScsi return &this } @@ -69,17 +63,41 @@ func NewImageConfig() *ImageConfig { // but it doesn't guarantee that properties required by API are set func NewImageConfigWithDefaults() *ImageConfig { this := ImageConfig{} - var bootMenu bool = false - this.BootMenu = &bootMenu - var secureBoot bool = false - this.SecureBoot = &secureBoot - var uefi bool = false - this.Uefi = &uefi - var virtioScsi bool = false - this.VirtioScsi = &virtioScsi return &this } +// GetArchitecture returns the Architecture field value if set, zero value otherwise. +func (o *ImageConfig) GetArchitecture() *string { + if o == nil || IsNil(o.Architecture) { + var ret *string + return ret + } + return o.Architecture +} + +// GetArchitectureOk returns a tuple with the Architecture field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ImageConfig) GetArchitectureOk() (*string, bool) { + if o == nil || IsNil(o.Architecture) { + return nil, false + } + return o.Architecture, true +} + +// HasArchitecture returns a boolean if a field has been set. +func (o *ImageConfig) HasArchitecture() bool { + if o != nil && !IsNil(o.Architecture) { + return true + } + + return false +} + +// SetArchitecture gets a reference to the given string and assigns it to the Architecture field. +func (o *ImageConfig) SetArchitecture(v *string) { + o.Architecture = v +} + // GetBootMenu returns the BootMenu field value if set, zero value otherwise. func (o *ImageConfig) GetBootMenu() *bool { if o == nil || IsNil(o.BootMenu) { @@ -658,6 +676,9 @@ func (o *ImageConfig) SetVirtioScsi(v *bool) { func (o ImageConfig) ToMap() (map[string]interface{}, error) { toSerialize := map[string]interface{}{} + if !IsNil(o.Architecture) { + toSerialize["architecture"] = o.Architecture + } if !IsNil(o.BootMenu) { toSerialize["bootMenu"] = o.BootMenu } diff --git a/services/iaas/model_keypair.go b/services/iaas/model_keypair.go index 282ef75df..4deffa6d7 100644 --- a/services/iaas/model_keypair.go +++ b/services/iaas/model_keypair.go @@ -24,7 +24,7 @@ type Keypair struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Object that represents an SSH keypair MD5 fingerprint. Fingerprint *string `json:"fingerprint,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_network.go b/services/iaas/model_network.go index e555379ea..e14f60faf 100644 --- a/services/iaas/model_network.go +++ b/services/iaas/model_network.go @@ -26,7 +26,7 @@ type Network struct { Gateway *NullableString `json:"gateway,omitempty"` // The gateway of a network. If not specified the first IP of the network will be assigned as the gateway. If 'null' is sent, then the network doesn't have a gateway. Gatewayv6 *NullableString `json:"gatewayv6,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // REQUIRED Name *string `json:"name"` @@ -43,7 +43,7 @@ type Network struct { PublicIp *string `json:"publicIp,omitempty"` // Shows if the network is routed and therefore accessible from other networks. Routed *bool `json:"routed,omitempty"` - // The state of a resource object. + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. // REQUIRED State *string `json:"state"` // Date-time when resource was last updated. diff --git a/services/iaas/model_network_area.go b/services/iaas/model_network_area.go index aab900b25..143638e62 100644 --- a/services/iaas/model_network_area.go +++ b/services/iaas/model_network_area.go @@ -26,14 +26,14 @@ type NetworkArea struct { // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` Ipv4 *NetworkAreaIPv4 `json:"ipv4,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // REQUIRED Name *string `json:"name"` // The amount of projects currently referencing a specific area. // REQUIRED ProjectCount *int64 `json:"projectCount"` - // The state of a resource object. + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. // REQUIRED State *string `json:"state"` // Date-time when resource was last updated. diff --git a/services/iaas/model_nic.go b/services/iaas/model_nic.go index 6587354dc..ecff3921c 100644 --- a/services/iaas/model_nic.go +++ b/services/iaas/model_nic.go @@ -29,7 +29,7 @@ type NIC struct { Ipv4 *string `json:"ipv4,omitempty"` // Object that represents an IPv6 address. Ipv6 *string `json:"ipv6,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Object that represents an MAC address. Mac *string `json:"mac,omitempty"` diff --git a/services/iaas/model_partial_update_network_area_payload.go b/services/iaas/model_partial_update_network_area_payload.go index 4db59e096..f3e8781ce 100644 --- a/services/iaas/model_partial_update_network_area_payload.go +++ b/services/iaas/model_partial_update_network_area_payload.go @@ -20,7 +20,7 @@ var _ MappedNullable = &PartialUpdateNetworkAreaPayload{} // PartialUpdateNetworkAreaPayload struct for PartialUpdateNetworkAreaPayload type PartialUpdateNetworkAreaPayload struct { AddressFamily *UpdateAreaAddressFamily `json:"addressFamily,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_partial_update_network_payload.go b/services/iaas/model_partial_update_network_payload.go index b178b3094..43fe96d49 100644 --- a/services/iaas/model_partial_update_network_payload.go +++ b/services/iaas/model_partial_update_network_payload.go @@ -20,7 +20,7 @@ var _ MappedNullable = &PartialUpdateNetworkPayload{} // PartialUpdateNetworkPayload Object that represents the request body for a network update. type PartialUpdateNetworkPayload struct { AddressFamily *UpdateNetworkAddressFamily `json:"addressFamily,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_protocol.go b/services/iaas/model_protocol.go index 6451227a8..19785adf8 100644 --- a/services/iaas/model_protocol.go +++ b/services/iaas/model_protocol.go @@ -19,7 +19,7 @@ var _ MappedNullable = &Protocol{} // Protocol The schema for a protocol of a security group rule. type Protocol struct { - // The protocol name which the rule should match. + // The protocol name which the rule should match. Possible values: `ah`, `dccp`, `egp`, `esp`, `gre`, `icmp`, `igmp`, `ipip`, `ipv6-encap`, `ipv6-frag`, `ipv6-icmp`, `ipv6-nonxt`, `ipv6-opts`, `ipv6-route`, `ospf`, `pgm`, `rsvp`, `sctp`, `tcp`, `udp`, `udplite`, `vrrp`. Name *string `json:"name,omitempty"` // The protocol number which the rule should match. Number *int64 `json:"number,omitempty"` diff --git a/services/iaas/model_public_ip.go b/services/iaas/model_public_ip.go index 8726f908c..bf715f0e1 100644 --- a/services/iaas/model_public_ip.go +++ b/services/iaas/model_public_ip.go @@ -23,7 +23,7 @@ type PublicIp struct { Id *string `json:"id,omitempty"` // Object that represents an IP address. Ip *string `json:"ip,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Universally Unique Identifier (UUID). NetworkInterface *NullableString `json:"networkInterface,omitempty"` diff --git a/services/iaas/model_public_network.go b/services/iaas/model_public_network.go new file mode 100644 index 000000000..8f90f2470 --- /dev/null +++ b/services/iaas/model_public_network.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicNetwork type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetwork{} + +// PublicNetwork Public network. +type PublicNetwork struct { + // Classless Inter-Domain Routing (CIDR). + // REQUIRED + Cidr *string `json:"cidr"` +} + +type _PublicNetwork PublicNetwork + +// NewPublicNetwork instantiates a new PublicNetwork 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 NewPublicNetwork(cidr *string) *PublicNetwork { + this := PublicNetwork{} + this.Cidr = cidr + return &this +} + +// NewPublicNetworkWithDefaults instantiates a new PublicNetwork 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 NewPublicNetworkWithDefaults() *PublicNetwork { + this := PublicNetwork{} + return &this +} + +// GetCidr returns the Cidr field value +func (o *PublicNetwork) GetCidr() *string { + if o == nil || IsNil(o.Cidr) { + var ret *string + return ret + } + + return o.Cidr +} + +// GetCidrOk returns a tuple with the Cidr field value +// and a boolean to check if the value has been set. +func (o *PublicNetwork) GetCidrOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Cidr, true +} + +// SetCidr sets field value +func (o *PublicNetwork) SetCidr(v *string) { + o.Cidr = v +} + +func (o PublicNetwork) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cidr"] = o.Cidr + return toSerialize, nil +} + +type NullablePublicNetwork struct { + value *PublicNetwork + isSet bool +} + +func (v NullablePublicNetwork) Get() *PublicNetwork { + return v.value +} + +func (v *NullablePublicNetwork) Set(val *PublicNetwork) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetwork) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetwork) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetwork(val *PublicNetwork) *NullablePublicNetwork { + return &NullablePublicNetwork{value: val, isSet: true} +} + +func (v NullablePublicNetwork) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetwork) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_public_network_list_response.go b/services/iaas/model_public_network_list_response.go new file mode 100644 index 000000000..824189115 --- /dev/null +++ b/services/iaas/model_public_network_list_response.go @@ -0,0 +1,111 @@ +/* +IaaS-API + +This API allows you to create and modify IaaS resources. + +API version: 1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package iaas + +import ( + "encoding/json" +) + +// checks if the PublicNetworkListResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicNetworkListResponse{} + +// PublicNetworkListResponse Public network list response. +type PublicNetworkListResponse struct { + // A list of public networks. + // REQUIRED + Items *[]PublicNetwork `json:"items"` +} + +type _PublicNetworkListResponse PublicNetworkListResponse + +// NewPublicNetworkListResponse instantiates a new PublicNetworkListResponse 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 NewPublicNetworkListResponse(items *[]PublicNetwork) *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + this.Items = items + return &this +} + +// NewPublicNetworkListResponseWithDefaults instantiates a new PublicNetworkListResponse 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 NewPublicNetworkListResponseWithDefaults() *PublicNetworkListResponse { + this := PublicNetworkListResponse{} + return &this +} + +// GetItems returns the Items field value +func (o *PublicNetworkListResponse) GetItems() *[]PublicNetwork { + if o == nil || IsNil(o.Items) { + var ret *[]PublicNetwork + return ret + } + + return o.Items +} + +// GetItemsOk returns a tuple with the Items field value +// and a boolean to check if the value has been set. +func (o *PublicNetworkListResponse) GetItemsOk() (*[]PublicNetwork, bool) { + if o == nil { + return nil, false + } + return o.Items, true +} + +// SetItems sets field value +func (o *PublicNetworkListResponse) SetItems(v *[]PublicNetwork) { + o.Items = v +} + +func (o PublicNetworkListResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["items"] = o.Items + return toSerialize, nil +} + +type NullablePublicNetworkListResponse struct { + value *PublicNetworkListResponse + isSet bool +} + +func (v NullablePublicNetworkListResponse) Get() *PublicNetworkListResponse { + return v.value +} + +func (v *NullablePublicNetworkListResponse) Set(val *PublicNetworkListResponse) { + v.value = val + v.isSet = true +} + +func (v NullablePublicNetworkListResponse) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicNetworkListResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicNetworkListResponse(val *PublicNetworkListResponse) *NullablePublicNetworkListResponse { + return &NullablePublicNetworkListResponse{value: val, isSet: true} +} + +func (v NullablePublicNetworkListResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicNetworkListResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/iaas/model_request.go b/services/iaas/model_request.go index c44be6818..842ce74ca 100644 --- a/services/iaas/model_request.go +++ b/services/iaas/model_request.go @@ -20,18 +20,18 @@ var _ MappedNullable = &Request{} // Request Object that represents a request. type Request struct { Details *string `json:"details,omitempty"` - // Object that represents a resource action. + // Object that represents a resource action. Possible values: `CREATE`, `DELETE`, `UPDATE`. // REQUIRED RequestAction *string `json:"requestAction"` // Identifier (ID) representing a single API request. // REQUIRED RequestId *string `json:"requestId"` - // Object that represents a resource type. + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. // REQUIRED RequestType *string `json:"requestType"` // REQUIRED Resources *[]RequestResource `json:"resources"` - // The state of a resource object. + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. // REQUIRED Status *string `json:"status"` } diff --git a/services/iaas/model_request_resource.go b/services/iaas/model_request_resource.go index 5d7184719..dec67bad3 100644 --- a/services/iaas/model_request_resource.go +++ b/services/iaas/model_request_resource.go @@ -22,10 +22,10 @@ type RequestResource struct { // Universally Unique Identifier (UUID). // REQUIRED Id *string `json:"id"` - // The state of a resource object. + // The state of a resource object. Possible values: `CREATING`, `CREATED`, `DELETING`, `DELETED`, `FAILED`, `UPDATED`, `UPDATING`. // REQUIRED Status *string `json:"status"` - // Object that represents a resource type. + // Object that represents a resource type. Possible values: `BACKUP`, `IMAGE`, `NETWORK`, `NETWORKAREA`, `NIC`, `PROJECT`, `ROUTE`, `SERVER`, `SERVICEACCOUNT`, `SNAPSHOT`, `VIRTUALIP`, `VOLUME`. // REQUIRED Type *string `json:"type"` } diff --git a/services/iaas/model_route.go b/services/iaas/model_route.go index 2cc01ae33..5fac5152c 100644 --- a/services/iaas/model_route.go +++ b/services/iaas/model_route.go @@ -22,7 +22,7 @@ var _ MappedNullable = &Route{} type Route struct { // Date-time when resource was created. CreatedAt *time.Time `json:"createdAt,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Object that represents an IP address. // REQUIRED diff --git a/services/iaas/model_security_group.go b/services/iaas/model_security_group.go index 7a2f4e303..92db9f2ee 100644 --- a/services/iaas/model_security_group.go +++ b/services/iaas/model_security_group.go @@ -26,7 +26,7 @@ type SecurityGroup struct { Description *string `json:"description,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED diff --git a/services/iaas/model_server.go b/services/iaas/model_server.go index 3176a6587..a8ea807d9 100644 --- a/services/iaas/model_server.go +++ b/services/iaas/model_server.go @@ -33,9 +33,9 @@ type Server struct { Id *string `json:"id,omitempty"` // Universally Unique Identifier (UUID). ImageId *string `json:"imageId,omitempty"` - // The name for a General Object. Matches Names and also UUIDs. + // The name of an SSH keypair. Allowed characters are letters [a-zA-Z], digits [0-9] and the following special characters: [@._-]. KeypairName *string `json:"keypairName,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Date-time when resource was launched. LaunchedAt *time.Time `json:"launchedAt,omitempty"` @@ -49,13 +49,13 @@ type Server struct { Networking *CreateServerPayloadNetworking `json:"networking,omitempty"` // A list of networks attached to a server. Nics *[]ServerNetwork `json:"nics,omitempty"` - // The power status of a server. + // The power status of a server. Possible values: `CRASHED`, `ERROR`, `RUNNING`, `STOPPED`. PowerStatus *string `json:"powerStatus,omitempty"` // A list of General Objects. SecurityGroups *[]string `json:"securityGroups,omitempty"` // A list of service account mails. ServiceAccountMails *[]string `json:"serviceAccountMails,omitempty"` - // The status of a server object. + // The status of a server object. Possible values: `ACTIVE`, `BACKING-UP`, `CREATING`, `DEALLOCATED`, `DEALLOCATING`, `DELETED`, `DELETING`, `ERROR`, `INACTIVE`, `MIGRATING`, `REBOOT`, `REBOOTING`, `REBUILD`, `REBUILDING`, `RESCUE`, `RESCUING`, `RESIZING`, `RESTORING`, `SNAPSHOTTING`, `STARTING`, `STOPPING`, `UNRESCUING`, `UPDATING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_server_network.go b/services/iaas/model_server_network.go index 2cd5a8e6e..dffc21658 100644 --- a/services/iaas/model_server_network.go +++ b/services/iaas/model_server_network.go @@ -67,8 +67,6 @@ func NewServerNetwork(mac *string, networkId *string, networkName *string, nicId // but it doesn't guarantee that properties required by API are set func NewServerNetworkWithDefaults() *ServerNetwork { this := ServerNetwork{} - var nicSecurity bool = true - this.NicSecurity = &nicSecurity return &this } diff --git a/services/iaas/model_snapshot.go b/services/iaas/model_snapshot.go index a0313ea21..9935d7e09 100644 --- a/services/iaas/model_snapshot.go +++ b/services/iaas/model_snapshot.go @@ -24,13 +24,13 @@ type Snapshot struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` // Size in Gigabyte. Size *int64 `json:"size,omitempty"` - // The status of a snapshot object. + // The status of a snapshot object. Possible values: `AVAILABLE`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`, `UNMANAGING`, `UPDATING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_update_attached_volume_payload.go b/services/iaas/model_update_attached_volume_payload.go index 921410df5..1357e3324 100644 --- a/services/iaas/model_update_attached_volume_payload.go +++ b/services/iaas/model_update_attached_volume_payload.go @@ -33,8 +33,6 @@ type UpdateAttachedVolumePayload struct { // will change when the set of required properties is changed func NewUpdateAttachedVolumePayload() *UpdateAttachedVolumePayload { this := UpdateAttachedVolumePayload{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } @@ -43,8 +41,6 @@ func NewUpdateAttachedVolumePayload() *UpdateAttachedVolumePayload { // but it doesn't guarantee that properties required by API are set func NewUpdateAttachedVolumePayloadWithDefaults() *UpdateAttachedVolumePayload { this := UpdateAttachedVolumePayload{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } diff --git a/services/iaas/model_update_backup_payload.go b/services/iaas/model_update_backup_payload.go index 7a06b479c..41bd159de 100644 --- a/services/iaas/model_update_backup_payload.go +++ b/services/iaas/model_update_backup_payload.go @@ -26,7 +26,7 @@ type UpdateBackupPayload struct { CreatedAt *time.Time `json:"createdAt,omitempty"` // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` @@ -34,7 +34,7 @@ type UpdateBackupPayload struct { Size *int64 `json:"size,omitempty"` // Universally Unique Identifier (UUID). SnapshotId *string `json:"snapshotId,omitempty"` - // The status of a backup object. + // The status of a backup object. Possible values: `AVAILABLE`, `CREATING`, `DELETED`, `DELETING`, `ERROR`, `RESTORING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_update_image_payload.go b/services/iaas/model_update_image_payload.go index 7c8ca3f21..5e622ae6a 100644 --- a/services/iaas/model_update_image_payload.go +++ b/services/iaas/model_update_image_payload.go @@ -20,9 +20,9 @@ var _ MappedNullable = &UpdateImagePayload{} // UpdateImagePayload Object that represents an update request body of an Image. type UpdateImagePayload struct { Config *ImageConfig `json:"config,omitempty"` - // Object that represents a disk format. + // Object that represents a disk format. Possible values: `raw`, `qcow2`, `iso`. DiskFormat *string `json:"diskFormat,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Size in Gigabyte. MinDiskSize *int64 `json:"minDiskSize,omitempty"` diff --git a/services/iaas/model_update_key_pair_payload.go b/services/iaas/model_update_key_pair_payload.go index aae8ed115..0d7ecb4a5 100644 --- a/services/iaas/model_update_key_pair_payload.go +++ b/services/iaas/model_update_key_pair_payload.go @@ -19,7 +19,7 @@ var _ MappedNullable = &UpdateKeyPairPayload{} // UpdateKeyPairPayload Object that represents an update request body of a public key of an SSH keypair. type UpdateKeyPairPayload struct { - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` } diff --git a/services/iaas/model_update_network_area_route_payload.go b/services/iaas/model_update_network_area_route_payload.go index 250055374..1655dff76 100644 --- a/services/iaas/model_update_network_area_route_payload.go +++ b/services/iaas/model_update_network_area_route_payload.go @@ -19,7 +19,7 @@ var _ MappedNullable = &UpdateNetworkAreaRoutePayload{} // UpdateNetworkAreaRoutePayload Object that represents the request body for a route update. type UpdateNetworkAreaRoutePayload struct { - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` } diff --git a/services/iaas/model_update_nic_payload.go b/services/iaas/model_update_nic_payload.go index 434714db8..103b72a62 100644 --- a/services/iaas/model_update_nic_payload.go +++ b/services/iaas/model_update_nic_payload.go @@ -21,7 +21,7 @@ var _ MappedNullable = &UpdateNicPayload{} type UpdateNicPayload struct { // A list of IPs or CIDR notations. AllowedAddresses *[]AllowedAddressesInner `json:"allowedAddresses,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_update_public_ip_payload.go b/services/iaas/model_update_public_ip_payload.go index 6263b7293..9ebe3c40f 100644 --- a/services/iaas/model_update_public_ip_payload.go +++ b/services/iaas/model_update_public_ip_payload.go @@ -23,7 +23,7 @@ type UpdatePublicIPPayload struct { Id *string `json:"id,omitempty"` // Object that represents an IP address. Ip *string `json:"ip,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // Universally Unique Identifier (UUID). NetworkInterface *NullableString `json:"networkInterface,omitempty"` diff --git a/services/iaas/model_update_security_group_payload.go b/services/iaas/model_update_security_group_payload.go index 5d6d7a9e3..5c227458e 100644 --- a/services/iaas/model_update_security_group_payload.go +++ b/services/iaas/model_update_security_group_payload.go @@ -21,7 +21,7 @@ var _ MappedNullable = &UpdateSecurityGroupPayload{} type UpdateSecurityGroupPayload struct { // Description Object. Allows string up to 127 Characters. Description *string `json:"description,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_update_server_payload.go b/services/iaas/model_update_server_payload.go index cb1f51958..0ebb041b5 100644 --- a/services/iaas/model_update_server_payload.go +++ b/services/iaas/model_update_server_payload.go @@ -19,9 +19,9 @@ var _ MappedNullable = &UpdateServerPayload{} // UpdateServerPayload Object that represents an update request body of a server. type UpdateServerPayload struct { - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` - // The name for a General Object. Matches Names and also UUIDs. + // The name for a Server. Name *string `json:"name,omitempty"` } diff --git a/services/iaas/model_update_snapshot_payload.go b/services/iaas/model_update_snapshot_payload.go index 4cc2a0c21..71e46f850 100644 --- a/services/iaas/model_update_snapshot_payload.go +++ b/services/iaas/model_update_snapshot_payload.go @@ -19,7 +19,7 @@ var _ MappedNullable = &UpdateSnapshotPayload{} // UpdateSnapshotPayload Object that represents an update request body of a snapshot. type UpdateSnapshotPayload struct { - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` diff --git a/services/iaas/model_update_volume_payload.go b/services/iaas/model_update_volume_payload.go index cb69b67e1..4da4cb547 100644 --- a/services/iaas/model_update_volume_payload.go +++ b/services/iaas/model_update_volume_payload.go @@ -24,7 +24,7 @@ type UpdateVolumePayload struct { // Description Object. Allows string up to 127 Characters. Description *string `json:"description,omitempty"` ImageConfig *ImageConfig `json:"imageConfig,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` @@ -36,8 +36,6 @@ type UpdateVolumePayload struct { // will change when the set of required properties is changed func NewUpdateVolumePayload() *UpdateVolumePayload { this := UpdateVolumePayload{} - var bootable bool = false - this.Bootable = &bootable return &this } @@ -46,8 +44,6 @@ func NewUpdateVolumePayload() *UpdateVolumePayload { // but it doesn't guarantee that properties required by API are set func NewUpdateVolumePayloadWithDefaults() *UpdateVolumePayload { this := UpdateVolumePayload{} - var bootable bool = false - this.Bootable = &bootable return &this } diff --git a/services/iaas/model_volume.go b/services/iaas/model_volume.go index 29314efef..70edc95bd 100644 --- a/services/iaas/model_volume.go +++ b/services/iaas/model_volume.go @@ -32,7 +32,7 @@ type Volume struct { // Universally Unique Identifier (UUID). Id *string `json:"id,omitempty"` ImageConfig *ImageConfig `json:"imageConfig,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. Name *string `json:"name,omitempty"` @@ -43,7 +43,7 @@ type Volume struct { // Size in Gigabyte. Size *int64 `json:"size,omitempty"` Source *VolumeSource `json:"source,omitempty"` - // The status of a volume object. + // The status of a volume object. Possible values: `ATTACHED`, `ATTACHING`, `AVAILABLE`, `AWAITING-TRANSFER`, `BACKING-UP`, `CREATING`, `DELETED`, `DELETING`, `DETACHING`, `DOWNLOADING`, `ERROR`, `ERROR_BACKING-UP`, `ERROR_DELETING`, `ERROR_RESIZING`, `ERROR_RESTORING-BACKUP`, `MAINTENANCE`, `RESERVED`, `RESIZING`, `RESTORING-BACKUP`, `RETYPING`, `UPLOADING`. Status *string `json:"status,omitempty"` // Date-time when resource was last updated. UpdatedAt *time.Time `json:"updatedAt,omitempty"` diff --git a/services/iaas/model_volume_attachment.go b/services/iaas/model_volume_attachment.go index b75f67964..a4865527b 100644 --- a/services/iaas/model_volume_attachment.go +++ b/services/iaas/model_volume_attachment.go @@ -33,8 +33,6 @@ type VolumeAttachment struct { // will change when the set of required properties is changed func NewVolumeAttachment() *VolumeAttachment { this := VolumeAttachment{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } @@ -43,8 +41,6 @@ func NewVolumeAttachment() *VolumeAttachment { // but it doesn't guarantee that properties required by API are set func NewVolumeAttachmentWithDefaults() *VolumeAttachment { this := VolumeAttachment{} - var deleteOnTermination bool = false - this.DeleteOnTermination = &deleteOnTermination return &this } diff --git a/services/iaas/model_volume_performance_class.go b/services/iaas/model_volume_performance_class.go index f6eec0ef6..6d5d936b0 100644 --- a/services/iaas/model_volume_performance_class.go +++ b/services/iaas/model_volume_performance_class.go @@ -23,7 +23,7 @@ type VolumePerformanceClass struct { Description *string `json:"description,omitempty"` // Input/Output Operations per second. Iops *int64 `json:"iops,omitempty"` - // Object that represents the labels of an object. + // Object that represents the labels of an object. Regex for keys: `^[a-z]((-|_|[a-z0-9])){0,62}$`. Regex for values: `^(-|_|[a-z0-9]){0,63}$`. Labels *map[string]interface{} `json:"labels,omitempty"` // The name for a General Object. Matches Names and also UUIDs. // REQUIRED diff --git a/services/iaas/model_volume_source.go b/services/iaas/model_volume_source.go index 26d741371..62db77414 100644 --- a/services/iaas/model_volume_source.go +++ b/services/iaas/model_volume_source.go @@ -22,7 +22,7 @@ type VolumeSource struct { // Universally Unique Identifier (UUID). // REQUIRED Id *string `json:"id"` - // The source types of a volume. + // The source types of a volume. Possible values: `image`, `volume`, `snapshot`, `backup`. // REQUIRED Type *string `json:"type"` }