Skip to content

Commit

Permalink
Enable route for auto merging (#2606)
Browse files Browse the repository at this point in the history
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
  • Loading branch information
api-clients-generation-pipeline[bot] and ci.datadog-api-spec authored Aug 2, 2024
1 parent b256290 commit 5adc7d0
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 52 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
16 changes: 14 additions & 2 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
40 changes: 1 addition & 39 deletions api/datadogV2/model_role_relationships.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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{}{}
Expand All @@ -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
Expand All @@ -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
}
Expand All @@ -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
Expand Down
37 changes: 36 additions & 1 deletion api/datadogV2/model_role_update_attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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{}{}
Expand All @@ -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
Expand All @@ -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
Expand Down
3 changes: 0 additions & 3 deletions examples/v2/roles/CreateRole.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ func main() {
},
},
},
Users: &datadogV2.RelationshipToUsers{
Data: []datadogV2.RelationshipToUserData{},
},
},
Type: datadogV2.ROLESTYPE_ROLES.Ptr(),
},
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/features/v2/roles.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

0 comments on commit 5adc7d0

Please sign in to comment.