From 42b6a9d84ea38d60a852f2313200e2ee4da65dd8 Mon Sep 17 00:00:00 2001 From: SDK Generator Bot Date: Thu, 7 Aug 2025 10:09:17 +0000 Subject: [PATCH] Generate auditlog --- go.work | 1 + services/auditlog/.openapi-generator/VERSION | 1 + services/auditlog/api_default.go | 760 +++++++++ services/auditlog/api_default_test.go | 190 +++ services/auditlog/client.go | 631 ++++++++ services/auditlog/configuration.go | 38 + services/auditlog/go.mod | 10 + services/auditlog/go.sum | 8 + .../model_audit_log_entry_context_response.go | 227 +++ ...l_audit_log_entry_context_response_test.go | 11 + ...odel_audit_log_entry_initiator_response.go | 176 +++ ...audit_log_entry_initiator_response_test.go | 11 + .../model_audit_log_entry_request_response.go | 271 ++++ ...l_audit_log_entry_request_response_test.go | 11 + .../model_audit_log_entry_response.go | 1356 +++++++++++++++++ .../model_audit_log_entry_response_test.go | 151 ++ ...ervice_account_delegation_info_response.go | 126 ++ ...e_account_delegation_info_response_test.go | 11 + services/auditlog/model_error_response.go | 275 ++++ .../auditlog/model_error_response_test.go | 11 + .../auditlog/model_gateway_error_response.go | 177 +++ .../model_gateway_error_response_test.go | 11 + .../model_list_audit_log_entries_response.go | 226 +++ ...el_list_audit_log_entries_response_test.go | 11 + ...ount_delegation_info_principal_response.go | 176 +++ ...delegation_info_principal_response_test.go | 11 + services/auditlog/utils.go | 385 +++++ 27 files changed, 5273 insertions(+) create mode 100644 services/auditlog/.openapi-generator/VERSION create mode 100644 services/auditlog/api_default.go create mode 100644 services/auditlog/api_default_test.go create mode 100644 services/auditlog/client.go create mode 100644 services/auditlog/configuration.go create mode 100644 services/auditlog/go.mod create mode 100644 services/auditlog/go.sum create mode 100644 services/auditlog/model_audit_log_entry_context_response.go create mode 100644 services/auditlog/model_audit_log_entry_context_response_test.go create mode 100644 services/auditlog/model_audit_log_entry_initiator_response.go create mode 100644 services/auditlog/model_audit_log_entry_initiator_response_test.go create mode 100644 services/auditlog/model_audit_log_entry_request_response.go create mode 100644 services/auditlog/model_audit_log_entry_request_response_test.go create mode 100644 services/auditlog/model_audit_log_entry_response.go create mode 100644 services/auditlog/model_audit_log_entry_response_test.go create mode 100644 services/auditlog/model_audit_log_entry_service_account_delegation_info_response.go create mode 100644 services/auditlog/model_audit_log_entry_service_account_delegation_info_response_test.go create mode 100644 services/auditlog/model_error_response.go create mode 100644 services/auditlog/model_error_response_test.go create mode 100644 services/auditlog/model_gateway_error_response.go create mode 100644 services/auditlog/model_gateway_error_response_test.go create mode 100644 services/auditlog/model_list_audit_log_entries_response.go create mode 100644 services/auditlog/model_list_audit_log_entries_response_test.go create mode 100644 services/auditlog/model_service_account_delegation_info_principal_response.go create mode 100644 services/auditlog/model_service_account_delegation_info_principal_response_test.go create mode 100644 services/auditlog/utils.go diff --git a/go.work b/go.work index 157c17fb9..91befe6ea 100644 --- a/go.work +++ b/go.work @@ -31,6 +31,7 @@ use ( ./examples/waiter ./services/alb ./services/archiving + ./services/auditlog ./services/authorization ./services/cdn ./services/certificates diff --git a/services/auditlog/.openapi-generator/VERSION b/services/auditlog/.openapi-generator/VERSION new file mode 100644 index 000000000..cd802a1ec --- /dev/null +++ b/services/auditlog/.openapi-generator/VERSION @@ -0,0 +1 @@ +6.6.0 \ No newline at end of file diff --git a/services/auditlog/api_default.go b/services/auditlog/api_default.go new file mode 100644 index 000000000..1ae8aef2e --- /dev/null +++ b/services/auditlog/api_default.go @@ -0,0 +1,760 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +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" +) + +type DefaultApi interface { + /* + ListFolderAuditLogEntries Folder - Download audit log entries + Returns all audit log entries of the folder for the specified period. \ + Period must not be longer than 24 hours within the last 90 days. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param folderId ID of the folder for which entries should be returned. + @return ApiListFolderAuditLogEntriesRequest + */ + ListFolderAuditLogEntries(ctx context.Context, folderId string) ApiListFolderAuditLogEntriesRequest + /* + ListFolderAuditLogEntriesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param folderId ID of the folder for which entries should be returned. + @return ListAuditLogEntriesResponse + + */ + ListFolderAuditLogEntriesExecute(ctx context.Context, folderId string) (*ListAuditLogEntriesResponse, error) + /* + ListOrganizationAuditLogEntries Organization - Download audit log entries + Returns all audit log entries of the organization for the specified period. \ + Period must not be longer than 24 hours within the last 90 days. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId ID of the organization for which entries should be returned. + @return ApiListOrganizationAuditLogEntriesRequest + */ + ListOrganizationAuditLogEntries(ctx context.Context, organizationId string) ApiListOrganizationAuditLogEntriesRequest + /* + ListOrganizationAuditLogEntriesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId ID of the organization for which entries should be returned. + @return ListAuditLogEntriesResponse + + */ + ListOrganizationAuditLogEntriesExecute(ctx context.Context, organizationId string) (*ListAuditLogEntriesResponse, error) + /* + ListProjectAuditLogEntries Project - Download audit log entries + Returns all audit log entries of the project for the specified period. \ + Period must not be longer than 24 hours within the last 90 days. + + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project for which entries should be returned. + @return ApiListProjectAuditLogEntriesRequest + */ + ListProjectAuditLogEntries(ctx context.Context, projectId string) ApiListProjectAuditLogEntriesRequest + /* + ListProjectAuditLogEntriesExecute executes the request + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project for which entries should be returned. + @return ListAuditLogEntriesResponse + + */ + ListProjectAuditLogEntriesExecute(ctx context.Context, projectId string) (*ListAuditLogEntriesResponse, error) +} + +type ApiListFolderAuditLogEntriesRequest interface { + // An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + StartTimeRange(startTimeRange time.Time) ApiListFolderAuditLogEntriesRequest + // An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + EndTimeRange(endTimeRange time.Time) ApiListFolderAuditLogEntriesRequest + // The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + Limit(limit float32) ApiListFolderAuditLogEntriesRequest + // A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + Cursor(cursor string) ApiListFolderAuditLogEntriesRequest + Execute() (*ListAuditLogEntriesResponse, error) +} + +type ApiListOrganizationAuditLogEntriesRequest interface { + // An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + StartTimeRange(startTimeRange time.Time) ApiListOrganizationAuditLogEntriesRequest + // An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + EndTimeRange(endTimeRange time.Time) ApiListOrganizationAuditLogEntriesRequest + // The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + Limit(limit float32) ApiListOrganizationAuditLogEntriesRequest + // A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + Cursor(cursor string) ApiListOrganizationAuditLogEntriesRequest + Execute() (*ListAuditLogEntriesResponse, error) +} + +type ApiListProjectAuditLogEntriesRequest interface { + // An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + StartTimeRange(startTimeRange time.Time) ApiListProjectAuditLogEntriesRequest + // An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + EndTimeRange(endTimeRange time.Time) ApiListProjectAuditLogEntriesRequest + // The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + Limit(limit float32) ApiListProjectAuditLogEntriesRequest + // A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + Cursor(cursor string) ApiListProjectAuditLogEntriesRequest + Execute() (*ListAuditLogEntriesResponse, error) +} + +// DefaultApiService DefaultApi service +type DefaultApiService service + +type ListFolderAuditLogEntriesRequest struct { + ctx context.Context + apiService *DefaultApiService + folderId string + startTimeRange *time.Time + endTimeRange *time.Time + limit *float32 + cursor *string +} + +// An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + +func (r ListFolderAuditLogEntriesRequest) StartTimeRange(startTimeRange time.Time) ApiListFolderAuditLogEntriesRequest { + r.startTimeRange = &startTimeRange + return r +} + +// An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + +func (r ListFolderAuditLogEntriesRequest) EndTimeRange(endTimeRange time.Time) ApiListFolderAuditLogEntriesRequest { + r.endTimeRange = &endTimeRange + return r +} + +// The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + +func (r ListFolderAuditLogEntriesRequest) Limit(limit float32) ApiListFolderAuditLogEntriesRequest { + r.limit = &limit + return r +} + +// A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + +func (r ListFolderAuditLogEntriesRequest) Cursor(cursor string) ApiListFolderAuditLogEntriesRequest { + r.cursor = &cursor + return r +} + +func (r ListFolderAuditLogEntriesRequest) Execute() (*ListAuditLogEntriesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListAuditLogEntriesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListFolderAuditLogEntries") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/folders/{folderId}" + localVarPath = strings.Replace(localVarPath, "{"+"folderId"+"}", url.PathEscape(ParameterValueToString(r.folderId, "folderId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.startTimeRange == nil { + return localVarReturnValue, fmt.Errorf("startTimeRange is required and must be specified") + } + if r.endTimeRange == nil { + return localVarReturnValue, fmt.Errorf("endTimeRange is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "start-time-range", r.startTimeRange, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "end-time-range", r.endTimeRange, "") + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + // 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 := 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 := 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 ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v GatewayErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = 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 +} + +/* +ListFolderAuditLogEntries: Folder - Download audit log entries + +Returns all audit log entries of the folder for the specified period. \ +Period must not be longer than 24 hours within the last 90 days. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param folderId ID of the folder for which entries should be returned. + @return ApiListFolderAuditLogEntriesRequest +*/ +func (a *APIClient) ListFolderAuditLogEntries(ctx context.Context, folderId string) ApiListFolderAuditLogEntriesRequest { + return ListFolderAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + folderId: folderId, + } +} + +func (a *APIClient) ListFolderAuditLogEntriesExecute(ctx context.Context, folderId string) (*ListAuditLogEntriesResponse, error) { + r := ListFolderAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + folderId: folderId, + } + return r.Execute() +} + +type ListOrganizationAuditLogEntriesRequest struct { + ctx context.Context + apiService *DefaultApiService + organizationId string + startTimeRange *time.Time + endTimeRange *time.Time + limit *float32 + cursor *string +} + +// An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + +func (r ListOrganizationAuditLogEntriesRequest) StartTimeRange(startTimeRange time.Time) ApiListOrganizationAuditLogEntriesRequest { + r.startTimeRange = &startTimeRange + return r +} + +// An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + +func (r ListOrganizationAuditLogEntriesRequest) EndTimeRange(endTimeRange time.Time) ApiListOrganizationAuditLogEntriesRequest { + r.endTimeRange = &endTimeRange + return r +} + +// The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + +func (r ListOrganizationAuditLogEntriesRequest) Limit(limit float32) ApiListOrganizationAuditLogEntriesRequest { + r.limit = &limit + return r +} + +// A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + +func (r ListOrganizationAuditLogEntriesRequest) Cursor(cursor string) ApiListOrganizationAuditLogEntriesRequest { + r.cursor = &cursor + return r +} + +func (r ListOrganizationAuditLogEntriesRequest) Execute() (*ListAuditLogEntriesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListAuditLogEntriesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListOrganizationAuditLogEntries") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/organizations/{organizationId}" + localVarPath = strings.Replace(localVarPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(r.organizationId, "organizationId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.startTimeRange == nil { + return localVarReturnValue, fmt.Errorf("startTimeRange is required and must be specified") + } + if r.endTimeRange == nil { + return localVarReturnValue, fmt.Errorf("endTimeRange is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "start-time-range", r.startTimeRange, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "end-time-range", r.endTimeRange, "") + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + // 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 := 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 := 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 ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v GatewayErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = 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 +} + +/* +ListOrganizationAuditLogEntries: Organization - Download audit log entries + +Returns all audit log entries of the organization for the specified period. \ +Period must not be longer than 24 hours within the last 90 days. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param organizationId ID of the organization for which entries should be returned. + @return ApiListOrganizationAuditLogEntriesRequest +*/ +func (a *APIClient) ListOrganizationAuditLogEntries(ctx context.Context, organizationId string) ApiListOrganizationAuditLogEntriesRequest { + return ListOrganizationAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } +} + +func (a *APIClient) ListOrganizationAuditLogEntriesExecute(ctx context.Context, organizationId string) (*ListAuditLogEntriesResponse, error) { + r := ListOrganizationAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + organizationId: organizationId, + } + return r.Execute() +} + +type ListProjectAuditLogEntriesRequest struct { + ctx context.Context + apiService *DefaultApiService + projectId string + startTimeRange *time.Time + endTimeRange *time.Time + limit *float32 + cursor *string +} + +// An ISO timestamp to specify the beginning of the time range from which entries should be returned, based on the eventTimeStamp. If not given, defaults to the beginning of time. + +func (r ListProjectAuditLogEntriesRequest) StartTimeRange(startTimeRange time.Time) ApiListProjectAuditLogEntriesRequest { + r.startTimeRange = &startTimeRange + return r +} + +// An ISO timestamp to specify the end of the time range up until which entries should be returned, based on the eventTimeStamp. If not given, defaults to the time this request was received. + +func (r ListProjectAuditLogEntriesRequest) EndTimeRange(endTimeRange time.Time) ApiListProjectAuditLogEntriesRequest { + r.endTimeRange = &endTimeRange + return r +} + +// The maximum number of entries to return. If the value exceeds the allowed maximum, the maximum value will be used instead. + +func (r ListProjectAuditLogEntriesRequest) Limit(limit float32) ApiListProjectAuditLogEntriesRequest { + r.limit = &limit + return r +} + +// A pagination cursor to load further audit log entries for. May be included in the response of previous calls of the API. + +func (r ListProjectAuditLogEntriesRequest) Cursor(cursor string) ApiListProjectAuditLogEntriesRequest { + r.cursor = &cursor + return r +} + +func (r ListProjectAuditLogEntriesRequest) Execute() (*ListAuditLogEntriesResponse, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *ListAuditLogEntriesResponse + ) + a := r.apiService + client, ok := a.client.(*APIClient) + if !ok { + return localVarReturnValue, fmt.Errorf("could not parse client to type APIClient") + } + localBasePath, err := client.cfg.ServerURLWithContext(r.ctx, "DefaultApiService.ListProjectAuditLogEntries") + if err != nil { + return localVarReturnValue, &oapierror.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/v2/projects/{projectId}" + 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.startTimeRange == nil { + return localVarReturnValue, fmt.Errorf("startTimeRange is required and must be specified") + } + if r.endTimeRange == nil { + return localVarReturnValue, fmt.Errorf("endTimeRange is required and must be specified") + } + + parameterAddToHeaderOrQuery(localVarQueryParams, "start-time-range", r.startTimeRange, "") + parameterAddToHeaderOrQuery(localVarQueryParams, "end-time-range", r.endTimeRange, "") + if r.limit != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "") + } + if r.cursor != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cursor", r.cursor, "") + } + // 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 := 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 := 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 ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 401 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 404 { + var v ErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + return localVarReturnValue, newErr + } + if localVarHTTPResponse.StatusCode == 429 { + var v GatewayErrorResponse + err = client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr.ErrorMessage = err.Error() + return localVarReturnValue, newErr + } + newErr.ErrorMessage = oapierror.FormatErrorMessage(localVarHTTPResponse.Status, &v) + newErr.Model = v + } + return localVarReturnValue, newErr + } + + err = 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 +} + +/* +ListProjectAuditLogEntries: Project - Download audit log entries + +Returns all audit log entries of the project for the specified period. \ +Period must not be longer than 24 hours within the last 90 days. + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param projectId ID of the project for which entries should be returned. + @return ApiListProjectAuditLogEntriesRequest +*/ +func (a *APIClient) ListProjectAuditLogEntries(ctx context.Context, projectId string) ApiListProjectAuditLogEntriesRequest { + return ListProjectAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } +} + +func (a *APIClient) ListProjectAuditLogEntriesExecute(ctx context.Context, projectId string) (*ListAuditLogEntriesResponse, error) { + r := ListProjectAuditLogEntriesRequest{ + apiService: a.defaultApi, + ctx: ctx, + projectId: projectId, + } + return r.Execute() +} diff --git a/services/auditlog/api_default_test.go b/services/auditlog/api_default_test.go new file mode 100644 index 000000000..b642ed7de --- /dev/null +++ b/services/auditlog/api_default_test.go @@ -0,0 +1,190 @@ +/* +Audit Log API + +Testing DefaultApiService + +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); + +package auditlog + +import ( + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + "time" + + "github.com/google/uuid" + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +func Test_auditlog_DefaultApiService(t *testing.T) { + + t.Run("Test DefaultApiService ListFolderAuditLogEntries", func(t *testing.T) { + _apiUrlPath := "/v2/folders/{folderId}" + folderIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"folderId"+"}", url.PathEscape(ParameterValueToString(folderIdValue, "folderId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListAuditLogEntriesResponse{} + 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 auditlog_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) + } + + folderId := folderIdValue + var startTimeRange time.Time + var endTimeRange time.Time + + resp, reqErr := apiClient.ListFolderAuditLogEntries(context.Background(), folderId).StartTimeRange(startTimeRange).EndTimeRange(endTimeRange).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListOrganizationAuditLogEntries", func(t *testing.T) { + _apiUrlPath := "/v2/organizations/{organizationId}" + organizationIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"organizationId"+"}", url.PathEscape(ParameterValueToString(organizationIdValue, "organizationId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListAuditLogEntriesResponse{} + 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 auditlog_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) + } + + organizationId := organizationIdValue + var startTimeRange time.Time + var endTimeRange time.Time + + resp, reqErr := apiClient.ListOrganizationAuditLogEntries(context.Background(), organizationId).StartTimeRange(startTimeRange).EndTimeRange(endTimeRange).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + + t.Run("Test DefaultApiService ListProjectAuditLogEntries", func(t *testing.T) { + _apiUrlPath := "/v2/projects/{projectId}" + projectIdValue := uuid.NewString() + _apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1) + + testDefaultApiServeMux := http.NewServeMux() + testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) { + data := ListAuditLogEntriesResponse{} + 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 auditlog_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 := projectIdValue + var startTimeRange time.Time + var endTimeRange time.Time + + resp, reqErr := apiClient.ListProjectAuditLogEntries(context.Background(), projectId).StartTimeRange(startTimeRange).EndTimeRange(endTimeRange).Execute() + + if reqErr != nil { + t.Fatalf("error in call: %v", reqErr) + } + if IsNil(resp) { + t.Fatalf("response not present") + } + }) + +} diff --git a/services/auditlog/client.go b/services/auditlog/client.go new file mode 100644 index 000000000..15f971091 --- /dev/null +++ b/services/auditlog/client.go @@ -0,0 +1,631 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +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 Audit Log API API v2.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 DefaultApi +} + +// 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 !IsNil(postBody) { + 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/auditlog/configuration.go b/services/auditlog/configuration.go new file mode 100644 index 000000000..ee5f9ad31 --- /dev/null +++ b/services/auditlog/configuration.go @@ -0,0 +1,38 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "github.com/stackitcloud/stackit-sdk-go/core/config" +) + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *config.Configuration { + cfg := &config.Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "stackit-sdk-go/auditlog", + Debug: false, + Servers: config.ServerConfigurations{ + { + URL: "https://auditlog.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/auditlog/go.mod b/services/auditlog/go.mod new file mode 100644 index 000000000..4923f6459 --- /dev/null +++ b/services/auditlog/go.mod @@ -0,0 +1,10 @@ +module github.com/stackitcloud/stackit-sdk-go/services/auditlog + +go 1.21 + +require ( + github.com/google/uuid v1.6.0 + github.com/stackitcloud/stackit-sdk-go/core v0.17.3 +) + +require github.com/golang-jwt/jwt/v5 v5.3.0 // indirect diff --git a/services/auditlog/go.sum b/services/auditlog/go.sum new file mode 100644 index 000000000..5069d5c27 --- /dev/null +++ b/services/auditlog/go.sum @@ -0,0 +1,8 @@ +github.com/golang-jwt/jwt/v5 v5.3.0 h1:pv4AsKCKKZuqlgs5sUmn4x8UlGa0kEVt/puTpKx9vvo= +github.com/golang-jwt/jwt/v5 v5.3.0/go.mod h1:fxCRLWMO43lRc8nhHWY6LGqRcf+1gQWArsqaEUEa5bE= +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.17.3 h1:GsZGmRRc/3GJLmCUnsZswirr5wfLRrwavbnL/renOqg= +github.com/stackitcloud/stackit-sdk-go/core v0.17.3/go.mod h1:HBCXJGPgdRulplDzhrmwC+Dak9B/x0nzNtmOpu+1Ahg= diff --git a/services/auditlog/model_audit_log_entry_context_response.go b/services/auditlog/model_audit_log_entry_context_response.go new file mode 100644 index 000000000..25dbe390a --- /dev/null +++ b/services/auditlog/model_audit_log_entry_context_response.go @@ -0,0 +1,227 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the AuditLogEntryContextResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogEntryContextResponse{} + +/* + types and functions for folderId +*/ + +// isNotNullableString +type AuditLogEntryContextResponseGetFolderIdAttributeType = *string + +func getAuditLogEntryContextResponseGetFolderIdAttributeTypeOk(arg AuditLogEntryContextResponseGetFolderIdAttributeType) (ret AuditLogEntryContextResponseGetFolderIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryContextResponseGetFolderIdAttributeType(arg *AuditLogEntryContextResponseGetFolderIdAttributeType, val AuditLogEntryContextResponseGetFolderIdRetType) { + *arg = &val +} + +type AuditLogEntryContextResponseGetFolderIdArgType = string +type AuditLogEntryContextResponseGetFolderIdRetType = string + +/* + types and functions for organizationId +*/ + +// isNotNullableString +type AuditLogEntryContextResponseGetOrganizationIdAttributeType = *string + +func getAuditLogEntryContextResponseGetOrganizationIdAttributeTypeOk(arg AuditLogEntryContextResponseGetOrganizationIdAttributeType) (ret AuditLogEntryContextResponseGetOrganizationIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryContextResponseGetOrganizationIdAttributeType(arg *AuditLogEntryContextResponseGetOrganizationIdAttributeType, val AuditLogEntryContextResponseGetOrganizationIdRetType) { + *arg = &val +} + +type AuditLogEntryContextResponseGetOrganizationIdArgType = string +type AuditLogEntryContextResponseGetOrganizationIdRetType = string + +/* + types and functions for projectId +*/ + +// isNotNullableString +type AuditLogEntryContextResponseGetProjectIdAttributeType = *string + +func getAuditLogEntryContextResponseGetProjectIdAttributeTypeOk(arg AuditLogEntryContextResponseGetProjectIdAttributeType) (ret AuditLogEntryContextResponseGetProjectIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryContextResponseGetProjectIdAttributeType(arg *AuditLogEntryContextResponseGetProjectIdAttributeType, val AuditLogEntryContextResponseGetProjectIdRetType) { + *arg = &val +} + +type AuditLogEntryContextResponseGetProjectIdArgType = string +type AuditLogEntryContextResponseGetProjectIdRetType = string + +// AuditLogEntryContextResponse Request context +type AuditLogEntryContextResponse struct { + // Folder id + FolderId AuditLogEntryContextResponseGetFolderIdAttributeType `json:"folderId,omitempty"` + // Organization id + OrganizationId AuditLogEntryContextResponseGetOrganizationIdAttributeType `json:"organizationId,omitempty"` + // Project id + ProjectId AuditLogEntryContextResponseGetProjectIdAttributeType `json:"projectId,omitempty"` +} + +// NewAuditLogEntryContextResponse instantiates a new AuditLogEntryContextResponse 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 NewAuditLogEntryContextResponse() *AuditLogEntryContextResponse { + this := AuditLogEntryContextResponse{} + return &this +} + +// NewAuditLogEntryContextResponseWithDefaults instantiates a new AuditLogEntryContextResponse 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 NewAuditLogEntryContextResponseWithDefaults() *AuditLogEntryContextResponse { + this := AuditLogEntryContextResponse{} + return &this +} + +// GetFolderId returns the FolderId field value if set, zero value otherwise. +func (o *AuditLogEntryContextResponse) GetFolderId() (res AuditLogEntryContextResponseGetFolderIdRetType) { + res, _ = o.GetFolderIdOk() + return +} + +// GetFolderIdOk returns a tuple with the FolderId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryContextResponse) GetFolderIdOk() (ret AuditLogEntryContextResponseGetFolderIdRetType, ok bool) { + return getAuditLogEntryContextResponseGetFolderIdAttributeTypeOk(o.FolderId) +} + +// HasFolderId returns a boolean if a field has been set. +func (o *AuditLogEntryContextResponse) HasFolderId() bool { + _, ok := o.GetFolderIdOk() + return ok +} + +// SetFolderId gets a reference to the given string and assigns it to the FolderId field. +func (o *AuditLogEntryContextResponse) SetFolderId(v AuditLogEntryContextResponseGetFolderIdRetType) { + setAuditLogEntryContextResponseGetFolderIdAttributeType(&o.FolderId, v) +} + +// GetOrganizationId returns the OrganizationId field value if set, zero value otherwise. +func (o *AuditLogEntryContextResponse) GetOrganizationId() (res AuditLogEntryContextResponseGetOrganizationIdRetType) { + res, _ = o.GetOrganizationIdOk() + return +} + +// GetOrganizationIdOk returns a tuple with the OrganizationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryContextResponse) GetOrganizationIdOk() (ret AuditLogEntryContextResponseGetOrganizationIdRetType, ok bool) { + return getAuditLogEntryContextResponseGetOrganizationIdAttributeTypeOk(o.OrganizationId) +} + +// HasOrganizationId returns a boolean if a field has been set. +func (o *AuditLogEntryContextResponse) HasOrganizationId() bool { + _, ok := o.GetOrganizationIdOk() + return ok +} + +// SetOrganizationId gets a reference to the given string and assigns it to the OrganizationId field. +func (o *AuditLogEntryContextResponse) SetOrganizationId(v AuditLogEntryContextResponseGetOrganizationIdRetType) { + setAuditLogEntryContextResponseGetOrganizationIdAttributeType(&o.OrganizationId, v) +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *AuditLogEntryContextResponse) GetProjectId() (res AuditLogEntryContextResponseGetProjectIdRetType) { + res, _ = o.GetProjectIdOk() + return +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryContextResponse) GetProjectIdOk() (ret AuditLogEntryContextResponseGetProjectIdRetType, ok bool) { + return getAuditLogEntryContextResponseGetProjectIdAttributeTypeOk(o.ProjectId) +} + +// HasProjectId returns a boolean if a field has been set. +func (o *AuditLogEntryContextResponse) HasProjectId() bool { + _, ok := o.GetProjectIdOk() + return ok +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *AuditLogEntryContextResponse) SetProjectId(v AuditLogEntryContextResponseGetProjectIdRetType) { + setAuditLogEntryContextResponseGetProjectIdAttributeType(&o.ProjectId, v) +} + +func (o AuditLogEntryContextResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuditLogEntryContextResponseGetFolderIdAttributeTypeOk(o.FolderId); ok { + toSerialize["FolderId"] = val + } + if val, ok := getAuditLogEntryContextResponseGetOrganizationIdAttributeTypeOk(o.OrganizationId); ok { + toSerialize["OrganizationId"] = val + } + if val, ok := getAuditLogEntryContextResponseGetProjectIdAttributeTypeOk(o.ProjectId); ok { + toSerialize["ProjectId"] = val + } + return toSerialize, nil +} + +type NullableAuditLogEntryContextResponse struct { + value *AuditLogEntryContextResponse + isSet bool +} + +func (v NullableAuditLogEntryContextResponse) Get() *AuditLogEntryContextResponse { + return v.value +} + +func (v *NullableAuditLogEntryContextResponse) Set(val *AuditLogEntryContextResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryContextResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryContextResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryContextResponse(val *AuditLogEntryContextResponse) *NullableAuditLogEntryContextResponse { + return &NullableAuditLogEntryContextResponse{value: val, isSet: true} +} + +func (v NullableAuditLogEntryContextResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryContextResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_audit_log_entry_context_response_test.go b/services/auditlog/model_audit_log_entry_context_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_context_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_audit_log_entry_initiator_response.go b/services/auditlog/model_audit_log_entry_initiator_response.go new file mode 100644 index 000000000..92abfb2f6 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_initiator_response.go @@ -0,0 +1,176 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the AuditLogEntryInitiatorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogEntryInitiatorResponse{} + +/* + types and functions for email +*/ + +// isNotNullableString +type AuditLogEntryInitiatorResponseGetEmailAttributeType = *string + +func getAuditLogEntryInitiatorResponseGetEmailAttributeTypeOk(arg AuditLogEntryInitiatorResponseGetEmailAttributeType) (ret AuditLogEntryInitiatorResponseGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryInitiatorResponseGetEmailAttributeType(arg *AuditLogEntryInitiatorResponseGetEmailAttributeType, val AuditLogEntryInitiatorResponseGetEmailRetType) { + *arg = &val +} + +type AuditLogEntryInitiatorResponseGetEmailArgType = string +type AuditLogEntryInitiatorResponseGetEmailRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type AuditLogEntryInitiatorResponseGetIdAttributeType = *string + +func getAuditLogEntryInitiatorResponseGetIdAttributeTypeOk(arg AuditLogEntryInitiatorResponseGetIdAttributeType) (ret AuditLogEntryInitiatorResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryInitiatorResponseGetIdAttributeType(arg *AuditLogEntryInitiatorResponseGetIdAttributeType, val AuditLogEntryInitiatorResponseGetIdRetType) { + *arg = &val +} + +type AuditLogEntryInitiatorResponseGetIdArgType = string +type AuditLogEntryInitiatorResponseGetIdRetType = string + +// AuditLogEntryInitiatorResponse Information about who made the request. +type AuditLogEntryInitiatorResponse struct { + // E-Mail of the user or service account who triggered the request + Email AuditLogEntryInitiatorResponseGetEmailAttributeType `json:"email,omitempty"` + // Unique identifier of the user + // REQUIRED + Id AuditLogEntryInitiatorResponseGetIdAttributeType `json:"id" required:"true"` +} + +type _AuditLogEntryInitiatorResponse AuditLogEntryInitiatorResponse + +// NewAuditLogEntryInitiatorResponse instantiates a new AuditLogEntryInitiatorResponse 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 NewAuditLogEntryInitiatorResponse(id AuditLogEntryInitiatorResponseGetIdArgType) *AuditLogEntryInitiatorResponse { + this := AuditLogEntryInitiatorResponse{} + setAuditLogEntryInitiatorResponseGetIdAttributeType(&this.Id, id) + return &this +} + +// NewAuditLogEntryInitiatorResponseWithDefaults instantiates a new AuditLogEntryInitiatorResponse 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 NewAuditLogEntryInitiatorResponseWithDefaults() *AuditLogEntryInitiatorResponse { + this := AuditLogEntryInitiatorResponse{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *AuditLogEntryInitiatorResponse) GetEmail() (res AuditLogEntryInitiatorResponseGetEmailRetType) { + res, _ = o.GetEmailOk() + return +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryInitiatorResponse) GetEmailOk() (ret AuditLogEntryInitiatorResponseGetEmailRetType, ok bool) { + return getAuditLogEntryInitiatorResponseGetEmailAttributeTypeOk(o.Email) +} + +// HasEmail returns a boolean if a field has been set. +func (o *AuditLogEntryInitiatorResponse) HasEmail() bool { + _, ok := o.GetEmailOk() + return ok +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *AuditLogEntryInitiatorResponse) SetEmail(v AuditLogEntryInitiatorResponseGetEmailRetType) { + setAuditLogEntryInitiatorResponseGetEmailAttributeType(&o.Email, v) +} + +// GetId returns the Id field value +func (o *AuditLogEntryInitiatorResponse) GetId() (ret AuditLogEntryInitiatorResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryInitiatorResponse) GetIdOk() (ret AuditLogEntryInitiatorResponseGetIdRetType, ok bool) { + return getAuditLogEntryInitiatorResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *AuditLogEntryInitiatorResponse) SetId(v AuditLogEntryInitiatorResponseGetIdRetType) { + setAuditLogEntryInitiatorResponseGetIdAttributeType(&o.Id, v) +} + +func (o AuditLogEntryInitiatorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuditLogEntryInitiatorResponseGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getAuditLogEntryInitiatorResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +type NullableAuditLogEntryInitiatorResponse struct { + value *AuditLogEntryInitiatorResponse + isSet bool +} + +func (v NullableAuditLogEntryInitiatorResponse) Get() *AuditLogEntryInitiatorResponse { + return v.value +} + +func (v *NullableAuditLogEntryInitiatorResponse) Set(val *AuditLogEntryInitiatorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryInitiatorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryInitiatorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryInitiatorResponse(val *AuditLogEntryInitiatorResponse) *NullableAuditLogEntryInitiatorResponse { + return &NullableAuditLogEntryInitiatorResponse{value: val, isSet: true} +} + +func (v NullableAuditLogEntryInitiatorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryInitiatorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_audit_log_entry_initiator_response_test.go b/services/auditlog/model_audit_log_entry_initiator_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_initiator_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_audit_log_entry_request_response.go b/services/auditlog/model_audit_log_entry_request_response.go new file mode 100644 index 000000000..c41dfa1bf --- /dev/null +++ b/services/auditlog/model_audit_log_entry_request_response.go @@ -0,0 +1,271 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the AuditLogEntryRequestResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogEntryRequestResponse{} + +/* + types and functions for body +*/ + +// isFreeform +type AuditLogEntryRequestResponseGetBodyAttributeType = *map[string]interface{} +type AuditLogEntryRequestResponseGetBodyArgType = map[string]interface{} +type AuditLogEntryRequestResponseGetBodyRetType = map[string]interface{} + +func getAuditLogEntryRequestResponseGetBodyAttributeTypeOk(arg AuditLogEntryRequestResponseGetBodyAttributeType) (ret AuditLogEntryRequestResponseGetBodyRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryRequestResponseGetBodyAttributeType(arg *AuditLogEntryRequestResponseGetBodyAttributeType, val AuditLogEntryRequestResponseGetBodyRetType) { + *arg = &val +} + +/* + types and functions for endpoint +*/ + +// isNotNullableString +type AuditLogEntryRequestResponseGetEndpointAttributeType = *string + +func getAuditLogEntryRequestResponseGetEndpointAttributeTypeOk(arg AuditLogEntryRequestResponseGetEndpointAttributeType) (ret AuditLogEntryRequestResponseGetEndpointRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryRequestResponseGetEndpointAttributeType(arg *AuditLogEntryRequestResponseGetEndpointAttributeType, val AuditLogEntryRequestResponseGetEndpointRetType) { + *arg = &val +} + +type AuditLogEntryRequestResponseGetEndpointArgType = string +type AuditLogEntryRequestResponseGetEndpointRetType = string + +/* + types and functions for headers +*/ + +// isFreeform +type AuditLogEntryRequestResponseGetHeadersAttributeType = *map[string]interface{} +type AuditLogEntryRequestResponseGetHeadersArgType = map[string]interface{} +type AuditLogEntryRequestResponseGetHeadersRetType = map[string]interface{} + +func getAuditLogEntryRequestResponseGetHeadersAttributeTypeOk(arg AuditLogEntryRequestResponseGetHeadersAttributeType) (ret AuditLogEntryRequestResponseGetHeadersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryRequestResponseGetHeadersAttributeType(arg *AuditLogEntryRequestResponseGetHeadersAttributeType, val AuditLogEntryRequestResponseGetHeadersRetType) { + *arg = &val +} + +/* + types and functions for parameters +*/ + +// isFreeform +type AuditLogEntryRequestResponseGetParametersAttributeType = *map[string]interface{} +type AuditLogEntryRequestResponseGetParametersArgType = map[string]interface{} +type AuditLogEntryRequestResponseGetParametersRetType = map[string]interface{} + +func getAuditLogEntryRequestResponseGetParametersAttributeTypeOk(arg AuditLogEntryRequestResponseGetParametersAttributeType) (ret AuditLogEntryRequestResponseGetParametersRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryRequestResponseGetParametersAttributeType(arg *AuditLogEntryRequestResponseGetParametersAttributeType, val AuditLogEntryRequestResponseGetParametersRetType) { + *arg = &val +} + +// AuditLogEntryRequestResponse Request, which mirrors the action of the user and the resulting changes within the system +type AuditLogEntryRequestResponse struct { + // Body used to make the request. + Body AuditLogEntryRequestResponseGetBodyAttributeType `json:"body,omitempty"` + // Endpoint which received the request. + // REQUIRED + Endpoint AuditLogEntryRequestResponseGetEndpointAttributeType `json:"endpoint" required:"true"` + // Headers used to make the request. May only contain (string -> string) key-value pairs. + Headers AuditLogEntryRequestResponseGetHeadersAttributeType `json:"headers,omitempty"` + // Parameters used to make the request. + Parameters AuditLogEntryRequestResponseGetParametersAttributeType `json:"parameters,omitempty"` +} + +type _AuditLogEntryRequestResponse AuditLogEntryRequestResponse + +// NewAuditLogEntryRequestResponse instantiates a new AuditLogEntryRequestResponse 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 NewAuditLogEntryRequestResponse(endpoint AuditLogEntryRequestResponseGetEndpointArgType) *AuditLogEntryRequestResponse { + this := AuditLogEntryRequestResponse{} + setAuditLogEntryRequestResponseGetEndpointAttributeType(&this.Endpoint, endpoint) + return &this +} + +// NewAuditLogEntryRequestResponseWithDefaults instantiates a new AuditLogEntryRequestResponse 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 NewAuditLogEntryRequestResponseWithDefaults() *AuditLogEntryRequestResponse { + this := AuditLogEntryRequestResponse{} + return &this +} + +// GetBody returns the Body field value if set, zero value otherwise. +func (o *AuditLogEntryRequestResponse) GetBody() (res AuditLogEntryRequestResponseGetBodyRetType) { + res, _ = o.GetBodyOk() + return +} + +// GetBodyOk returns a tuple with the Body field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryRequestResponse) GetBodyOk() (ret AuditLogEntryRequestResponseGetBodyRetType, ok bool) { + return getAuditLogEntryRequestResponseGetBodyAttributeTypeOk(o.Body) +} + +// HasBody returns a boolean if a field has been set. +func (o *AuditLogEntryRequestResponse) HasBody() bool { + _, ok := o.GetBodyOk() + return ok +} + +// SetBody gets a reference to the given map[string]interface{} and assigns it to the Body field. +func (o *AuditLogEntryRequestResponse) SetBody(v AuditLogEntryRequestResponseGetBodyRetType) { + setAuditLogEntryRequestResponseGetBodyAttributeType(&o.Body, v) +} + +// GetEndpoint returns the Endpoint field value +func (o *AuditLogEntryRequestResponse) GetEndpoint() (ret AuditLogEntryRequestResponseGetEndpointRetType) { + ret, _ = o.GetEndpointOk() + return ret +} + +// GetEndpointOk returns a tuple with the Endpoint field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryRequestResponse) GetEndpointOk() (ret AuditLogEntryRequestResponseGetEndpointRetType, ok bool) { + return getAuditLogEntryRequestResponseGetEndpointAttributeTypeOk(o.Endpoint) +} + +// SetEndpoint sets field value +func (o *AuditLogEntryRequestResponse) SetEndpoint(v AuditLogEntryRequestResponseGetEndpointRetType) { + setAuditLogEntryRequestResponseGetEndpointAttributeType(&o.Endpoint, v) +} + +// GetHeaders returns the Headers field value if set, zero value otherwise. +func (o *AuditLogEntryRequestResponse) GetHeaders() (res AuditLogEntryRequestResponseGetHeadersRetType) { + res, _ = o.GetHeadersOk() + return +} + +// GetHeadersOk returns a tuple with the Headers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryRequestResponse) GetHeadersOk() (ret AuditLogEntryRequestResponseGetHeadersRetType, ok bool) { + return getAuditLogEntryRequestResponseGetHeadersAttributeTypeOk(o.Headers) +} + +// HasHeaders returns a boolean if a field has been set. +func (o *AuditLogEntryRequestResponse) HasHeaders() bool { + _, ok := o.GetHeadersOk() + return ok +} + +// SetHeaders gets a reference to the given map[string]interface{} and assigns it to the Headers field. +func (o *AuditLogEntryRequestResponse) SetHeaders(v AuditLogEntryRequestResponseGetHeadersRetType) { + setAuditLogEntryRequestResponseGetHeadersAttributeType(&o.Headers, v) +} + +// GetParameters returns the Parameters field value if set, zero value otherwise. +func (o *AuditLogEntryRequestResponse) GetParameters() (res AuditLogEntryRequestResponseGetParametersRetType) { + res, _ = o.GetParametersOk() + return +} + +// GetParametersOk returns a tuple with the Parameters field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryRequestResponse) GetParametersOk() (ret AuditLogEntryRequestResponseGetParametersRetType, ok bool) { + return getAuditLogEntryRequestResponseGetParametersAttributeTypeOk(o.Parameters) +} + +// HasParameters returns a boolean if a field has been set. +func (o *AuditLogEntryRequestResponse) HasParameters() bool { + _, ok := o.GetParametersOk() + return ok +} + +// SetParameters gets a reference to the given map[string]interface{} and assigns it to the Parameters field. +func (o *AuditLogEntryRequestResponse) SetParameters(v AuditLogEntryRequestResponseGetParametersRetType) { + setAuditLogEntryRequestResponseGetParametersAttributeType(&o.Parameters, v) +} + +func (o AuditLogEntryRequestResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuditLogEntryRequestResponseGetBodyAttributeTypeOk(o.Body); ok { + toSerialize["Body"] = val + } + if val, ok := getAuditLogEntryRequestResponseGetEndpointAttributeTypeOk(o.Endpoint); ok { + toSerialize["Endpoint"] = val + } + if val, ok := getAuditLogEntryRequestResponseGetHeadersAttributeTypeOk(o.Headers); ok { + toSerialize["Headers"] = val + } + if val, ok := getAuditLogEntryRequestResponseGetParametersAttributeTypeOk(o.Parameters); ok { + toSerialize["Parameters"] = val + } + return toSerialize, nil +} + +type NullableAuditLogEntryRequestResponse struct { + value *AuditLogEntryRequestResponse + isSet bool +} + +func (v NullableAuditLogEntryRequestResponse) Get() *AuditLogEntryRequestResponse { + return v.value +} + +func (v *NullableAuditLogEntryRequestResponse) Set(val *AuditLogEntryRequestResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryRequestResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryRequestResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryRequestResponse(val *AuditLogEntryRequestResponse) *NullableAuditLogEntryRequestResponse { + return &NullableAuditLogEntryRequestResponse{value: val, isSet: true} +} + +func (v NullableAuditLogEntryRequestResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryRequestResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_audit_log_entry_request_response_test.go b/services/auditlog/model_audit_log_entry_request_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_request_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_audit_log_entry_response.go b/services/auditlog/model_audit_log_entry_response.go new file mode 100644 index 000000000..1af0cfd57 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_response.go @@ -0,0 +1,1356 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the AuditLogEntryResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogEntryResponse{} + +/* + types and functions for context +*/ + +// isModel +type AuditLogEntryResponseGetContextAttributeType = *AuditLogEntryContextResponse +type AuditLogEntryResponseGetContextArgType = AuditLogEntryContextResponse +type AuditLogEntryResponseGetContextRetType = AuditLogEntryContextResponse + +func getAuditLogEntryResponseGetContextAttributeTypeOk(arg AuditLogEntryResponseGetContextAttributeType) (ret AuditLogEntryResponseGetContextRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetContextAttributeType(arg *AuditLogEntryResponseGetContextAttributeType, val AuditLogEntryResponseGetContextRetType) { + *arg = &val +} + +/* + types and functions for correlationId +*/ + +// isNotNullableString +type AuditLogEntryResponseGetCorrelationIdAttributeType = *string + +func getAuditLogEntryResponseGetCorrelationIdAttributeTypeOk(arg AuditLogEntryResponseGetCorrelationIdAttributeType) (ret AuditLogEntryResponseGetCorrelationIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetCorrelationIdAttributeType(arg *AuditLogEntryResponseGetCorrelationIdAttributeType, val AuditLogEntryResponseGetCorrelationIdRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetCorrelationIdArgType = string +type AuditLogEntryResponseGetCorrelationIdRetType = string + +/* + types and functions for details +*/ + +// isFreeform +type AuditLogEntryResponseGetDetailsAttributeType = *map[string]interface{} +type AuditLogEntryResponseGetDetailsArgType = map[string]interface{} +type AuditLogEntryResponseGetDetailsRetType = map[string]interface{} + +func getAuditLogEntryResponseGetDetailsAttributeTypeOk(arg AuditLogEntryResponseGetDetailsAttributeType) (ret AuditLogEntryResponseGetDetailsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetDetailsAttributeType(arg *AuditLogEntryResponseGetDetailsAttributeType, val AuditLogEntryResponseGetDetailsRetType) { + *arg = &val +} + +/* + types and functions for eventName +*/ + +// isNotNullableString +type AuditLogEntryResponseGetEventNameAttributeType = *string + +func getAuditLogEntryResponseGetEventNameAttributeTypeOk(arg AuditLogEntryResponseGetEventNameAttributeType) (ret AuditLogEntryResponseGetEventNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetEventNameAttributeType(arg *AuditLogEntryResponseGetEventNameAttributeType, val AuditLogEntryResponseGetEventNameRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetEventNameArgType = string +type AuditLogEntryResponseGetEventNameRetType = string + +/* + types and functions for eventSource +*/ + +// isNotNullableString +type AuditLogEntryResponseGetEventSourceAttributeType = *string + +func getAuditLogEntryResponseGetEventSourceAttributeTypeOk(arg AuditLogEntryResponseGetEventSourceAttributeType) (ret AuditLogEntryResponseGetEventSourceRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetEventSourceAttributeType(arg *AuditLogEntryResponseGetEventSourceAttributeType, val AuditLogEntryResponseGetEventSourceRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetEventSourceArgType = string +type AuditLogEntryResponseGetEventSourceRetType = string + +/* + types and functions for eventTimeStamp +*/ + +// isDateTime +type AuditLogEntryResponseGetEventTimeStampAttributeType = *time.Time +type AuditLogEntryResponseGetEventTimeStampArgType = time.Time +type AuditLogEntryResponseGetEventTimeStampRetType = time.Time + +func getAuditLogEntryResponseGetEventTimeStampAttributeTypeOk(arg AuditLogEntryResponseGetEventTimeStampAttributeType) (ret AuditLogEntryResponseGetEventTimeStampRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetEventTimeStampAttributeType(arg *AuditLogEntryResponseGetEventTimeStampAttributeType, val AuditLogEntryResponseGetEventTimeStampRetType) { + *arg = &val +} + +/* + types and functions for eventType +*/ + +// isEnum + +// AuditLogEntryResponseEventType Type that can be assigned to the event. For example, an event \"Organization created\" can be assigned to the type ADMIN_EVENT +// value type for enums +type AuditLogEntryResponseEventType string + +// List of EventType +const ( + AUDITLOGENTRYRESPONSEEVENT_TYPE_ADMIN_ACTIVITY AuditLogEntryResponseEventType = "ADMIN_ACTIVITY" + AUDITLOGENTRYRESPONSEEVENT_TYPE_SYSTEM_EVENT AuditLogEntryResponseEventType = "SYSTEM_EVENT" + AUDITLOGENTRYRESPONSEEVENT_TYPE_POLICY_DENIED AuditLogEntryResponseEventType = "POLICY_DENIED" +) + +// All allowed values of AuditLogEntryResponse enum +var AllowedAuditLogEntryResponseEventTypeEnumValues = []AuditLogEntryResponseEventType{ + "ADMIN_ACTIVITY", + "SYSTEM_EVENT", + "POLICY_DENIED", +} + +func (v *AuditLogEntryResponseEventType) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AuditLogEntryResponseEventType + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AuditLogEntryResponseEventType(value) + for _, existing := range AllowedAuditLogEntryResponseEventTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AuditLogEntryResponse", value) +} + +// NewAuditLogEntryResponseEventTypeFromValue returns a pointer to a valid AuditLogEntryResponseEventType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuditLogEntryResponseEventTypeFromValue(v AuditLogEntryResponseEventType) (*AuditLogEntryResponseEventType, error) { + ev := AuditLogEntryResponseEventType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuditLogEntryResponseEventType: valid values are %v", v, AllowedAuditLogEntryResponseEventTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuditLogEntryResponseEventType) IsValid() bool { + for _, existing := range AllowedAuditLogEntryResponseEventTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EventTypeEventType value +func (v AuditLogEntryResponseEventType) Ptr() *AuditLogEntryResponseEventType { + return &v +} + +type NullableAuditLogEntryResponseEventType struct { + value *AuditLogEntryResponseEventType + isSet bool +} + +func (v NullableAuditLogEntryResponseEventType) Get() *AuditLogEntryResponseEventType { + return v.value +} + +func (v *NullableAuditLogEntryResponseEventType) Set(val *AuditLogEntryResponseEventType) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryResponseEventType) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryResponseEventType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryResponseEventType(val *AuditLogEntryResponseEventType) *NullableAuditLogEntryResponseEventType { + return &NullableAuditLogEntryResponseEventType{value: val, isSet: true} +} + +func (v NullableAuditLogEntryResponseEventType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryResponseEventType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type AuditLogEntryResponseGetEventTypeAttributeType = *AuditLogEntryResponseEventType +type AuditLogEntryResponseGetEventTypeArgType = AuditLogEntryResponseEventType +type AuditLogEntryResponseGetEventTypeRetType = AuditLogEntryResponseEventType + +func getAuditLogEntryResponseGetEventTypeAttributeTypeOk(arg AuditLogEntryResponseGetEventTypeAttributeType) (ret AuditLogEntryResponseGetEventTypeRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetEventTypeAttributeType(arg *AuditLogEntryResponseGetEventTypeAttributeType, val AuditLogEntryResponseGetEventTypeRetType) { + *arg = &val +} + +/* + types and functions for eventVersion +*/ + +// isNotNullableString +type AuditLogEntryResponseGetEventVersionAttributeType = *string + +func getAuditLogEntryResponseGetEventVersionAttributeTypeOk(arg AuditLogEntryResponseGetEventVersionAttributeType) (ret AuditLogEntryResponseGetEventVersionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetEventVersionAttributeType(arg *AuditLogEntryResponseGetEventVersionAttributeType, val AuditLogEntryResponseGetEventVersionRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetEventVersionArgType = string +type AuditLogEntryResponseGetEventVersionRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type AuditLogEntryResponseGetIdAttributeType = *string + +func getAuditLogEntryResponseGetIdAttributeTypeOk(arg AuditLogEntryResponseGetIdAttributeType) (ret AuditLogEntryResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetIdAttributeType(arg *AuditLogEntryResponseGetIdAttributeType, val AuditLogEntryResponseGetIdRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetIdArgType = string +type AuditLogEntryResponseGetIdRetType = string + +/* + types and functions for initiator +*/ + +// isModel +type AuditLogEntryResponseGetInitiatorAttributeType = *AuditLogEntryInitiatorResponse +type AuditLogEntryResponseGetInitiatorArgType = AuditLogEntryInitiatorResponse +type AuditLogEntryResponseGetInitiatorRetType = AuditLogEntryInitiatorResponse + +func getAuditLogEntryResponseGetInitiatorAttributeTypeOk(arg AuditLogEntryResponseGetInitiatorAttributeType) (ret AuditLogEntryResponseGetInitiatorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetInitiatorAttributeType(arg *AuditLogEntryResponseGetInitiatorAttributeType, val AuditLogEntryResponseGetInitiatorRetType) { + *arg = &val +} + +/* + types and functions for receivedTimeStamp +*/ + +// isDateTime +type AuditLogEntryResponseGetReceivedTimeStampAttributeType = *time.Time +type AuditLogEntryResponseGetReceivedTimeStampArgType = time.Time +type AuditLogEntryResponseGetReceivedTimeStampRetType = time.Time + +func getAuditLogEntryResponseGetReceivedTimeStampAttributeTypeOk(arg AuditLogEntryResponseGetReceivedTimeStampAttributeType) (ret AuditLogEntryResponseGetReceivedTimeStampRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetReceivedTimeStampAttributeType(arg *AuditLogEntryResponseGetReceivedTimeStampAttributeType, val AuditLogEntryResponseGetReceivedTimeStampRetType) { + *arg = &val +} + +/* + types and functions for region +*/ + +// isNotNullableString +type AuditLogEntryResponseGetRegionAttributeType = *string + +func getAuditLogEntryResponseGetRegionAttributeTypeOk(arg AuditLogEntryResponseGetRegionAttributeType) (ret AuditLogEntryResponseGetRegionRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetRegionAttributeType(arg *AuditLogEntryResponseGetRegionAttributeType, val AuditLogEntryResponseGetRegionRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetRegionArgType = string +type AuditLogEntryResponseGetRegionRetType = string + +/* + types and functions for request +*/ + +// isModel +type AuditLogEntryResponseGetRequestAttributeType = *AuditLogEntryRequestResponse +type AuditLogEntryResponseGetRequestArgType = AuditLogEntryRequestResponse +type AuditLogEntryResponseGetRequestRetType = AuditLogEntryRequestResponse + +func getAuditLogEntryResponseGetRequestAttributeTypeOk(arg AuditLogEntryResponseGetRequestAttributeType) (ret AuditLogEntryResponseGetRequestRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetRequestAttributeType(arg *AuditLogEntryResponseGetRequestAttributeType, val AuditLogEntryResponseGetRequestRetType) { + *arg = &val +} + +/* + types and functions for resourceId +*/ + +// isNotNullableString +type AuditLogEntryResponseGetResourceIdAttributeType = *string + +func getAuditLogEntryResponseGetResourceIdAttributeTypeOk(arg AuditLogEntryResponseGetResourceIdAttributeType) (ret AuditLogEntryResponseGetResourceIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetResourceIdAttributeType(arg *AuditLogEntryResponseGetResourceIdAttributeType, val AuditLogEntryResponseGetResourceIdRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetResourceIdArgType = string +type AuditLogEntryResponseGetResourceIdRetType = string + +/* + types and functions for resourceName +*/ + +// isNotNullableString +type AuditLogEntryResponseGetResourceNameAttributeType = *string + +func getAuditLogEntryResponseGetResourceNameAttributeTypeOk(arg AuditLogEntryResponseGetResourceNameAttributeType) (ret AuditLogEntryResponseGetResourceNameRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetResourceNameAttributeType(arg *AuditLogEntryResponseGetResourceNameAttributeType, val AuditLogEntryResponseGetResourceNameRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetResourceNameArgType = string +type AuditLogEntryResponseGetResourceNameRetType = string + +/* + types and functions for result +*/ + +// isFreeform +type AuditLogEntryResponseGetResultAttributeType = *map[string]interface{} +type AuditLogEntryResponseGetResultArgType = map[string]interface{} +type AuditLogEntryResponseGetResultRetType = map[string]interface{} + +func getAuditLogEntryResponseGetResultAttributeTypeOk(arg AuditLogEntryResponseGetResultAttributeType) (ret AuditLogEntryResponseGetResultRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetResultAttributeType(arg *AuditLogEntryResponseGetResultAttributeType, val AuditLogEntryResponseGetResultRetType) { + *arg = &val +} + +/* + types and functions for serviceAccountDelegationInfo +*/ + +// isModel +type AuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType = *AuditLogEntryServiceAccountDelegationInfoResponse +type AuditLogEntryResponseGetServiceAccountDelegationInfoArgType = AuditLogEntryServiceAccountDelegationInfoResponse +type AuditLogEntryResponseGetServiceAccountDelegationInfoRetType = AuditLogEntryServiceAccountDelegationInfoResponse + +func getAuditLogEntryResponseGetServiceAccountDelegationInfoAttributeTypeOk(arg AuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType) (ret AuditLogEntryResponseGetServiceAccountDelegationInfoRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType(arg *AuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType, val AuditLogEntryResponseGetServiceAccountDelegationInfoRetType) { + *arg = &val +} + +/* + types and functions for severity +*/ + +// isEnum + +// AuditLogEntryResponseSeverity The severity of this request. +// value type for enums +type AuditLogEntryResponseSeverity string + +// List of Severity +const ( + AUDITLOGENTRYRESPONSESEVERITY_INFO AuditLogEntryResponseSeverity = "INFO" + AUDITLOGENTRYRESPONSESEVERITY_ERROR AuditLogEntryResponseSeverity = "ERROR" +) + +// All allowed values of AuditLogEntryResponse enum +var AllowedAuditLogEntryResponseSeverityEnumValues = []AuditLogEntryResponseSeverity{ + "INFO", + "ERROR", +} + +func (v *AuditLogEntryResponseSeverity) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AuditLogEntryResponseSeverity + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AuditLogEntryResponseSeverity(value) + for _, existing := range AllowedAuditLogEntryResponseSeverityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AuditLogEntryResponse", value) +} + +// NewAuditLogEntryResponseSeverityFromValue returns a pointer to a valid AuditLogEntryResponseSeverity +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuditLogEntryResponseSeverityFromValue(v AuditLogEntryResponseSeverity) (*AuditLogEntryResponseSeverity, error) { + ev := AuditLogEntryResponseSeverity(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuditLogEntryResponseSeverity: valid values are %v", v, AllowedAuditLogEntryResponseSeverityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuditLogEntryResponseSeverity) IsValid() bool { + for _, existing := range AllowedAuditLogEntryResponseSeverityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to SeveritySeverity value +func (v AuditLogEntryResponseSeverity) Ptr() *AuditLogEntryResponseSeverity { + return &v +} + +type NullableAuditLogEntryResponseSeverity struct { + value *AuditLogEntryResponseSeverity + isSet bool +} + +func (v NullableAuditLogEntryResponseSeverity) Get() *AuditLogEntryResponseSeverity { + return v.value +} + +func (v *NullableAuditLogEntryResponseSeverity) Set(val *AuditLogEntryResponseSeverity) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryResponseSeverity) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryResponseSeverity) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryResponseSeverity(val *AuditLogEntryResponseSeverity) *NullableAuditLogEntryResponseSeverity { + return &NullableAuditLogEntryResponseSeverity{value: val, isSet: true} +} + +func (v NullableAuditLogEntryResponseSeverity) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryResponseSeverity) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type AuditLogEntryResponseGetSeverityAttributeType = *AuditLogEntryResponseSeverity +type AuditLogEntryResponseGetSeverityArgType = AuditLogEntryResponseSeverity +type AuditLogEntryResponseGetSeverityRetType = AuditLogEntryResponseSeverity + +func getAuditLogEntryResponseGetSeverityAttributeTypeOk(arg AuditLogEntryResponseGetSeverityAttributeType) (ret AuditLogEntryResponseGetSeverityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetSeverityAttributeType(arg *AuditLogEntryResponseGetSeverityAttributeType, val AuditLogEntryResponseGetSeverityRetType) { + *arg = &val +} + +/* + types and functions for sourceIpAddress +*/ + +// isNotNullableString +type AuditLogEntryResponseGetSourceIpAddressAttributeType = *string + +func getAuditLogEntryResponseGetSourceIpAddressAttributeTypeOk(arg AuditLogEntryResponseGetSourceIpAddressAttributeType) (ret AuditLogEntryResponseGetSourceIpAddressRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetSourceIpAddressAttributeType(arg *AuditLogEntryResponseGetSourceIpAddressAttributeType, val AuditLogEntryResponseGetSourceIpAddressRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetSourceIpAddressArgType = string +type AuditLogEntryResponseGetSourceIpAddressRetType = string + +/* + types and functions for userAgent +*/ + +// isNotNullableString +type AuditLogEntryResponseGetUserAgentAttributeType = *string + +func getAuditLogEntryResponseGetUserAgentAttributeTypeOk(arg AuditLogEntryResponseGetUserAgentAttributeType) (ret AuditLogEntryResponseGetUserAgentRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetUserAgentAttributeType(arg *AuditLogEntryResponseGetUserAgentAttributeType, val AuditLogEntryResponseGetUserAgentRetType) { + *arg = &val +} + +type AuditLogEntryResponseGetUserAgentArgType = string +type AuditLogEntryResponseGetUserAgentRetType = string + +/* + types and functions for visibility +*/ + +// isEnum + +// AuditLogEntryResponseVisibility PUBLIC for entries that are intended for end users, while PRIVATE entries can only be viewed with system privileges. +// value type for enums +type AuditLogEntryResponseVisibility string + +// List of Visibility +const ( + AUDITLOGENTRYRESPONSEVISIBILITY_PUBLIC AuditLogEntryResponseVisibility = "PUBLIC" + AUDITLOGENTRYRESPONSEVISIBILITY_PRIVATE AuditLogEntryResponseVisibility = "PRIVATE" +) + +// All allowed values of AuditLogEntryResponse enum +var AllowedAuditLogEntryResponseVisibilityEnumValues = []AuditLogEntryResponseVisibility{ + "PUBLIC", + "PRIVATE", +} + +func (v *AuditLogEntryResponseVisibility) UnmarshalJSON(src []byte) error { + // use a type alias to prevent infinite recursion during unmarshal, + // see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers + type TmpJson AuditLogEntryResponseVisibility + var value TmpJson + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + // Allow unmarshalling zero value for testing purposes + var zeroValue TmpJson + if value == zeroValue { + return nil + } + enumTypeValue := AuditLogEntryResponseVisibility(value) + for _, existing := range AllowedAuditLogEntryResponseVisibilityEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid AuditLogEntryResponse", value) +} + +// NewAuditLogEntryResponseVisibilityFromValue returns a pointer to a valid AuditLogEntryResponseVisibility +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewAuditLogEntryResponseVisibilityFromValue(v AuditLogEntryResponseVisibility) (*AuditLogEntryResponseVisibility, error) { + ev := AuditLogEntryResponseVisibility(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for AuditLogEntryResponseVisibility: valid values are %v", v, AllowedAuditLogEntryResponseVisibilityEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v AuditLogEntryResponseVisibility) IsValid() bool { + for _, existing := range AllowedAuditLogEntryResponseVisibilityEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to VisibilityVisibility value +func (v AuditLogEntryResponseVisibility) Ptr() *AuditLogEntryResponseVisibility { + return &v +} + +type NullableAuditLogEntryResponseVisibility struct { + value *AuditLogEntryResponseVisibility + isSet bool +} + +func (v NullableAuditLogEntryResponseVisibility) Get() *AuditLogEntryResponseVisibility { + return v.value +} + +func (v *NullableAuditLogEntryResponseVisibility) Set(val *AuditLogEntryResponseVisibility) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryResponseVisibility) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryResponseVisibility) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryResponseVisibility(val *AuditLogEntryResponseVisibility) *NullableAuditLogEntryResponseVisibility { + return &NullableAuditLogEntryResponseVisibility{value: val, isSet: true} +} + +func (v NullableAuditLogEntryResponseVisibility) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryResponseVisibility) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type AuditLogEntryResponseGetVisibilityAttributeType = *AuditLogEntryResponseVisibility +type AuditLogEntryResponseGetVisibilityArgType = AuditLogEntryResponseVisibility +type AuditLogEntryResponseGetVisibilityRetType = AuditLogEntryResponseVisibility + +func getAuditLogEntryResponseGetVisibilityAttributeTypeOk(arg AuditLogEntryResponseGetVisibilityAttributeType) (ret AuditLogEntryResponseGetVisibilityRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryResponseGetVisibilityAttributeType(arg *AuditLogEntryResponseGetVisibilityAttributeType, val AuditLogEntryResponseGetVisibilityRetType) { + *arg = &val +} + +// AuditLogEntryResponse struct for AuditLogEntryResponse +type AuditLogEntryResponse struct { + Context AuditLogEntryResponseGetContextAttributeType `json:"context,omitempty"` + // Unique ID which identifies the request from the sender point of view. + CorrelationId AuditLogEntryResponseGetCorrelationIdAttributeType `json:"correlationId,omitempty"` + // Additional information about the event that is not part of the request or response. May contain arbitrary data. + Details AuditLogEntryResponseGetDetailsAttributeType `json:"details,omitempty"` + // Name of the operation this event represents. + // REQUIRED + EventName AuditLogEntryResponseGetEventNameAttributeType `json:"eventName" required:"true"` + // The service in which the causing event was handled. + // REQUIRED + EventSource AuditLogEntryResponseGetEventSourceAttributeType `json:"eventSource" required:"true"` + // Timestamp at which the event was triggered. + // REQUIRED + EventTimeStamp AuditLogEntryResponseGetEventTimeStampAttributeType `json:"eventTimeStamp" required:"true"` + // Type that can be assigned to the event. For example, an event \"Organization created\" can be assigned to the type ADMIN_EVENT + // REQUIRED + EventType AuditLogEntryResponseGetEventTypeAttributeType `json:"eventType" required:"true"` + // Version of the log event format. + // REQUIRED + EventVersion AuditLogEntryResponseGetEventVersionAttributeType `json:"eventVersion" required:"true"` + // Unique ID generated by the audit log. + // REQUIRED + Id AuditLogEntryResponseGetIdAttributeType `json:"id" required:"true"` + // REQUIRED + Initiator AuditLogEntryResponseGetInitiatorAttributeType `json:"initiator" required:"true"` + // Timestamp at which the event was received by the audit log. + // REQUIRED + ReceivedTimeStamp AuditLogEntryResponseGetReceivedTimeStampAttributeType `json:"receivedTimeStamp" required:"true"` + // Region from which the event has been emitted. + // REQUIRED + Region AuditLogEntryResponseGetRegionAttributeType `json:"region" required:"true"` + // REQUIRED + Request AuditLogEntryResponseGetRequestAttributeType `json:"request" required:"true"` + // Unique id of the resource that is target of the operation + ResourceId AuditLogEntryResponseGetResourceIdAttributeType `json:"resourceId,omitempty"` + // Name of the resource that is target of the operation + ResourceName AuditLogEntryResponseGetResourceNameAttributeType `json:"resourceName,omitempty"` + // Object representing the change resulting from this event. May be omitted if no change has been applied. May contain arbitrary data. + Result AuditLogEntryResponseGetResultAttributeType `json:"result,omitempty"` + ServiceAccountDelegationInfo AuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType `json:"serviceAccountDelegationInfo,omitempty"` + // The severity of this request. + // REQUIRED + Severity AuditLogEntryResponseGetSeverityAttributeType `json:"severity" required:"true"` + // IP address that the request was made from + // REQUIRED + SourceIpAddress AuditLogEntryResponseGetSourceIpAddressAttributeType `json:"sourceIpAddress" required:"true"` + // Agent through which the request was made from (e.g. Portal, CLI, SDK, ...) + // REQUIRED + UserAgent AuditLogEntryResponseGetUserAgentAttributeType `json:"userAgent" required:"true"` + // PUBLIC for entries that are intended for end users, while PRIVATE entries can only be viewed with system privileges. + // REQUIRED + Visibility AuditLogEntryResponseGetVisibilityAttributeType `json:"visibility" required:"true"` +} + +type _AuditLogEntryResponse AuditLogEntryResponse + +// NewAuditLogEntryResponse instantiates a new AuditLogEntryResponse 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 NewAuditLogEntryResponse(eventName AuditLogEntryResponseGetEventNameArgType, eventSource AuditLogEntryResponseGetEventSourceArgType, eventTimeStamp AuditLogEntryResponseGetEventTimeStampArgType, eventType AuditLogEntryResponseGetEventTypeArgType, eventVersion AuditLogEntryResponseGetEventVersionArgType, id AuditLogEntryResponseGetIdArgType, initiator AuditLogEntryResponseGetInitiatorArgType, receivedTimeStamp AuditLogEntryResponseGetReceivedTimeStampArgType, region AuditLogEntryResponseGetRegionArgType, request AuditLogEntryResponseGetRequestArgType, severity AuditLogEntryResponseGetSeverityArgType, sourceIpAddress AuditLogEntryResponseGetSourceIpAddressArgType, userAgent AuditLogEntryResponseGetUserAgentArgType, visibility AuditLogEntryResponseGetVisibilityArgType) *AuditLogEntryResponse { + this := AuditLogEntryResponse{} + setAuditLogEntryResponseGetEventNameAttributeType(&this.EventName, eventName) + setAuditLogEntryResponseGetEventSourceAttributeType(&this.EventSource, eventSource) + setAuditLogEntryResponseGetEventTimeStampAttributeType(&this.EventTimeStamp, eventTimeStamp) + setAuditLogEntryResponseGetEventTypeAttributeType(&this.EventType, eventType) + setAuditLogEntryResponseGetEventVersionAttributeType(&this.EventVersion, eventVersion) + setAuditLogEntryResponseGetIdAttributeType(&this.Id, id) + setAuditLogEntryResponseGetInitiatorAttributeType(&this.Initiator, initiator) + setAuditLogEntryResponseGetReceivedTimeStampAttributeType(&this.ReceivedTimeStamp, receivedTimeStamp) + setAuditLogEntryResponseGetRegionAttributeType(&this.Region, region) + setAuditLogEntryResponseGetRequestAttributeType(&this.Request, request) + setAuditLogEntryResponseGetSeverityAttributeType(&this.Severity, severity) + setAuditLogEntryResponseGetSourceIpAddressAttributeType(&this.SourceIpAddress, sourceIpAddress) + setAuditLogEntryResponseGetUserAgentAttributeType(&this.UserAgent, userAgent) + setAuditLogEntryResponseGetVisibilityAttributeType(&this.Visibility, visibility) + return &this +} + +// NewAuditLogEntryResponseWithDefaults instantiates a new AuditLogEntryResponse 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 NewAuditLogEntryResponseWithDefaults() *AuditLogEntryResponse { + this := AuditLogEntryResponse{} + return &this +} + +// GetContext returns the Context field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetContext() (res AuditLogEntryResponseGetContextRetType) { + res, _ = o.GetContextOk() + return +} + +// GetContextOk returns a tuple with the Context field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetContextOk() (ret AuditLogEntryResponseGetContextRetType, ok bool) { + return getAuditLogEntryResponseGetContextAttributeTypeOk(o.Context) +} + +// HasContext returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasContext() bool { + _, ok := o.GetContextOk() + return ok +} + +// SetContext gets a reference to the given AuditLogEntryContextResponse and assigns it to the Context field. +func (o *AuditLogEntryResponse) SetContext(v AuditLogEntryResponseGetContextRetType) { + setAuditLogEntryResponseGetContextAttributeType(&o.Context, v) +} + +// GetCorrelationId returns the CorrelationId field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetCorrelationId() (res AuditLogEntryResponseGetCorrelationIdRetType) { + res, _ = o.GetCorrelationIdOk() + return +} + +// GetCorrelationIdOk returns a tuple with the CorrelationId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetCorrelationIdOk() (ret AuditLogEntryResponseGetCorrelationIdRetType, ok bool) { + return getAuditLogEntryResponseGetCorrelationIdAttributeTypeOk(o.CorrelationId) +} + +// HasCorrelationId returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasCorrelationId() bool { + _, ok := o.GetCorrelationIdOk() + return ok +} + +// SetCorrelationId gets a reference to the given string and assigns it to the CorrelationId field. +func (o *AuditLogEntryResponse) SetCorrelationId(v AuditLogEntryResponseGetCorrelationIdRetType) { + setAuditLogEntryResponseGetCorrelationIdAttributeType(&o.CorrelationId, v) +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetDetails() (res AuditLogEntryResponseGetDetailsRetType) { + res, _ = o.GetDetailsOk() + return +} + +// 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 *AuditLogEntryResponse) GetDetailsOk() (ret AuditLogEntryResponseGetDetailsRetType, ok bool) { + return getAuditLogEntryResponseGetDetailsAttributeTypeOk(o.Details) +} + +// HasDetails returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasDetails() bool { + _, ok := o.GetDetailsOk() + return ok +} + +// SetDetails gets a reference to the given map[string]interface{} and assigns it to the Details field. +func (o *AuditLogEntryResponse) SetDetails(v AuditLogEntryResponseGetDetailsRetType) { + setAuditLogEntryResponseGetDetailsAttributeType(&o.Details, v) +} + +// GetEventName returns the EventName field value +func (o *AuditLogEntryResponse) GetEventName() (ret AuditLogEntryResponseGetEventNameRetType) { + ret, _ = o.GetEventNameOk() + return ret +} + +// GetEventNameOk returns a tuple with the EventName field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetEventNameOk() (ret AuditLogEntryResponseGetEventNameRetType, ok bool) { + return getAuditLogEntryResponseGetEventNameAttributeTypeOk(o.EventName) +} + +// SetEventName sets field value +func (o *AuditLogEntryResponse) SetEventName(v AuditLogEntryResponseGetEventNameRetType) { + setAuditLogEntryResponseGetEventNameAttributeType(&o.EventName, v) +} + +// GetEventSource returns the EventSource field value +func (o *AuditLogEntryResponse) GetEventSource() (ret AuditLogEntryResponseGetEventSourceRetType) { + ret, _ = o.GetEventSourceOk() + return ret +} + +// GetEventSourceOk returns a tuple with the EventSource field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetEventSourceOk() (ret AuditLogEntryResponseGetEventSourceRetType, ok bool) { + return getAuditLogEntryResponseGetEventSourceAttributeTypeOk(o.EventSource) +} + +// SetEventSource sets field value +func (o *AuditLogEntryResponse) SetEventSource(v AuditLogEntryResponseGetEventSourceRetType) { + setAuditLogEntryResponseGetEventSourceAttributeType(&o.EventSource, v) +} + +// GetEventTimeStamp returns the EventTimeStamp field value +func (o *AuditLogEntryResponse) GetEventTimeStamp() (ret AuditLogEntryResponseGetEventTimeStampRetType) { + ret, _ = o.GetEventTimeStampOk() + return ret +} + +// GetEventTimeStampOk returns a tuple with the EventTimeStamp field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetEventTimeStampOk() (ret AuditLogEntryResponseGetEventTimeStampRetType, ok bool) { + return getAuditLogEntryResponseGetEventTimeStampAttributeTypeOk(o.EventTimeStamp) +} + +// SetEventTimeStamp sets field value +func (o *AuditLogEntryResponse) SetEventTimeStamp(v AuditLogEntryResponseGetEventTimeStampRetType) { + setAuditLogEntryResponseGetEventTimeStampAttributeType(&o.EventTimeStamp, v) +} + +// GetEventType returns the EventType field value +func (o *AuditLogEntryResponse) GetEventType() (ret AuditLogEntryResponseGetEventTypeRetType) { + ret, _ = o.GetEventTypeOk() + return ret +} + +// GetEventTypeOk returns a tuple with the EventType field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetEventTypeOk() (ret AuditLogEntryResponseGetEventTypeRetType, ok bool) { + return getAuditLogEntryResponseGetEventTypeAttributeTypeOk(o.EventType) +} + +// SetEventType sets field value +func (o *AuditLogEntryResponse) SetEventType(v AuditLogEntryResponseGetEventTypeRetType) { + setAuditLogEntryResponseGetEventTypeAttributeType(&o.EventType, v) +} + +// GetEventVersion returns the EventVersion field value +func (o *AuditLogEntryResponse) GetEventVersion() (ret AuditLogEntryResponseGetEventVersionRetType) { + ret, _ = o.GetEventVersionOk() + return ret +} + +// GetEventVersionOk returns a tuple with the EventVersion field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetEventVersionOk() (ret AuditLogEntryResponseGetEventVersionRetType, ok bool) { + return getAuditLogEntryResponseGetEventVersionAttributeTypeOk(o.EventVersion) +} + +// SetEventVersion sets field value +func (o *AuditLogEntryResponse) SetEventVersion(v AuditLogEntryResponseGetEventVersionRetType) { + setAuditLogEntryResponseGetEventVersionAttributeType(&o.EventVersion, v) +} + +// GetId returns the Id field value +func (o *AuditLogEntryResponse) GetId() (ret AuditLogEntryResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetIdOk() (ret AuditLogEntryResponseGetIdRetType, ok bool) { + return getAuditLogEntryResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *AuditLogEntryResponse) SetId(v AuditLogEntryResponseGetIdRetType) { + setAuditLogEntryResponseGetIdAttributeType(&o.Id, v) +} + +// GetInitiator returns the Initiator field value +func (o *AuditLogEntryResponse) GetInitiator() (ret AuditLogEntryResponseGetInitiatorRetType) { + ret, _ = o.GetInitiatorOk() + return ret +} + +// GetInitiatorOk returns a tuple with the Initiator field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetInitiatorOk() (ret AuditLogEntryResponseGetInitiatorRetType, ok bool) { + return getAuditLogEntryResponseGetInitiatorAttributeTypeOk(o.Initiator) +} + +// SetInitiator sets field value +func (o *AuditLogEntryResponse) SetInitiator(v AuditLogEntryResponseGetInitiatorRetType) { + setAuditLogEntryResponseGetInitiatorAttributeType(&o.Initiator, v) +} + +// GetReceivedTimeStamp returns the ReceivedTimeStamp field value +func (o *AuditLogEntryResponse) GetReceivedTimeStamp() (ret AuditLogEntryResponseGetReceivedTimeStampRetType) { + ret, _ = o.GetReceivedTimeStampOk() + return ret +} + +// GetReceivedTimeStampOk returns a tuple with the ReceivedTimeStamp field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetReceivedTimeStampOk() (ret AuditLogEntryResponseGetReceivedTimeStampRetType, ok bool) { + return getAuditLogEntryResponseGetReceivedTimeStampAttributeTypeOk(o.ReceivedTimeStamp) +} + +// SetReceivedTimeStamp sets field value +func (o *AuditLogEntryResponse) SetReceivedTimeStamp(v AuditLogEntryResponseGetReceivedTimeStampRetType) { + setAuditLogEntryResponseGetReceivedTimeStampAttributeType(&o.ReceivedTimeStamp, v) +} + +// GetRegion returns the Region field value +func (o *AuditLogEntryResponse) GetRegion() (ret AuditLogEntryResponseGetRegionRetType) { + ret, _ = o.GetRegionOk() + return ret +} + +// GetRegionOk returns a tuple with the Region field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetRegionOk() (ret AuditLogEntryResponseGetRegionRetType, ok bool) { + return getAuditLogEntryResponseGetRegionAttributeTypeOk(o.Region) +} + +// SetRegion sets field value +func (o *AuditLogEntryResponse) SetRegion(v AuditLogEntryResponseGetRegionRetType) { + setAuditLogEntryResponseGetRegionAttributeType(&o.Region, v) +} + +// GetRequest returns the Request field value +func (o *AuditLogEntryResponse) GetRequest() (ret AuditLogEntryResponseGetRequestRetType) { + ret, _ = o.GetRequestOk() + return ret +} + +// GetRequestOk returns a tuple with the Request field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetRequestOk() (ret AuditLogEntryResponseGetRequestRetType, ok bool) { + return getAuditLogEntryResponseGetRequestAttributeTypeOk(o.Request) +} + +// SetRequest sets field value +func (o *AuditLogEntryResponse) SetRequest(v AuditLogEntryResponseGetRequestRetType) { + setAuditLogEntryResponseGetRequestAttributeType(&o.Request, v) +} + +// GetResourceId returns the ResourceId field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetResourceId() (res AuditLogEntryResponseGetResourceIdRetType) { + res, _ = o.GetResourceIdOk() + return +} + +// GetResourceIdOk returns a tuple with the ResourceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetResourceIdOk() (ret AuditLogEntryResponseGetResourceIdRetType, ok bool) { + return getAuditLogEntryResponseGetResourceIdAttributeTypeOk(o.ResourceId) +} + +// HasResourceId returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasResourceId() bool { + _, ok := o.GetResourceIdOk() + return ok +} + +// SetResourceId gets a reference to the given string and assigns it to the ResourceId field. +func (o *AuditLogEntryResponse) SetResourceId(v AuditLogEntryResponseGetResourceIdRetType) { + setAuditLogEntryResponseGetResourceIdAttributeType(&o.ResourceId, v) +} + +// GetResourceName returns the ResourceName field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetResourceName() (res AuditLogEntryResponseGetResourceNameRetType) { + res, _ = o.GetResourceNameOk() + return +} + +// GetResourceNameOk returns a tuple with the ResourceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetResourceNameOk() (ret AuditLogEntryResponseGetResourceNameRetType, ok bool) { + return getAuditLogEntryResponseGetResourceNameAttributeTypeOk(o.ResourceName) +} + +// HasResourceName returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasResourceName() bool { + _, ok := o.GetResourceNameOk() + return ok +} + +// SetResourceName gets a reference to the given string and assigns it to the ResourceName field. +func (o *AuditLogEntryResponse) SetResourceName(v AuditLogEntryResponseGetResourceNameRetType) { + setAuditLogEntryResponseGetResourceNameAttributeType(&o.ResourceName, v) +} + +// GetResult returns the Result field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetResult() (res AuditLogEntryResponseGetResultRetType) { + res, _ = o.GetResultOk() + return +} + +// GetResultOk returns a tuple with the Result field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetResultOk() (ret AuditLogEntryResponseGetResultRetType, ok bool) { + return getAuditLogEntryResponseGetResultAttributeTypeOk(o.Result) +} + +// HasResult returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasResult() bool { + _, ok := o.GetResultOk() + return ok +} + +// SetResult gets a reference to the given map[string]interface{} and assigns it to the Result field. +func (o *AuditLogEntryResponse) SetResult(v AuditLogEntryResponseGetResultRetType) { + setAuditLogEntryResponseGetResultAttributeType(&o.Result, v) +} + +// GetServiceAccountDelegationInfo returns the ServiceAccountDelegationInfo field value if set, zero value otherwise. +func (o *AuditLogEntryResponse) GetServiceAccountDelegationInfo() (res AuditLogEntryResponseGetServiceAccountDelegationInfoRetType) { + res, _ = o.GetServiceAccountDelegationInfoOk() + return +} + +// GetServiceAccountDelegationInfoOk returns a tuple with the ServiceAccountDelegationInfo field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetServiceAccountDelegationInfoOk() (ret AuditLogEntryResponseGetServiceAccountDelegationInfoRetType, ok bool) { + return getAuditLogEntryResponseGetServiceAccountDelegationInfoAttributeTypeOk(o.ServiceAccountDelegationInfo) +} + +// HasServiceAccountDelegationInfo returns a boolean if a field has been set. +func (o *AuditLogEntryResponse) HasServiceAccountDelegationInfo() bool { + _, ok := o.GetServiceAccountDelegationInfoOk() + return ok +} + +// SetServiceAccountDelegationInfo gets a reference to the given AuditLogEntryServiceAccountDelegationInfoResponse and assigns it to the ServiceAccountDelegationInfo field. +func (o *AuditLogEntryResponse) SetServiceAccountDelegationInfo(v AuditLogEntryResponseGetServiceAccountDelegationInfoRetType) { + setAuditLogEntryResponseGetServiceAccountDelegationInfoAttributeType(&o.ServiceAccountDelegationInfo, v) +} + +// GetSeverity returns the Severity field value +func (o *AuditLogEntryResponse) GetSeverity() (ret AuditLogEntryResponseGetSeverityRetType) { + ret, _ = o.GetSeverityOk() + return ret +} + +// GetSeverityOk returns a tuple with the Severity field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetSeverityOk() (ret AuditLogEntryResponseGetSeverityRetType, ok bool) { + return getAuditLogEntryResponseGetSeverityAttributeTypeOk(o.Severity) +} + +// SetSeverity sets field value +func (o *AuditLogEntryResponse) SetSeverity(v AuditLogEntryResponseGetSeverityRetType) { + setAuditLogEntryResponseGetSeverityAttributeType(&o.Severity, v) +} + +// GetSourceIpAddress returns the SourceIpAddress field value +func (o *AuditLogEntryResponse) GetSourceIpAddress() (ret AuditLogEntryResponseGetSourceIpAddressRetType) { + ret, _ = o.GetSourceIpAddressOk() + return ret +} + +// GetSourceIpAddressOk returns a tuple with the SourceIpAddress field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetSourceIpAddressOk() (ret AuditLogEntryResponseGetSourceIpAddressRetType, ok bool) { + return getAuditLogEntryResponseGetSourceIpAddressAttributeTypeOk(o.SourceIpAddress) +} + +// SetSourceIpAddress sets field value +func (o *AuditLogEntryResponse) SetSourceIpAddress(v AuditLogEntryResponseGetSourceIpAddressRetType) { + setAuditLogEntryResponseGetSourceIpAddressAttributeType(&o.SourceIpAddress, v) +} + +// GetUserAgent returns the UserAgent field value +func (o *AuditLogEntryResponse) GetUserAgent() (ret AuditLogEntryResponseGetUserAgentRetType) { + ret, _ = o.GetUserAgentOk() + return ret +} + +// GetUserAgentOk returns a tuple with the UserAgent field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetUserAgentOk() (ret AuditLogEntryResponseGetUserAgentRetType, ok bool) { + return getAuditLogEntryResponseGetUserAgentAttributeTypeOk(o.UserAgent) +} + +// SetUserAgent sets field value +func (o *AuditLogEntryResponse) SetUserAgent(v AuditLogEntryResponseGetUserAgentRetType) { + setAuditLogEntryResponseGetUserAgentAttributeType(&o.UserAgent, v) +} + +// GetVisibility returns the Visibility field value +func (o *AuditLogEntryResponse) GetVisibility() (ret AuditLogEntryResponseGetVisibilityRetType) { + ret, _ = o.GetVisibilityOk() + return ret +} + +// GetVisibilityOk returns a tuple with the Visibility field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryResponse) GetVisibilityOk() (ret AuditLogEntryResponseGetVisibilityRetType, ok bool) { + return getAuditLogEntryResponseGetVisibilityAttributeTypeOk(o.Visibility) +} + +// SetVisibility sets field value +func (o *AuditLogEntryResponse) SetVisibility(v AuditLogEntryResponseGetVisibilityRetType) { + setAuditLogEntryResponseGetVisibilityAttributeType(&o.Visibility, v) +} + +func (o AuditLogEntryResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuditLogEntryResponseGetContextAttributeTypeOk(o.Context); ok { + toSerialize["Context"] = val + } + if val, ok := getAuditLogEntryResponseGetCorrelationIdAttributeTypeOk(o.CorrelationId); ok { + toSerialize["CorrelationId"] = val + } + if val, ok := getAuditLogEntryResponseGetDetailsAttributeTypeOk(o.Details); ok { + toSerialize["Details"] = val + } + if val, ok := getAuditLogEntryResponseGetEventNameAttributeTypeOk(o.EventName); ok { + toSerialize["EventName"] = val + } + if val, ok := getAuditLogEntryResponseGetEventSourceAttributeTypeOk(o.EventSource); ok { + toSerialize["EventSource"] = val + } + if val, ok := getAuditLogEntryResponseGetEventTimeStampAttributeTypeOk(o.EventTimeStamp); ok { + toSerialize["EventTimeStamp"] = val + } + if val, ok := getAuditLogEntryResponseGetEventTypeAttributeTypeOk(o.EventType); ok { + toSerialize["EventType"] = val + } + if val, ok := getAuditLogEntryResponseGetEventVersionAttributeTypeOk(o.EventVersion); ok { + toSerialize["EventVersion"] = val + } + if val, ok := getAuditLogEntryResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + if val, ok := getAuditLogEntryResponseGetInitiatorAttributeTypeOk(o.Initiator); ok { + toSerialize["Initiator"] = val + } + if val, ok := getAuditLogEntryResponseGetReceivedTimeStampAttributeTypeOk(o.ReceivedTimeStamp); ok { + toSerialize["ReceivedTimeStamp"] = val + } + if val, ok := getAuditLogEntryResponseGetRegionAttributeTypeOk(o.Region); ok { + toSerialize["Region"] = val + } + if val, ok := getAuditLogEntryResponseGetRequestAttributeTypeOk(o.Request); ok { + toSerialize["Request"] = val + } + if val, ok := getAuditLogEntryResponseGetResourceIdAttributeTypeOk(o.ResourceId); ok { + toSerialize["ResourceId"] = val + } + if val, ok := getAuditLogEntryResponseGetResourceNameAttributeTypeOk(o.ResourceName); ok { + toSerialize["ResourceName"] = val + } + if val, ok := getAuditLogEntryResponseGetResultAttributeTypeOk(o.Result); ok { + toSerialize["Result"] = val + } + if val, ok := getAuditLogEntryResponseGetServiceAccountDelegationInfoAttributeTypeOk(o.ServiceAccountDelegationInfo); ok { + toSerialize["ServiceAccountDelegationInfo"] = val + } + if val, ok := getAuditLogEntryResponseGetSeverityAttributeTypeOk(o.Severity); ok { + toSerialize["Severity"] = val + } + if val, ok := getAuditLogEntryResponseGetSourceIpAddressAttributeTypeOk(o.SourceIpAddress); ok { + toSerialize["SourceIpAddress"] = val + } + if val, ok := getAuditLogEntryResponseGetUserAgentAttributeTypeOk(o.UserAgent); ok { + toSerialize["UserAgent"] = val + } + if val, ok := getAuditLogEntryResponseGetVisibilityAttributeTypeOk(o.Visibility); ok { + toSerialize["Visibility"] = val + } + return toSerialize, nil +} + +type NullableAuditLogEntryResponse struct { + value *AuditLogEntryResponse + isSet bool +} + +func (v NullableAuditLogEntryResponse) Get() *AuditLogEntryResponse { + return v.value +} + +func (v *NullableAuditLogEntryResponse) Set(val *AuditLogEntryResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryResponse(val *AuditLogEntryResponse) *NullableAuditLogEntryResponse { + return &NullableAuditLogEntryResponse{value: val, isSet: true} +} + +func (v NullableAuditLogEntryResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_audit_log_entry_response_test.go b/services/auditlog/model_audit_log_entry_response_test.go new file mode 100644 index 000000000..455e2de45 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_response_test.go @@ -0,0 +1,151 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "testing" +) + +// isEnum + +func TestAuditLogEntryResponseEventType_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"ADMIN_ACTIVITY"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"SYSTEM_EVENT"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 3`, + args: args{ + src: []byte(`"POLICY_DENIED"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AuditLogEntryResponseEventType("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +// isEnum + +func TestAuditLogEntryResponseSeverity_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"INFO"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"ERROR"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AuditLogEntryResponseSeverity("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} + +// isEnum + +func TestAuditLogEntryResponseVisibility_UnmarshalJSON(t *testing.T) { + type args struct { + src []byte + } + tests := []struct { + name string + args args + wantErr bool + }{ + { + name: `success - possible enum value no. 1`, + args: args{ + src: []byte(`"PUBLIC"`), + }, + wantErr: false, + }, + { + name: `success - possible enum value no. 2`, + args: args{ + src: []byte(`"PRIVATE"`), + }, + wantErr: false, + }, + { + name: "fail", + args: args{ + src: []byte("\"FOOBAR\""), + }, + wantErr: true, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + v := AuditLogEntryResponseVisibility("") + if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr { + t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr) + } + }) + } +} diff --git a/services/auditlog/model_audit_log_entry_service_account_delegation_info_response.go b/services/auditlog/model_audit_log_entry_service_account_delegation_info_response.go new file mode 100644 index 000000000..7b00cb86f --- /dev/null +++ b/services/auditlog/model_audit_log_entry_service_account_delegation_info_response.go @@ -0,0 +1,126 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the AuditLogEntryServiceAccountDelegationInfoResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogEntryServiceAccountDelegationInfoResponse{} + +/* + types and functions for principals +*/ + +// isArray +type AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType = *[]ServiceAccountDelegationInfoPrincipalResponse +type AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsArgType = []ServiceAccountDelegationInfoPrincipalResponse +type AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType = []ServiceAccountDelegationInfoPrincipalResponse + +func getAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeTypeOk(arg AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType) (ret AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType(arg *AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType, val AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType) { + *arg = &val +} + +// AuditLogEntryServiceAccountDelegationInfoResponse Information about service account delegation +type AuditLogEntryServiceAccountDelegationInfoResponse struct { + // Delegation chain for the service account + // REQUIRED + Principals AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType `json:"principals" required:"true"` +} + +type _AuditLogEntryServiceAccountDelegationInfoResponse AuditLogEntryServiceAccountDelegationInfoResponse + +// NewAuditLogEntryServiceAccountDelegationInfoResponse instantiates a new AuditLogEntryServiceAccountDelegationInfoResponse 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 NewAuditLogEntryServiceAccountDelegationInfoResponse(principals AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsArgType) *AuditLogEntryServiceAccountDelegationInfoResponse { + this := AuditLogEntryServiceAccountDelegationInfoResponse{} + setAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType(&this.Principals, principals) + return &this +} + +// NewAuditLogEntryServiceAccountDelegationInfoResponseWithDefaults instantiates a new AuditLogEntryServiceAccountDelegationInfoResponse 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 NewAuditLogEntryServiceAccountDelegationInfoResponseWithDefaults() *AuditLogEntryServiceAccountDelegationInfoResponse { + this := AuditLogEntryServiceAccountDelegationInfoResponse{} + return &this +} + +// GetPrincipals returns the Principals field value +func (o *AuditLogEntryServiceAccountDelegationInfoResponse) GetPrincipals() (ret AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType) { + ret, _ = o.GetPrincipalsOk() + return ret +} + +// GetPrincipalsOk returns a tuple with the Principals field value +// and a boolean to check if the value has been set. +func (o *AuditLogEntryServiceAccountDelegationInfoResponse) GetPrincipalsOk() (ret AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType, ok bool) { + return getAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeTypeOk(o.Principals) +} + +// SetPrincipals sets field value +func (o *AuditLogEntryServiceAccountDelegationInfoResponse) SetPrincipals(v AuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsRetType) { + setAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeType(&o.Principals, v) +} + +func (o AuditLogEntryServiceAccountDelegationInfoResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getAuditLogEntryServiceAccountDelegationInfoResponseGetPrincipalsAttributeTypeOk(o.Principals); ok { + toSerialize["Principals"] = val + } + return toSerialize, nil +} + +type NullableAuditLogEntryServiceAccountDelegationInfoResponse struct { + value *AuditLogEntryServiceAccountDelegationInfoResponse + isSet bool +} + +func (v NullableAuditLogEntryServiceAccountDelegationInfoResponse) Get() *AuditLogEntryServiceAccountDelegationInfoResponse { + return v.value +} + +func (v *NullableAuditLogEntryServiceAccountDelegationInfoResponse) Set(val *AuditLogEntryServiceAccountDelegationInfoResponse) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogEntryServiceAccountDelegationInfoResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogEntryServiceAccountDelegationInfoResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogEntryServiceAccountDelegationInfoResponse(val *AuditLogEntryServiceAccountDelegationInfoResponse) *NullableAuditLogEntryServiceAccountDelegationInfoResponse { + return &NullableAuditLogEntryServiceAccountDelegationInfoResponse{value: val, isSet: true} +} + +func (v NullableAuditLogEntryServiceAccountDelegationInfoResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogEntryServiceAccountDelegationInfoResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_audit_log_entry_service_account_delegation_info_response_test.go b/services/auditlog/model_audit_log_entry_service_account_delegation_info_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_audit_log_entry_service_account_delegation_info_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_error_response.go b/services/auditlog/model_error_response.go new file mode 100644 index 000000000..23dced896 --- /dev/null +++ b/services/auditlog/model_error_response.go @@ -0,0 +1,275 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" + "time" +) + +// checks if the ErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ErrorResponse{} + +/* + types and functions for message +*/ + +// isNotNullableString +type ErrorResponseGetMessageAttributeType = *string + +func getErrorResponseGetMessageAttributeTypeOk(arg ErrorResponseGetMessageAttributeType) (ret ErrorResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetMessageAttributeType(arg *ErrorResponseGetMessageAttributeType, val ErrorResponseGetMessageRetType) { + *arg = &val +} + +type ErrorResponseGetMessageArgType = string +type ErrorResponseGetMessageRetType = string + +/* + types and functions for path +*/ + +// isNotNullableString +type ErrorResponseGetPathAttributeType = *string + +func getErrorResponseGetPathAttributeTypeOk(arg ErrorResponseGetPathAttributeType) (ret ErrorResponseGetPathRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetPathAttributeType(arg *ErrorResponseGetPathAttributeType, val ErrorResponseGetPathRetType) { + *arg = &val +} + +type ErrorResponseGetPathArgType = string +type ErrorResponseGetPathRetType = string + +/* + types and functions for status +*/ + +// isNumber +type ErrorResponseGetStatusAttributeType = *float64 +type ErrorResponseGetStatusArgType = float64 +type ErrorResponseGetStatusRetType = float64 + +func getErrorResponseGetStatusAttributeTypeOk(arg ErrorResponseGetStatusAttributeType) (ret ErrorResponseGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetStatusAttributeType(arg *ErrorResponseGetStatusAttributeType, val ErrorResponseGetStatusRetType) { + *arg = &val +} + +/* + types and functions for timestamp +*/ + +// isDateTime +type ErrorResponseGetTimestampAttributeType = *time.Time +type ErrorResponseGetTimestampArgType = time.Time +type ErrorResponseGetTimestampRetType = time.Time + +func getErrorResponseGetTimestampAttributeTypeOk(arg ErrorResponseGetTimestampAttributeType) (ret ErrorResponseGetTimestampRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setErrorResponseGetTimestampAttributeType(arg *ErrorResponseGetTimestampAttributeType, val ErrorResponseGetTimestampRetType) { + *arg = &val +} + +// ErrorResponse struct for ErrorResponse +type ErrorResponse struct { + // Description of the error. + Message ErrorResponseGetMessageAttributeType `json:"message,omitempty"` + // Path which was called. + Path ErrorResponseGetPathAttributeType `json:"path,omitempty"` + // Http status code. + Status ErrorResponseGetStatusAttributeType `json:"status,omitempty"` + // Timestamp at which the error occurred. + Timestamp ErrorResponseGetTimestampAttributeType `json:"timestamp,omitempty"` +} + +// NewErrorResponse instantiates a new ErrorResponse 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 NewErrorResponse() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// NewErrorResponseWithDefaults instantiates a new ErrorResponse 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 NewErrorResponseWithDefaults() *ErrorResponse { + this := ErrorResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *ErrorResponse) GetMessage() (res ErrorResponseGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetMessageOk() (ret ErrorResponseGetMessageRetType, ok bool) { + return getErrorResponseGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *ErrorResponse) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *ErrorResponse) SetMessage(v ErrorResponseGetMessageRetType) { + setErrorResponseGetMessageAttributeType(&o.Message, v) +} + +// GetPath returns the Path field value if set, zero value otherwise. +func (o *ErrorResponse) GetPath() (res ErrorResponseGetPathRetType) { + res, _ = o.GetPathOk() + return +} + +// 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 *ErrorResponse) GetPathOk() (ret ErrorResponseGetPathRetType, ok bool) { + return getErrorResponseGetPathAttributeTypeOk(o.Path) +} + +// HasPath returns a boolean if a field has been set. +func (o *ErrorResponse) HasPath() bool { + _, ok := o.GetPathOk() + return ok +} + +// SetPath gets a reference to the given string and assigns it to the Path field. +func (o *ErrorResponse) SetPath(v ErrorResponseGetPathRetType) { + setErrorResponseGetPathAttributeType(&o.Path, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *ErrorResponse) GetStatus() (res ErrorResponseGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetStatusOk() (ret ErrorResponseGetStatusRetType, ok bool) { + return getErrorResponseGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *ErrorResponse) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given float64 and assigns it to the Status field. +func (o *ErrorResponse) SetStatus(v ErrorResponseGetStatusRetType) { + setErrorResponseGetStatusAttributeType(&o.Status, v) +} + +// GetTimestamp returns the Timestamp field value if set, zero value otherwise. +func (o *ErrorResponse) GetTimestamp() (res ErrorResponseGetTimestampRetType) { + res, _ = o.GetTimestampOk() + return +} + +// GetTimestampOk returns a tuple with the Timestamp field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ErrorResponse) GetTimestampOk() (ret ErrorResponseGetTimestampRetType, ok bool) { + return getErrorResponseGetTimestampAttributeTypeOk(o.Timestamp) +} + +// HasTimestamp returns a boolean if a field has been set. +func (o *ErrorResponse) HasTimestamp() bool { + _, ok := o.GetTimestampOk() + return ok +} + +// SetTimestamp gets a reference to the given time.Time and assigns it to the Timestamp field. +func (o *ErrorResponse) SetTimestamp(v ErrorResponseGetTimestampRetType) { + setErrorResponseGetTimestampAttributeType(&o.Timestamp, v) +} + +func (o ErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getErrorResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + if val, ok := getErrorResponseGetPathAttributeTypeOk(o.Path); ok { + toSerialize["Path"] = val + } + if val, ok := getErrorResponseGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + if val, ok := getErrorResponseGetTimestampAttributeTypeOk(o.Timestamp); ok { + toSerialize["Timestamp"] = val + } + return toSerialize, nil +} + +type NullableErrorResponse struct { + value *ErrorResponse + isSet bool +} + +func (v NullableErrorResponse) Get() *ErrorResponse { + return v.value +} + +func (v *NullableErrorResponse) Set(val *ErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableErrorResponse(val *ErrorResponse) *NullableErrorResponse { + return &NullableErrorResponse{value: val, isSet: true} +} + +func (v NullableErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_error_response_test.go b/services/auditlog/model_error_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_error_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_gateway_error_response.go b/services/auditlog/model_gateway_error_response.go new file mode 100644 index 000000000..1684ad44f --- /dev/null +++ b/services/auditlog/model_gateway_error_response.go @@ -0,0 +1,177 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the GatewayErrorResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GatewayErrorResponse{} + +/* + types and functions for message +*/ + +// isNotNullableString +type GatewayErrorResponseGetMessageAttributeType = *string + +func getGatewayErrorResponseGetMessageAttributeTypeOk(arg GatewayErrorResponseGetMessageAttributeType) (ret GatewayErrorResponseGetMessageRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayErrorResponseGetMessageAttributeType(arg *GatewayErrorResponseGetMessageAttributeType, val GatewayErrorResponseGetMessageRetType) { + *arg = &val +} + +type GatewayErrorResponseGetMessageArgType = string +type GatewayErrorResponseGetMessageRetType = string + +/* + types and functions for status +*/ + +// isNumber +type GatewayErrorResponseGetStatusAttributeType = *float64 +type GatewayErrorResponseGetStatusArgType = float64 +type GatewayErrorResponseGetStatusRetType = float64 + +func getGatewayErrorResponseGetStatusAttributeTypeOk(arg GatewayErrorResponseGetStatusAttributeType) (ret GatewayErrorResponseGetStatusRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setGatewayErrorResponseGetStatusAttributeType(arg *GatewayErrorResponseGetStatusAttributeType, val GatewayErrorResponseGetStatusRetType) { + *arg = &val +} + +// GatewayErrorResponse struct for GatewayErrorResponse +type GatewayErrorResponse struct { + // Description of the error. + Message GatewayErrorResponseGetMessageAttributeType `json:"message,omitempty"` + // Http status code. + Status GatewayErrorResponseGetStatusAttributeType `json:"status,omitempty"` +} + +// NewGatewayErrorResponse instantiates a new GatewayErrorResponse 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 NewGatewayErrorResponse() *GatewayErrorResponse { + this := GatewayErrorResponse{} + return &this +} + +// NewGatewayErrorResponseWithDefaults instantiates a new GatewayErrorResponse 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 NewGatewayErrorResponseWithDefaults() *GatewayErrorResponse { + this := GatewayErrorResponse{} + return &this +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *GatewayErrorResponse) GetMessage() (res GatewayErrorResponseGetMessageRetType) { + res, _ = o.GetMessageOk() + return +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayErrorResponse) GetMessageOk() (ret GatewayErrorResponseGetMessageRetType, ok bool) { + return getGatewayErrorResponseGetMessageAttributeTypeOk(o.Message) +} + +// HasMessage returns a boolean if a field has been set. +func (o *GatewayErrorResponse) HasMessage() bool { + _, ok := o.GetMessageOk() + return ok +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *GatewayErrorResponse) SetMessage(v GatewayErrorResponseGetMessageRetType) { + setGatewayErrorResponseGetMessageAttributeType(&o.Message, v) +} + +// GetStatus returns the Status field value if set, zero value otherwise. +func (o *GatewayErrorResponse) GetStatus() (res GatewayErrorResponseGetStatusRetType) { + res, _ = o.GetStatusOk() + return +} + +// GetStatusOk returns a tuple with the Status field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GatewayErrorResponse) GetStatusOk() (ret GatewayErrorResponseGetStatusRetType, ok bool) { + return getGatewayErrorResponseGetStatusAttributeTypeOk(o.Status) +} + +// HasStatus returns a boolean if a field has been set. +func (o *GatewayErrorResponse) HasStatus() bool { + _, ok := o.GetStatusOk() + return ok +} + +// SetStatus gets a reference to the given float64 and assigns it to the Status field. +func (o *GatewayErrorResponse) SetStatus(v GatewayErrorResponseGetStatusRetType) { + setGatewayErrorResponseGetStatusAttributeType(&o.Status, v) +} + +func (o GatewayErrorResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getGatewayErrorResponseGetMessageAttributeTypeOk(o.Message); ok { + toSerialize["Message"] = val + } + if val, ok := getGatewayErrorResponseGetStatusAttributeTypeOk(o.Status); ok { + toSerialize["Status"] = val + } + return toSerialize, nil +} + +type NullableGatewayErrorResponse struct { + value *GatewayErrorResponse + isSet bool +} + +func (v NullableGatewayErrorResponse) Get() *GatewayErrorResponse { + return v.value +} + +func (v *NullableGatewayErrorResponse) Set(val *GatewayErrorResponse) { + v.value = val + v.isSet = true +} + +func (v NullableGatewayErrorResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableGatewayErrorResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGatewayErrorResponse(val *GatewayErrorResponse) *NullableGatewayErrorResponse { + return &NullableGatewayErrorResponse{value: val, isSet: true} +} + +func (v NullableGatewayErrorResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGatewayErrorResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_gateway_error_response_test.go b/services/auditlog/model_gateway_error_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_gateway_error_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_list_audit_log_entries_response.go b/services/auditlog/model_list_audit_log_entries_response.go new file mode 100644 index 000000000..3a03b9afe --- /dev/null +++ b/services/auditlog/model_list_audit_log_entries_response.go @@ -0,0 +1,226 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the ListAuditLogEntriesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ListAuditLogEntriesResponse{} + +/* + types and functions for cursor +*/ + +// isNotNullableString +type ListAuditLogEntriesResponseGetCursorAttributeType = *string + +func getListAuditLogEntriesResponseGetCursorAttributeTypeOk(arg ListAuditLogEntriesResponseGetCursorAttributeType) (ret ListAuditLogEntriesResponseGetCursorRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListAuditLogEntriesResponseGetCursorAttributeType(arg *ListAuditLogEntriesResponseGetCursorAttributeType, val ListAuditLogEntriesResponseGetCursorRetType) { + *arg = &val +} + +type ListAuditLogEntriesResponseGetCursorArgType = string +type ListAuditLogEntriesResponseGetCursorRetType = string + +/* + types and functions for items +*/ + +// isArray +type ListAuditLogEntriesResponseGetItemsAttributeType = *[]AuditLogEntryResponse +type ListAuditLogEntriesResponseGetItemsArgType = []AuditLogEntryResponse +type ListAuditLogEntriesResponseGetItemsRetType = []AuditLogEntryResponse + +func getListAuditLogEntriesResponseGetItemsAttributeTypeOk(arg ListAuditLogEntriesResponseGetItemsAttributeType) (ret ListAuditLogEntriesResponseGetItemsRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListAuditLogEntriesResponseGetItemsAttributeType(arg *ListAuditLogEntriesResponseGetItemsAttributeType, val ListAuditLogEntriesResponseGetItemsRetType) { + *arg = &val +} + +/* + types and functions for limit +*/ + +// isNumber +type ListAuditLogEntriesResponseGetLimitAttributeType = *float64 +type ListAuditLogEntriesResponseGetLimitArgType = float64 +type ListAuditLogEntriesResponseGetLimitRetType = float64 + +func getListAuditLogEntriesResponseGetLimitAttributeTypeOk(arg ListAuditLogEntriesResponseGetLimitAttributeType) (ret ListAuditLogEntriesResponseGetLimitRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setListAuditLogEntriesResponseGetLimitAttributeType(arg *ListAuditLogEntriesResponseGetLimitAttributeType, val ListAuditLogEntriesResponseGetLimitRetType) { + *arg = &val +} + +// ListAuditLogEntriesResponse struct for ListAuditLogEntriesResponse +type ListAuditLogEntriesResponse struct { + // Optional cursor if more entries are available + Cursor ListAuditLogEntriesResponseGetCursorAttributeType `json:"cursor,omitempty"` + Items ListAuditLogEntriesResponseGetItemsAttributeType `json:"items,omitempty"` + // Maximum amount of entries requested. + Limit ListAuditLogEntriesResponseGetLimitAttributeType `json:"limit,omitempty"` +} + +// NewListAuditLogEntriesResponse instantiates a new ListAuditLogEntriesResponse 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 NewListAuditLogEntriesResponse() *ListAuditLogEntriesResponse { + this := ListAuditLogEntriesResponse{} + return &this +} + +// NewListAuditLogEntriesResponseWithDefaults instantiates a new ListAuditLogEntriesResponse 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 NewListAuditLogEntriesResponseWithDefaults() *ListAuditLogEntriesResponse { + this := ListAuditLogEntriesResponse{} + var limit float64 = 50 + this.Limit = &limit + return &this +} + +// GetCursor returns the Cursor field value if set, zero value otherwise. +func (o *ListAuditLogEntriesResponse) GetCursor() (res ListAuditLogEntriesResponseGetCursorRetType) { + res, _ = o.GetCursorOk() + return +} + +// GetCursorOk returns a tuple with the Cursor field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAuditLogEntriesResponse) GetCursorOk() (ret ListAuditLogEntriesResponseGetCursorRetType, ok bool) { + return getListAuditLogEntriesResponseGetCursorAttributeTypeOk(o.Cursor) +} + +// HasCursor returns a boolean if a field has been set. +func (o *ListAuditLogEntriesResponse) HasCursor() bool { + _, ok := o.GetCursorOk() + return ok +} + +// SetCursor gets a reference to the given string and assigns it to the Cursor field. +func (o *ListAuditLogEntriesResponse) SetCursor(v ListAuditLogEntriesResponseGetCursorRetType) { + setListAuditLogEntriesResponseGetCursorAttributeType(&o.Cursor, v) +} + +// GetItems returns the Items field value if set, zero value otherwise. +func (o *ListAuditLogEntriesResponse) GetItems() (res ListAuditLogEntriesResponseGetItemsRetType) { + res, _ = o.GetItemsOk() + return +} + +// GetItemsOk returns a tuple with the Items field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAuditLogEntriesResponse) GetItemsOk() (ret ListAuditLogEntriesResponseGetItemsRetType, ok bool) { + return getListAuditLogEntriesResponseGetItemsAttributeTypeOk(o.Items) +} + +// HasItems returns a boolean if a field has been set. +func (o *ListAuditLogEntriesResponse) HasItems() bool { + _, ok := o.GetItemsOk() + return ok +} + +// SetItems gets a reference to the given []AuditLogEntryResponse and assigns it to the Items field. +func (o *ListAuditLogEntriesResponse) SetItems(v ListAuditLogEntriesResponseGetItemsRetType) { + setListAuditLogEntriesResponseGetItemsAttributeType(&o.Items, v) +} + +// GetLimit returns the Limit field value if set, zero value otherwise. +func (o *ListAuditLogEntriesResponse) GetLimit() (res ListAuditLogEntriesResponseGetLimitRetType) { + res, _ = o.GetLimitOk() + return +} + +// GetLimitOk returns a tuple with the Limit field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ListAuditLogEntriesResponse) GetLimitOk() (ret ListAuditLogEntriesResponseGetLimitRetType, ok bool) { + return getListAuditLogEntriesResponseGetLimitAttributeTypeOk(o.Limit) +} + +// HasLimit returns a boolean if a field has been set. +func (o *ListAuditLogEntriesResponse) HasLimit() bool { + _, ok := o.GetLimitOk() + return ok +} + +// SetLimit gets a reference to the given float64 and assigns it to the Limit field. +func (o *ListAuditLogEntriesResponse) SetLimit(v ListAuditLogEntriesResponseGetLimitRetType) { + setListAuditLogEntriesResponseGetLimitAttributeType(&o.Limit, v) +} + +func (o ListAuditLogEntriesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getListAuditLogEntriesResponseGetCursorAttributeTypeOk(o.Cursor); ok { + toSerialize["Cursor"] = val + } + if val, ok := getListAuditLogEntriesResponseGetItemsAttributeTypeOk(o.Items); ok { + toSerialize["Items"] = val + } + if val, ok := getListAuditLogEntriesResponseGetLimitAttributeTypeOk(o.Limit); ok { + toSerialize["Limit"] = val + } + return toSerialize, nil +} + +type NullableListAuditLogEntriesResponse struct { + value *ListAuditLogEntriesResponse + isSet bool +} + +func (v NullableListAuditLogEntriesResponse) Get() *ListAuditLogEntriesResponse { + return v.value +} + +func (v *NullableListAuditLogEntriesResponse) Set(val *ListAuditLogEntriesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableListAuditLogEntriesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableListAuditLogEntriesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableListAuditLogEntriesResponse(val *ListAuditLogEntriesResponse) *NullableListAuditLogEntriesResponse { + return &NullableListAuditLogEntriesResponse{value: val, isSet: true} +} + +func (v NullableListAuditLogEntriesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableListAuditLogEntriesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_list_audit_log_entries_response_test.go b/services/auditlog/model_list_audit_log_entries_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_list_audit_log_entries_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/model_service_account_delegation_info_principal_response.go b/services/auditlog/model_service_account_delegation_info_principal_response.go new file mode 100644 index 000000000..c288bdcdd --- /dev/null +++ b/services/auditlog/model_service_account_delegation_info_principal_response.go @@ -0,0 +1,176 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" +) + +// checks if the ServiceAccountDelegationInfoPrincipalResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ServiceAccountDelegationInfoPrincipalResponse{} + +/* + types and functions for email +*/ + +// isNotNullableString +type ServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType = *string + +func getServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeTypeOk(arg ServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType) (ret ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType(arg *ServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType, val ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType) { + *arg = &val +} + +type ServiceAccountDelegationInfoPrincipalResponseGetEmailArgType = string +type ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType = string + +/* + types and functions for id +*/ + +// isNotNullableString +type ServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType = *string + +func getServiceAccountDelegationInfoPrincipalResponseGetIdAttributeTypeOk(arg ServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType) (ret ServiceAccountDelegationInfoPrincipalResponseGetIdRetType, ok bool) { + if arg == nil { + return ret, false + } + return *arg, true +} + +func setServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType(arg *ServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType, val ServiceAccountDelegationInfoPrincipalResponseGetIdRetType) { + *arg = &val +} + +type ServiceAccountDelegationInfoPrincipalResponseGetIdArgType = string +type ServiceAccountDelegationInfoPrincipalResponseGetIdRetType = string + +// ServiceAccountDelegationInfoPrincipalResponse Principal in delegation chain of a service account +type ServiceAccountDelegationInfoPrincipalResponse struct { + // E-Mail of the subject + Email ServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType `json:"email,omitempty"` + // Unique identifier of the subject + // REQUIRED + Id ServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType `json:"id" required:"true"` +} + +type _ServiceAccountDelegationInfoPrincipalResponse ServiceAccountDelegationInfoPrincipalResponse + +// NewServiceAccountDelegationInfoPrincipalResponse instantiates a new ServiceAccountDelegationInfoPrincipalResponse 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 NewServiceAccountDelegationInfoPrincipalResponse(id ServiceAccountDelegationInfoPrincipalResponseGetIdArgType) *ServiceAccountDelegationInfoPrincipalResponse { + this := ServiceAccountDelegationInfoPrincipalResponse{} + setServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType(&this.Id, id) + return &this +} + +// NewServiceAccountDelegationInfoPrincipalResponseWithDefaults instantiates a new ServiceAccountDelegationInfoPrincipalResponse 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 NewServiceAccountDelegationInfoPrincipalResponseWithDefaults() *ServiceAccountDelegationInfoPrincipalResponse { + this := ServiceAccountDelegationInfoPrincipalResponse{} + return &this +} + +// GetEmail returns the Email field value if set, zero value otherwise. +func (o *ServiceAccountDelegationInfoPrincipalResponse) GetEmail() (res ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType) { + res, _ = o.GetEmailOk() + return +} + +// GetEmailOk returns a tuple with the Email field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ServiceAccountDelegationInfoPrincipalResponse) GetEmailOk() (ret ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType, ok bool) { + return getServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeTypeOk(o.Email) +} + +// HasEmail returns a boolean if a field has been set. +func (o *ServiceAccountDelegationInfoPrincipalResponse) HasEmail() bool { + _, ok := o.GetEmailOk() + return ok +} + +// SetEmail gets a reference to the given string and assigns it to the Email field. +func (o *ServiceAccountDelegationInfoPrincipalResponse) SetEmail(v ServiceAccountDelegationInfoPrincipalResponseGetEmailRetType) { + setServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeType(&o.Email, v) +} + +// GetId returns the Id field value +func (o *ServiceAccountDelegationInfoPrincipalResponse) GetId() (ret ServiceAccountDelegationInfoPrincipalResponseGetIdRetType) { + ret, _ = o.GetIdOk() + return ret +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *ServiceAccountDelegationInfoPrincipalResponse) GetIdOk() (ret ServiceAccountDelegationInfoPrincipalResponseGetIdRetType, ok bool) { + return getServiceAccountDelegationInfoPrincipalResponseGetIdAttributeTypeOk(o.Id) +} + +// SetId sets field value +func (o *ServiceAccountDelegationInfoPrincipalResponse) SetId(v ServiceAccountDelegationInfoPrincipalResponseGetIdRetType) { + setServiceAccountDelegationInfoPrincipalResponseGetIdAttributeType(&o.Id, v) +} + +func (o ServiceAccountDelegationInfoPrincipalResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if val, ok := getServiceAccountDelegationInfoPrincipalResponseGetEmailAttributeTypeOk(o.Email); ok { + toSerialize["Email"] = val + } + if val, ok := getServiceAccountDelegationInfoPrincipalResponseGetIdAttributeTypeOk(o.Id); ok { + toSerialize["Id"] = val + } + return toSerialize, nil +} + +type NullableServiceAccountDelegationInfoPrincipalResponse struct { + value *ServiceAccountDelegationInfoPrincipalResponse + isSet bool +} + +func (v NullableServiceAccountDelegationInfoPrincipalResponse) Get() *ServiceAccountDelegationInfoPrincipalResponse { + return v.value +} + +func (v *NullableServiceAccountDelegationInfoPrincipalResponse) Set(val *ServiceAccountDelegationInfoPrincipalResponse) { + v.value = val + v.isSet = true +} + +func (v NullableServiceAccountDelegationInfoPrincipalResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableServiceAccountDelegationInfoPrincipalResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableServiceAccountDelegationInfoPrincipalResponse(val *ServiceAccountDelegationInfoPrincipalResponse) *NullableServiceAccountDelegationInfoPrincipalResponse { + return &NullableServiceAccountDelegationInfoPrincipalResponse{value: val, isSet: true} +} + +func (v NullableServiceAccountDelegationInfoPrincipalResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableServiceAccountDelegationInfoPrincipalResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/services/auditlog/model_service_account_delegation_info_principal_response_test.go b/services/auditlog/model_service_account_delegation_info_principal_response_test.go new file mode 100644 index 000000000..d04184227 --- /dev/null +++ b/services/auditlog/model_service_account_delegation_info_principal_response_test.go @@ -0,0 +1,11 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog diff --git a/services/auditlog/utils.go b/services/auditlog/utils.go new file mode 100644 index 000000000..a6f1bec32 --- /dev/null +++ b/services/auditlog/utils.go @@ -0,0 +1,385 @@ +/* +Audit Log API + +API Endpoints to retrieve recorded actions and resulting changes in the system. ### Documentation The user documentation with explanations how to use the api can be found [here](https://docs.stackit.cloud/stackit/en/retrieve-audit-log-per-api-request-134415907.html). ### Audit Logging Changes on organizations, folders and projects and respective cloud resources are logged and collected in the audit log. ### API Constraints The audit log API allows to download messages from the last 90 days. The maximum duration that can be queried at once is 24 hours. Requests are rate limited - the current maximum is 60 requests per minute. + +API version: 2.0 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package auditlog + +import ( + "encoding/json" + "math/rand" + "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 NullableValue[T any] struct { + value *T + isSet bool +} + +func (v NullableValue[T]) Get() *T { + return v.value +} + +func (v *NullableValue[T]) Set(val *T) { + v.value = val + v.isSet = true +} + +func (v NullableValue[T]) IsSet() bool { + return v.isSet +} + +func (v *NullableValue[T]) Unset() { + v.value = nil + v.isSet = false +} + +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 + } + if t, ok := i.(interface{ IsSet() bool }); ok { + return !t.IsSet() + } + 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) +} + +const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +// randString returns a random string with a specified length. It panics if n <= 0. +func randString(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterRunes[rand.Intn(len(letterRunes))] + } + return string(b) +}