From 5adc7d013fed2a4fafb8bec484861598bb625143 Mon Sep 17 00:00:00 2001 From: "api-clients-generation-pipeline[bot]" <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 14:31:48 +0000 Subject: [PATCH] Enable route for auto merging (#2606) Co-authored-by: ci.datadog-api-spec --- .apigentools-info | 8 ++-- .generator/schemas/v2/openapi.yaml | 16 +++++++- api/datadogV2/model_role_relationships.go | 40 +------------------ api/datadogV2/model_role_update_attributes.go | 37 ++++++++++++++++- examples/v2/roles/CreateRole.go | 3 -- tests/scenarios/features/v2/roles.feature | 6 +-- 6 files changed, 58 insertions(+), 52 deletions(-) diff --git a/.apigentools-info b/.apigentools-info index 63a889d9a0e..3f28dfc3b1b 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-01 21:20:18.051620", - "spec_repo_commit": "55d5616e" + "regenerated": "2024-08-02 13:53:58.905782", + "spec_repo_commit": "74b2ffcb" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-08-01 21:20:18.069204", - "spec_repo_commit": "55d5616e" + "regenerated": "2024-08-02 13:53:58.923820", + "spec_repo_commit": "74b2ffcb" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index fc02454738a..494a77414d4 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -17235,8 +17235,6 @@ components: properties: permissions: $ref: '#/components/schemas/RelationshipToPermissions' - users: - $ref: '#/components/schemas/RelationshipToUsers' type: object RoleResponse: description: Response containing information about a single role. @@ -17266,6 +17264,11 @@ components: name: description: Name of the role. type: string + user_count: + description: The user count. + format: int32 + maximum: 2147483647 + type: integer type: object RoleUpdateData: description: Data related to the update of a role. @@ -24040,6 +24043,10 @@ components: have permission to edit those SLOs. slos_read: View SLOs and status corrections. slos_write: Create, edit, and delete SLOs. + synthetics_default_settings_read: View the default settings for Synthetic + Monitoring. + synthetics_default_settings_write: Edit the default settings for Synthetic + Monitoring. synthetics_global_variable_read: View, search, and use Synthetics global variables. synthetics_global_variable_write: Create, edit, and delete global variables @@ -38068,6 +38075,11 @@ paths: $ref: '#/components/responses/ForbiddenResponse' '429': $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - workflows_read summary: List workflow instances tags: - Workflow Automation diff --git a/api/datadogV2/model_role_relationships.go b/api/datadogV2/model_role_relationships.go index c9302111098..76b3adb7249 100644 --- a/api/datadogV2/model_role_relationships.go +++ b/api/datadogV2/model_role_relationships.go @@ -12,8 +12,6 @@ import ( type RoleRelationships struct { // Relationship to multiple permissions objects. Permissions *RelationshipToPermissions `json:"permissions,omitempty"` - // Relationship to users. - Users *RelationshipToUsers `json:"users,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} @@ -64,34 +62,6 @@ func (o *RoleRelationships) SetPermissions(v RelationshipToPermissions) { o.Permissions = &v } -// GetUsers returns the Users field value if set, zero value otherwise. -func (o *RoleRelationships) GetUsers() RelationshipToUsers { - if o == nil || o.Users == nil { - var ret RelationshipToUsers - return ret - } - return *o.Users -} - -// GetUsersOk returns a tuple with the Users field value if set, nil otherwise -// and a boolean to check if the value has been set. -func (o *RoleRelationships) GetUsersOk() (*RelationshipToUsers, bool) { - if o == nil || o.Users == nil { - return nil, false - } - return o.Users, true -} - -// HasUsers returns a boolean if a field has been set. -func (o *RoleRelationships) HasUsers() bool { - return o != nil && o.Users != nil -} - -// SetUsers gets a reference to the given RelationshipToUsers and assigns it to the Users field. -func (o *RoleRelationships) SetUsers(v RelationshipToUsers) { - o.Users = &v -} - // MarshalJSON serializes the struct using spec logic. func (o RoleRelationships) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -101,9 +71,6 @@ func (o RoleRelationships) MarshalJSON() ([]byte, error) { if o.Permissions != nil { toSerialize["permissions"] = o.Permissions } - if o.Users != nil { - toSerialize["users"] = o.Users - } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -115,14 +82,13 @@ func (o RoleRelationships) MarshalJSON() ([]byte, error) { func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { all := struct { Permissions *RelationshipToPermissions `json:"permissions,omitempty"` - Users *RelationshipToUsers `json:"users,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"permissions", "users"}) + datadog.DeleteKeys(additionalProperties, &[]string{"permissions"}) } else { return err } @@ -132,10 +98,6 @@ func (o *RoleRelationships) UnmarshalJSON(bytes []byte) (err error) { hasInvalidField = true } o.Permissions = all.Permissions - if all.Users != nil && all.Users.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } - o.Users = all.Users if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/api/datadogV2/model_role_update_attributes.go b/api/datadogV2/model_role_update_attributes.go index a27bcec8fea..9690a2d3faa 100644 --- a/api/datadogV2/model_role_update_attributes.go +++ b/api/datadogV2/model_role_update_attributes.go @@ -18,6 +18,8 @@ type RoleUpdateAttributes struct { ModifiedAt *time.Time `json:"modified_at,omitempty"` // Name of the role. Name *string `json:"name,omitempty"` + // The user count. + UserCount *int32 `json:"user_count,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct UnparsedObject map[string]interface{} `json:"-"` AdditionalProperties map[string]interface{} @@ -124,6 +126,34 @@ func (o *RoleUpdateAttributes) SetName(v string) { o.Name = &v } +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *RoleUpdateAttributes) GetUserCount() int32 { + if o == nil || o.UserCount == nil { + var ret int32 + return ret + } + return *o.UserCount +} + +// GetUserCountOk returns a tuple with the UserCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RoleUpdateAttributes) GetUserCountOk() (*int32, bool) { + if o == nil || o.UserCount == nil { + return nil, false + } + return o.UserCount, true +} + +// HasUserCount returns a boolean if a field has been set. +func (o *RoleUpdateAttributes) HasUserCount() bool { + return o != nil && o.UserCount != nil +} + +// SetUserCount gets a reference to the given int32 and assigns it to the UserCount field. +func (o *RoleUpdateAttributes) SetUserCount(v int32) { + o.UserCount = &v +} + // MarshalJSON serializes the struct using spec logic. func (o RoleUpdateAttributes) MarshalJSON() ([]byte, error) { toSerialize := map[string]interface{}{} @@ -147,6 +177,9 @@ func (o RoleUpdateAttributes) MarshalJSON() ([]byte, error) { if o.Name != nil { toSerialize["name"] = o.Name } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } for key, value := range o.AdditionalProperties { toSerialize[key] = value @@ -160,19 +193,21 @@ func (o *RoleUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { CreatedAt *time.Time `json:"created_at,omitempty"` ModifiedAt *time.Time `json:"modified_at,omitempty"` Name *string `json:"name,omitempty"` + UserCount *int32 `json:"user_count,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name"}) + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "modified_at", "name", "user_count"}) } else { return err } o.CreatedAt = all.CreatedAt o.ModifiedAt = all.ModifiedAt o.Name = all.Name + o.UserCount = all.UserCount if len(additionalProperties) > 0 { o.AdditionalProperties = additionalProperties diff --git a/examples/v2/roles/CreateRole.go b/examples/v2/roles/CreateRole.go index 3874e87e515..da74e6feb56 100644 --- a/examples/v2/roles/CreateRole.go +++ b/examples/v2/roles/CreateRole.go @@ -26,9 +26,6 @@ func main() { }, }, }, - Users: &datadogV2.RelationshipToUsers{ - Data: []datadogV2.RelationshipToUserData{}, - }, }, Type: datadogV2.ROLESTYPE_ROLES.Ptr(), }, diff --git a/tests/scenarios/features/v2/roles.feature b/tests/scenarios/features/v2/roles.feature index 101cd71aade..e9d2ab41147 100644 --- a/tests/scenarios/features/v2/roles.feature +++ b/tests/scenarios/features/v2/roles.feature @@ -81,14 +81,14 @@ Feature: Roles @generated @skip @team:DataDog/aaa-core-access Scenario: Create role returns "Bad Request" response Given new "CreateRole" request - And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}, "users": {"data": []}}, "type": "roles"}} + And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}} When the request is sent Then the response status is 400 Bad Request @generated @skip @team:DataDog/aaa-core-access Scenario: Create role returns "OK" response Given new "CreateRole" request - And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}, "users": {"data": []}}, "type": "roles"}} + And body with value {"data": {"attributes": {"name": "developers"}, "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}} When the request is sent Then the response status is 200 OK @@ -329,6 +329,6 @@ Feature: Roles Scenario: Update a role returns "Unprocessable Entity" response Given new "UpdateRole" request And request contains "role_id" parameter from "REPLACE.ME" - And body with value {"data": {"attributes": {}, "id": "00000000-0000-1111-0000-000000000000", "relationships": {"permissions": {"data": [{"type": "permissions"}]}, "users": {"data": []}}, "type": "roles"}} + And body with value {"data": {"attributes": {}, "id": "00000000-0000-1111-0000-000000000000", "relationships": {"permissions": {"data": [{"type": "permissions"}]}}, "type": "roles"}} When the request is sent Then the response status is 422 Unprocessable Entity