diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 9bceb715496..6bc8997cfde 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -945,6 +945,27 @@ components: required: true schema: type: string + RestrictionQueryID: + description: The ID of the restriction query. + in: path + name: restriction_query_id + required: true + schema: + type: string + RestrictionQueryRoleID: + description: The ID of the role. + in: path + name: role_id + required: true + schema: + type: string + RestrictionQueryUserID: + description: The ID of the user. + in: path + name: user_id + required: true + schema: + type: string RetentionFilterIdParam: description: The ID of the retention filter. in: path @@ -30501,6 +30522,15 @@ components: example: eyJzdGFydEF0IjoiQVFBQUFYS2tMS3pPbm40NGV3QUFBQUJCV0V0clRFdDZVbG8zY3pCRmNsbHJiVmxDWlEifQ== type: string type: object + LogsRestrictionQueriesType: + default: logs_restriction_queries + description: Restriction query resource type. + enum: + - logs_restriction_queries + example: logs_restriction_queries + type: string + x-enum-varnames: + - LOGS_RESTRICTION_QUERIES LogsSort: description: Sort parameters when querying logs. enum: @@ -41410,6 +41440,7 @@ components: type: object RelationshipToUserTeamPermissionData: description: Related user team permission data + nullable: true properties: id: description: The ID of the user team permission @@ -41838,6 +41869,191 @@ components: required: - data type: object + RestrictionQueryAttributes: + description: Attributes of the restriction query. + properties: + created_at: + description: Creation time of the restriction query. + example: '2020-03-17T21:06:44.000Z' + format: date-time + readOnly: true + type: string + last_modifier_email: + description: Email of the user who last modified this restriction query. + example: user@example.com + readOnly: true + type: string + last_modifier_name: + description: Name of the user who last modified this restriction query. + example: John Doe + readOnly: true + type: string + modified_at: + description: Time of last restriction query modification. + example: '2020-03-17T21:15:15.000Z' + format: date-time + readOnly: true + type: string + restriction_query: + description: The query that defines the restriction. Only the content matching + the query can be returned. + example: env:sandbox + type: string + role_count: + description: Number of roles associated with this restriction query. + example: 3 + format: int64 + readOnly: true + type: integer + user_count: + description: Number of users associated with this restriction query. + example: 5 + format: int64 + readOnly: true + type: integer + type: object + RestrictionQueryCreateAttributes: + description: Attributes of the created restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + required: + - restriction_query + type: object + RestrictionQueryCreateData: + description: Data related to the creation of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryCreateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryCreatePayload: + description: Create a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryCreateData' + type: object + RestrictionQueryListResponse: + description: Response containing information about multiple restriction queries. + properties: + data: + description: Array of returned restriction queries. + items: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationships' + type: array + type: object + RestrictionQueryResponseIncludedItem: + description: An object related to a restriction query. + oneOf: + - $ref: '#/components/schemas/RestrictionQueryRole' + RestrictionQueryRole: + description: Partial role object. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryRoleAttribute' + id: + description: ID of the role. + example: + type: string + type: + $ref: '#/components/schemas/RolesType' + required: + - type + - id + - attributes + type: object + RestrictionQueryRoleAttribute: + description: Attributes of the role for a restriction query. + properties: + name: + description: The role name. + example: Datadog Admin Role + type: string + type: object + RestrictionQueryRolesResponse: + description: Response containing information about roles attached to a restriction + query. + properties: + data: + description: Array of roles. + items: + $ref: '#/components/schemas/RestrictionQueryRole' + type: array + type: object + RestrictionQueryUpdateAttributes: + description: Attributes of the edited restriction query. + properties: + restriction_query: + description: The restriction query. + example: env:sandbox + type: string + required: + - restriction_query + type: object + RestrictionQueryUpdateData: + description: Data related to the update of a restriction query. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryUpdateAttributes' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryUpdatePayload: + description: Update a restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryUpdateData' + type: object + RestrictionQueryWithRelationships: + description: Restriction query object returned by the API. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryAttributes' + id: + description: ID of the restriction query. + example: 79a0e60a-644a-11ea-ad29-43329f7f58b5 + type: string + relationships: + $ref: '#/components/schemas/UserRelationships' + type: + $ref: '#/components/schemas/LogsRestrictionQueriesType' + type: object + RestrictionQueryWithRelationshipsResponse: + description: Response containing information about a single restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryWithRelationships' + included: + description: Array of objects related to the restriction query. + items: + $ref: '#/components/schemas/RestrictionQueryResponseIncludedItem' + type: array + type: object + RestrictionQueryWithoutRelationships: + description: Restriction query object returned by the API. + properties: + attributes: + $ref: '#/components/schemas/RestrictionQueryAttributes' + id: + description: ID of the restriction query. + example: 79a0e60a-644a-11ea-ad29-43329f7f58b5 + type: string + type: + default: logs_restriction_queries + description: Restriction queries type. + example: logs_restriction_queries + readOnly: true + type: string + type: object + RestrictionQueryWithoutRelationshipsResponse: + description: Response containing information about a single restriction query. + properties: + data: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationships' + type: object RetentionFilter: description: The definition of the retention filter. properties: @@ -51804,7 +52020,11 @@ components: items: description: String identifier of the module type: string + nullable: true type: array + is_managed: + description: Whether the team is managed from an external source + type: boolean link_count: description: The number of links belonging to the team format: int32 @@ -51836,6 +52056,7 @@ components: items: description: String identifier of the module type: string + nullable: true type: array required: - handle @@ -52016,6 +52237,211 @@ components: required: - data type: object + TeamHierarchyLink: + description: Team hierarchy link + properties: + attributes: + $ref: '#/components/schemas/TeamHierarchyLinkAttributes' + id: + description: The team hierarchy link's identifier + example: b8626d7e-cedd-11eb-abf5-da7ad0900001 + type: string + relationships: + $ref: '#/components/schemas/TeamHierarchyLinkRelationships' + type: + $ref: '#/components/schemas/TeamHierarchyLinkType' + required: + - attributes + - id + - type + type: object + TeamHierarchyLinkAttributes: + description: Team hierarchy link attributes + properties: + created_at: + description: Timestamp when the team hierarchy link was created + example: '' + format: date-time + type: string + provisioned_by: + description: The provisioner of the team hierarchy link + example: system + type: string + required: + - provisioned_by + - created_at + type: object + TeamHierarchyLinkCreate: + description: Data provided when creating a team hierarchy link + properties: + relationships: + $ref: '#/components/schemas/TeamHierarchyLinkCreateRelationships' + type: + $ref: '#/components/schemas/TeamHierarchyLinkType' + required: + - relationships + - type + type: object + TeamHierarchyLinkCreateRelationships: + description: The related teams that will be connected by the team hierarchy + link + properties: + parent_team: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeamRelationship' + sub_team: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeamRelationship' + required: + - parent_team + - sub_team + type: object + TeamHierarchyLinkCreateRequest: + description: Request to create a team hierarchy link + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkCreate' + required: + - data + type: object + TeamHierarchyLinkCreateTeam: + description: This schema defines the attributes about each team that has to + be provided when creating a team hierarchy link + properties: + id: + description: The team's identifier + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: string + type: + $ref: '#/components/schemas/TeamType' + required: + - id + - type + type: object + TeamHierarchyLinkCreateTeamRelationship: + description: Data about each team that will be connected by the team hierarchy + link + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkCreateTeam' + required: + - data + type: object + TeamHierarchyLinkRelationships: + description: Team hierarchy link relationships + properties: + parent_team: + $ref: '#/components/schemas/TeamHierarchyLinkTeamRelationship' + sub_team: + $ref: '#/components/schemas/TeamHierarchyLinkTeamRelationship' + required: + - parent_team + - sub_team + type: object + TeamHierarchyLinkResponse: + description: Team hierarchy link response + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLink' + included: + description: Included teams + items: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + type: array + links: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseLinks' + type: object + TeamHierarchyLinkTeam: + description: Team hierarchy links connect different teams. This represents team + objects that are connected by the team hierarchy link. + properties: + attributes: + $ref: '#/components/schemas/TeamHierarchyLinkTeamAttributes' + id: + description: The team's identifier + example: 692e8073-12c4-4c71-8408-5090bd44c9c8 + type: string + type: + $ref: '#/components/schemas/TeamType' + required: + - id + - type + type: object + TeamHierarchyLinkTeamAttributes: + description: Team hierarchy links connect different teams. This represents attributes + from teams that are connected by the team hierarchy link. + properties: + avatar: + description: The team's avatar + nullable: true + type: string + banner: + description: The team's banner + format: int64 + type: integer + handle: + description: The team's handle + example: team-handle + type: string + is_managed: + description: Whether the team is managed + type: boolean + is_open_membership: + description: Whether the team has open membership + type: boolean + link_count: + description: The number of links for the team + format: int64 + type: integer + name: + description: The team's name + example: Team Name + type: string + summary: + description: The team's summary + nullable: true + type: string + user_count: + description: The number of users in the team + format: int64 + type: integer + required: + - handle + - name + type: object + TeamHierarchyLinkTeamRelationship: + description: Team hierarchy link team relationship + properties: + data: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + required: + - data + type: object + TeamHierarchyLinkType: + default: team_hierarchy_links + description: Team hierarchy link type + enum: + - team_hierarchy_links + example: team_hierarchy_links + type: string + x-enum-varnames: + - TEAM_HIERARCHY_LINKS + TeamHierarchyLinksResponse: + description: Team hierarchy links response + properties: + data: + description: Team hierarchy links response data + items: + $ref: '#/components/schemas/TeamHierarchyLink' + type: array + included: + description: Included teams + items: + $ref: '#/components/schemas/TeamHierarchyLinkTeam' + type: array + links: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseLinks' + meta: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseMeta' + type: object TeamIncluded: description: Included resources related to the team oneOf: @@ -52895,6 +53321,76 @@ components: - LINK_COUNT - TEAM_LINKS - USER_TEAM_PERMISSIONS + TeamsHierarchyLinksResponseLinks: + description: When querying team hierarchy links, a set of links for navigation + between different pages is included + properties: + first: + description: Link to the first page. + nullable: true + type: string + last: + description: Link to the last page. + nullable: true + type: string + next: + description: Link to the next page. + nullable: true + type: string + prev: + description: Link to the previous page. + nullable: true + type: string + self: + description: Link to the current object. + type: string + type: object + TeamsHierarchyLinksResponseMeta: + description: Metadata that is included in the response when querying the team + hierarchy links + properties: + page: + $ref: '#/components/schemas/TeamsHierarchyLinksResponseMetaPage' + type: object + TeamsHierarchyLinksResponseMetaPage: + description: Metadata related to paging information that is included in the + response when querying the team hierarchy links + properties: + first_number: + description: First page number. + format: int64 + type: integer + last_number: + description: Last page number. + format: int64 + type: integer + next_number: + description: Next page number. + format: int64 + nullable: true + type: integer + number: + description: Page number. + format: int64 + type: integer + prev_number: + description: Previous page number. + format: int64 + nullable: true + type: integer + size: + description: Page size. + format: int64 + type: integer + total: + description: Total number of results. + format: int64 + type: integer + type: + description: Pagination type. + example: number_size + type: string + type: object TeamsResponse: description: Response with multiple teams properties: @@ -70264,6 +70760,487 @@ paths: operator: OR permissions: - logs_generate_metrics + /api/v2/logs/config/restriction_queries: + get: + description: Returns all restriction queries, including their names and IDs. + operationId: ListRestrictionQueries + parameters: + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List restriction queries + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: Create a new restriction query for your organization. + operationId: CreateRestrictionQuery + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryCreatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Create a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/role/{role_id}: + get: + description: Get restriction query for a given role. + operationId: GetRoleRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryRoleID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get restriction query for a given role + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/user/{user_id}: + get: + description: Get all restriction queries for a given user. + operationId: ListUserRestrictionQueries + parameters: + - $ref: '#/components/parameters/RestrictionQueryUserID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryListResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get all restriction queries for a given user + tags: + - Logs Restriction Queries + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/{restriction_query_id}: + delete: + description: Deletes a restriction query. + operationId: DeleteRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Delete a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Get a restriction query in the organization specified by the restriction + query's `restriction_query_id`. + operationId: GetRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + patch: + description: Edit a restriction query. + operationId: UpdateRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryUpdatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Update a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + put: + description: Replace a restriction query. + operationId: ReplaceRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryUpdatePayload' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryWithoutRelationshipsResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Replace a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + /api/v2/logs/config/restriction_queries/{restriction_query_id}/roles: + delete: + description: Removes a role from a restriction query. + operationId: RemoveRoleFromRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Revoke role from a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + get: + description: Returns all roles that have a given restriction query. + operationId: ListRestrictionQueryRoles + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/RestrictionQueryRolesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List roles for a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - logs_read_config + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' + post: + description: 'Adds a role to a restriction query. + + + **Note**: This operation automatically grants the `logs_read_data` permission + to the role if it doesn''t already have it.' + operationId: AddRoleToRestrictionQuery + parameters: + - $ref: '#/components/parameters/RestrictionQueryID' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/RelationshipToRole' + required: true + responses: + '204': + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Authentication error + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Grant role to a restriction query + tags: + - Logs Restriction Queries + x-codegen-request-body-name: body + x-permission: + operator: OR + permissions: + - user_access_manage + x-unstable: '**Note**: This endpoint is in public beta. + + If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/logs/events: get: description: 'List endpoint returns logs that match a log search query. @@ -81999,6 +82976,170 @@ paths: permissions: - teams_read - teams_manage + /api/v2/team-hierarchy-links: + get: + description: List all team hierarchy links that match the provided filters. + operationId: ListTeamHierarchyLinks + parameters: + - $ref: '#/components/parameters/PageNumber' + - $ref: '#/components/parameters/PageSize' + - description: Filter by parent team ID + in: query + name: filter[parent_team] + required: false + schema: + type: string + - description: Filter by sub team ID + in: query + name: filter[sub_team] + required: false + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinksResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get team hierarchy links + tags: + - Teams + x-pagination: + limitParam: page[size] + pageParam: page[number] + resultsPath: data + x-permission: + operator: OR + permissions: + - teams_read + post: + description: Create a new team hierarchy link between a parent team and a sub + team. + operationId: AddTeamHierarchyLink + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '409': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Conflict + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + - teams_manage + summary: Create a team hierarchy link + tags: + - Teams + x-permission: + operator: AND + permissions: + - teams_read + - teams_manage + /api/v2/team-hierarchy-links/{link_id}: + delete: + description: Remove a team hierarchy link by the given link_id. + operationId: RemoveTeamHierarchyLink + parameters: + - description: The team hierarchy link's identifier + in: path + name: link_id + required: true + schema: + type: string + responses: + '204': + description: No Content + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + - teams_manage + summary: Remove a team hierarchy link + tags: + - Teams + x-permission: + operator: AND + permissions: + - teams_read + - teams_manage + get: + description: Get a single team hierarchy link for the given link_id. + operationId: GetTeamHierarchyLink + parameters: + - description: The team hierarchy link's identifier + in: path + name: link_id + required: true + schema: + type: string + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/TeamHierarchyLinkResponse' + description: OK + '403': + $ref: '#/components/responses/ForbiddenResponse' + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: API error response. + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + security: + - apiKeyAuth: [] + appKeyAuth: [] + - AuthZ: + - teams_read + summary: Get a team hierarchy link + tags: + - Teams + x-permission: + operator: OR + permissions: + - teams_read /api/v2/team/connections: delete: description: Delete multiple team connections. @@ -82273,7 +83414,13 @@ paths: If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{super_team_id}/member_teams: get: - description: Get all member teams. + deprecated: true + description: 'Get all member teams. + + + **Note**: This API is deprecated. For team hierarchy relationships (parent-child + + teams), use the team hierarchy links API: `GET /api/v2/team-hierarchy-links`.' operationId: ListMemberTeams parameters: - description: None @@ -82326,14 +83473,20 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' post: + deprecated: true description: 'Add a member team. Adds the team given by the `id` in the body as a member team of the super - team.' + team. + + + **Note**: This API is deprecated. For creating team hierarchy links, use the + team hierarchy links API: `POST /api/v2/team-hierarchy-links`.' operationId: AddMemberTeam parameters: - description: None @@ -82373,12 +83526,18 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' /api/v2/team/{super_team_id}/member_teams/{member_team_id}: delete: - description: Remove a super team's member team identified by `member_team_id`. + deprecated: true + description: 'Remove a super team''s member team identified by `member_team_id`. + + + **Note**: This API is deprecated. For deleting team hierarchy links, use the + team hierarchy links API: `DELETE /api/v2/team-hierarchy-links/{link_id}`.' operationId: RemoveMemberTeam parameters: - description: None @@ -82418,6 +83577,7 @@ paths: operator: OR permissions: - teams_read + x-sunset: '2026-06-01' x-unstable: '**Note**: This endpoint is in Preview. If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).' @@ -85210,6 +86370,44 @@ tags: description: Find out more at url: https://docs.datadoghq.com/logs/logs_to_metrics/ name: Logs Metrics +- description: '**Note: This endpoint is in public beta. If you have any feedback, + contact [Datadog support](https://docs.datadoghq.com/help/).** + + + A Restriction Query is a logs query that restricts which logs the `logs_read_data` + permission grants read access to. + + For users whose roles have Restriction Queries, any log query they make only returns + those log events that also match + + one of their Restriction Queries. This is true whether the user queries log events + from any log-related feature, including + + the log explorer, Live Tail, re-hydration, or a dashboard widget. + + + Restriction Queries currently only support use of the following components of + log events: + + + - Reserved attributes + + - The log message + + - Tags + + + To restrict read access on log data, add a team tag to log events to indicate + which teams own them, and then scope Restriction Queries to the relevant values + of the team tag. Tags can be applied to log events in many ways, and a log event + can have multiple tags with the same key (like team) and different values. This + means the same log event can be visible to roles whose restriction queries are + scoped to different team values. + + + See [How to Set Up RBAC for Logs](https://docs.datadoghq.com/logs/guide/logs-rbac/?tab=api#restrict-access-to-logs) + for details on how to add restriction queries.' + name: Logs Restriction Queries - description: "The metrics endpoint allows you to:\n\n- Post metrics data so it can be graphed on Datadog\u2019s dashboards\n- Query metrics from any time period (timeseries and scalar)\n- Modify tag configurations for metrics\n- View tags diff --git a/api/datadog/configuration.go b/api/datadog/configuration.go index 04693dd2f2c..041334c441d 100644 --- a/api/datadog/configuration.go +++ b/api/datadog/configuration.go @@ -690,6 +690,17 @@ func NewConfiguration() *Configuration { "v2.UpdateIncidentNotificationTemplate": false, "v2.UpdateIncidentTodo": false, "v2.UpdateIncidentType": false, + "v2.AddRoleToRestrictionQuery": false, + "v2.CreateRestrictionQuery": false, + "v2.DeleteRestrictionQuery": false, + "v2.GetRestrictionQuery": false, + "v2.GetRoleRestrictionQuery": false, + "v2.ListRestrictionQueries": false, + "v2.ListRestrictionQueryRoles": false, + "v2.ListUserRestrictionQueries": false, + "v2.RemoveRoleFromRestrictionQuery": false, + "v2.ReplaceRestrictionQuery": false, + "v2.UpdateRestrictionQuery": false, "v2.CreateMonitorUserTemplate": false, "v2.DeleteMonitorUserTemplate": false, "v2.GetMonitorUserTemplate": false, diff --git a/api/datadogV2/api_logs_restriction_queries.go b/api/datadogV2/api_logs_restriction_queries.go new file mode 100644 index 00000000000..33ba5b9d725 --- /dev/null +++ b/api/datadogV2/api_logs_restriction_queries.go @@ -0,0 +1,1043 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _fmt "fmt" + _log "log" + _nethttp "net/http" + _neturl "net/url" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LogsRestrictionQueriesApi service type +type LogsRestrictionQueriesApi datadog.Service + +// AddRoleToRestrictionQuery Grant role to a restriction query. +// Adds a role to a restriction query. +// +// **Note**: This operation automatically grants the `logs_read_data` permission to the role if it doesn't already have it. +func (a *LogsRestrictionQueriesApi) AddRoleToRestrictionQuery(ctx _context.Context, restrictionQueryId string, body RelationshipToRole) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + ) + + operationId := "v2.AddRoleToRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.AddRoleToRestrictionQuery") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// CreateRestrictionQuery Create a restriction query. +// Create a new restriction query for your organization. +func (a *LogsRestrictionQueriesApi) CreateRestrictionQuery(ctx _context.Context, body RestrictionQueryCreatePayload) (RestrictionQueryWithoutRelationshipsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue RestrictionQueryWithoutRelationshipsResponse + ) + + operationId := "v2.CreateRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.CreateRestrictionQuery") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// DeleteRestrictionQuery Delete a restriction query. +// Deletes a restriction query. +func (a *LogsRestrictionQueriesApi) DeleteRestrictionQuery(ctx _context.Context, restrictionQueryId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.DeleteRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.DeleteRestrictionQuery") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// GetRestrictionQuery Get a restriction query. +// Get a restriction query in the organization specified by the restriction query's `restriction_query_id`. +func (a *LogsRestrictionQueriesApi) GetRestrictionQuery(ctx _context.Context, restrictionQueryId string) (RestrictionQueryWithRelationshipsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RestrictionQueryWithRelationshipsResponse + ) + + operationId := "v2.GetRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.GetRestrictionQuery") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetRoleRestrictionQuery Get restriction query for a given role. +// Get restriction query for a given role. +func (a *LogsRestrictionQueriesApi) GetRoleRestrictionQuery(ctx _context.Context, roleId string) (RestrictionQueryListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RestrictionQueryListResponse + ) + + operationId := "v2.GetRoleRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.GetRoleRestrictionQuery") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/role/{role_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{role_id}", _neturl.PathEscape(datadog.ParameterToString(roleId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListRestrictionQueriesOptionalParameters holds optional parameters for ListRestrictionQueries. +type ListRestrictionQueriesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 +} + +// NewListRestrictionQueriesOptionalParameters creates an empty struct for parameters. +func NewListRestrictionQueriesOptionalParameters() *ListRestrictionQueriesOptionalParameters { + this := ListRestrictionQueriesOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListRestrictionQueriesOptionalParameters) WithPageSize(pageSize int64) *ListRestrictionQueriesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListRestrictionQueriesOptionalParameters) WithPageNumber(pageNumber int64) *ListRestrictionQueriesOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// ListRestrictionQueries List restriction queries. +// Returns all restriction queries, including their names and IDs. +func (a *LogsRestrictionQueriesApi) ListRestrictionQueries(ctx _context.Context, o ...ListRestrictionQueriesOptionalParameters) (RestrictionQueryListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RestrictionQueryListResponse + optionalParams ListRestrictionQueriesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListRestrictionQueriesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListRestrictionQueries" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.ListRestrictionQueries") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListRestrictionQueryRolesOptionalParameters holds optional parameters for ListRestrictionQueryRoles. +type ListRestrictionQueryRolesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 +} + +// NewListRestrictionQueryRolesOptionalParameters creates an empty struct for parameters. +func NewListRestrictionQueryRolesOptionalParameters() *ListRestrictionQueryRolesOptionalParameters { + this := ListRestrictionQueryRolesOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListRestrictionQueryRolesOptionalParameters) WithPageSize(pageSize int64) *ListRestrictionQueryRolesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListRestrictionQueryRolesOptionalParameters) WithPageNumber(pageNumber int64) *ListRestrictionQueryRolesOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// ListRestrictionQueryRoles List roles for a restriction query. +// Returns all roles that have a given restriction query. +func (a *LogsRestrictionQueriesApi) ListRestrictionQueryRoles(ctx _context.Context, restrictionQueryId string, o ...ListRestrictionQueryRolesOptionalParameters) (RestrictionQueryRolesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RestrictionQueryRolesResponse + optionalParams ListRestrictionQueryRolesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListRestrictionQueryRolesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + operationId := "v2.ListRestrictionQueryRoles" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.ListRestrictionQueryRoles") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListUserRestrictionQueries Get all restriction queries for a given user. +// Get all restriction queries for a given user. +func (a *LogsRestrictionQueriesApi) ListUserRestrictionQueries(ctx _context.Context, userId string) (RestrictionQueryListResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue RestrictionQueryListResponse + ) + + operationId := "v2.ListUserRestrictionQueries" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.ListUserRestrictionQueries") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/user/{user_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{user_id}", _neturl.PathEscape(datadog.ParameterToString(userId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// RemoveRoleFromRestrictionQuery Revoke role from a restriction query. +// Removes a role from a restriction query. +func (a *LogsRestrictionQueriesApi) RemoveRoleFromRestrictionQuery(ctx _context.Context, restrictionQueryId string, body RelationshipToRole) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + operationId := "v2.RemoveRoleFromRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.RemoveRoleFromRestrictionQuery") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}/roles" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "*/*" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + +// ReplaceRestrictionQuery Replace a restriction query. +// Replace a restriction query. +func (a *LogsRestrictionQueriesApi) ReplaceRestrictionQuery(ctx _context.Context, restrictionQueryId string, body RestrictionQueryUpdatePayload) (RestrictionQueryWithoutRelationshipsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue RestrictionQueryWithoutRelationshipsResponse + ) + + operationId := "v2.ReplaceRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.ReplaceRestrictionQuery") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// UpdateRestrictionQuery Update a restriction query. +// Edit a restriction query. +func (a *LogsRestrictionQueriesApi) UpdateRestrictionQuery(ctx _context.Context, restrictionQueryId string, body RestrictionQueryUpdatePayload) (RestrictionQueryWithoutRelationshipsResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPatch + localVarPostBody interface{} + localVarReturnValue RestrictionQueryWithoutRelationshipsResponse + ) + + operationId := "v2.UpdateRestrictionQuery" + isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId) + if !isOperationEnabled { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)} + } + if isOperationEnabled && a.Client.Cfg.Debug { + _log.Printf("WARNING: Using unstable operation '%s'", operationId) + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.LogsRestrictionQueriesApi.UpdateRestrictionQuery") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/logs/config/restriction_queries/{restriction_query_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{restriction_query_id}", _neturl.PathEscape(datadog.ParameterToString(restrictionQueryId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewLogsRestrictionQueriesApi Returns NewLogsRestrictionQueriesApi. +func NewLogsRestrictionQueriesApi(client *datadog.APIClient) *LogsRestrictionQueriesApi { + return &LogsRestrictionQueriesApi{ + Client: client, + } +} diff --git a/api/datadogV2/api_teams.go b/api/datadogV2/api_teams.go index 7ba206ca691..8350d54acf4 100644 --- a/api/datadogV2/api_teams.go +++ b/api/datadogV2/api_teams.go @@ -21,6 +21,10 @@ type TeamsApi datadog.Service // AddMemberTeam Add a member team. // Add a member team. // Adds the team given by the `id` in the body as a member team of the super team. +// +// **Note**: This API is deprecated. For creating team hierarchy links, use the team hierarchy links API: `POST /api/v2/team-hierarchy-links`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) AddMemberTeam(ctx _context.Context, superTeamId string, body AddMemberTeamRequest) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodPost @@ -99,6 +103,86 @@ func (a *TeamsApi) AddMemberTeam(ctx _context.Context, superTeamId string, body return localVarHTTPResponse, nil } +// AddTeamHierarchyLink Create a team hierarchy link. +// Create a new team hierarchy link between a parent team and a sub team. +func (a *TeamsApi) AddTeamHierarchyLink(ctx _context.Context, body TeamHierarchyLinkCreateRequest) (TeamHierarchyLinkResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinkResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.AddTeamHierarchyLink") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 409 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // CreateTeam Create a team. // Create a new team. // User IDs passed through the `users` relationship field are added to the team. @@ -626,6 +710,84 @@ func (a *TeamsApi) GetTeam(ctx _context.Context, teamId string) (TeamResponse, * return localVarReturnValue, localVarHTTPResponse, nil } +// GetTeamHierarchyLink Get a team hierarchy link. +// Get a single team hierarchy link for the given link_id. +func (a *TeamsApi) GetTeamHierarchyLink(ctx _context.Context, linkId string) (TeamHierarchyLinkResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinkResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.GetTeamHierarchyLink") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links/{link_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{link_id}", _neturl.PathEscape(datadog.ParameterToString(linkId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + // GetTeamLink Get a team link. // Get a single link for a team. func (a *TeamsApi) GetTeamLink(ctx _context.Context, teamId string, linkId string) (TeamLinkResponse, *_nethttp.Response, error) { @@ -1244,6 +1406,11 @@ func (r *ListMemberTeamsOptionalParameters) WithFieldsTeam(fieldsTeam []TeamsFie // ListMemberTeams Get all member teams. // Get all member teams. +// +// **Note**: This API is deprecated. For team hierarchy relationships (parent-child +// teams), use the team hierarchy links API: `GET /api/v2/team-hierarchy-links`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) ListMemberTeams(ctx _context.Context, superTeamId string, o ...ListMemberTeamsOptionalParameters) (TeamsResponse, *_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodGet @@ -1394,6 +1561,189 @@ func (a *TeamsApi) ListMemberTeamsWithPagination(ctx _context.Context, superTeam return items, cancel } +// ListTeamHierarchyLinksOptionalParameters holds optional parameters for ListTeamHierarchyLinks. +type ListTeamHierarchyLinksOptionalParameters struct { + PageNumber *int64 + PageSize *int64 + FilterParentTeam *string + FilterSubTeam *string +} + +// NewListTeamHierarchyLinksOptionalParameters creates an empty struct for parameters. +func NewListTeamHierarchyLinksOptionalParameters() *ListTeamHierarchyLinksOptionalParameters { + this := ListTeamHierarchyLinksOptionalParameters{} + return &this +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithPageNumber(pageNumber int64) *ListTeamHierarchyLinksOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithPageSize(pageSize int64) *ListTeamHierarchyLinksOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithFilterParentTeam sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithFilterParentTeam(filterParentTeam string) *ListTeamHierarchyLinksOptionalParameters { + r.FilterParentTeam = &filterParentTeam + return r +} + +// WithFilterSubTeam sets the corresponding parameter name and returns the struct. +func (r *ListTeamHierarchyLinksOptionalParameters) WithFilterSubTeam(filterSubTeam string) *ListTeamHierarchyLinksOptionalParameters { + r.FilterSubTeam = &filterSubTeam + return r +} + +// ListTeamHierarchyLinks Get team hierarchy links. +// List all team hierarchy links that match the provided filters. +func (a *TeamsApi) ListTeamHierarchyLinks(ctx _context.Context, o ...ListTeamHierarchyLinksOptionalParameters) (TeamHierarchyLinksResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue TeamHierarchyLinksResponse + optionalParams ListTeamHierarchyLinksOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListTeamHierarchyLinksOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.ListTeamHierarchyLinks") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.FilterParentTeam != nil { + localVarQueryParams.Add("filter[parent_team]", datadog.ParameterToString(*optionalParams.FilterParentTeam, "")) + } + if optionalParams.FilterSubTeam != nil { + localVarQueryParams.Add("filter[sub_team]", datadog.ParameterToString(*optionalParams.FilterSubTeam, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return localVarReturnValue, nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListTeamHierarchyLinksWithPagination provides a paginated version of ListTeamHierarchyLinks returning a channel with all items. +func (a *TeamsApi) ListTeamHierarchyLinksWithPagination(ctx _context.Context, o ...ListTeamHierarchyLinksOptionalParameters) (<-chan datadog.PaginationResult[TeamHierarchyLink], func()) { + ctx, cancel := _context.WithCancel(ctx) + pageSize_ := int64(10) + if len(o) == 0 { + o = append(o, ListTeamHierarchyLinksOptionalParameters{}) + } + if o[0].PageSize != nil { + pageSize_ = *o[0].PageSize + } + o[0].PageSize = &pageSize_ + page_ := int64(0) + o[0].PageNumber = &page_ + + items := make(chan datadog.PaginationResult[TeamHierarchyLink], pageSize_) + go func() { + for { + resp, _, err := a.ListTeamHierarchyLinks(ctx, o...) + if err != nil { + var returnItem TeamHierarchyLink + items <- datadog.PaginationResult[TeamHierarchyLink]{Item: returnItem, Error: err} + break + } + respData, ok := resp.GetDataOk() + if !ok { + break + } + results := *respData + + for _, item := range results { + select { + case items <- datadog.PaginationResult[TeamHierarchyLink]{Item: item, Error: nil}: + case <-ctx.Done(): + close(items) + return + } + } + if len(results) < int(pageSize_) { + break + } + pageOffset_ := *o[0].PageNumber + 1 + o[0].PageNumber = &pageOffset_ + } + close(items) + }() + return items, cancel +} + // ListTeamsOptionalParameters holds optional parameters for ListTeams. type ListTeamsOptionalParameters struct { PageNumber *int64 @@ -1618,6 +1968,10 @@ func (a *TeamsApi) ListTeamsWithPagination(ctx _context.Context, o ...ListTeamsO // RemoveMemberTeam Remove a member team. // Remove a super team's member team identified by `member_team_id`. +// +// **Note**: This API is deprecated. For deleting team hierarchy links, use the team hierarchy links API: `DELETE /api/v2/team-hierarchy-links/{link_id}`. +// +// Deprecated: This API is deprecated. func (a *TeamsApi) RemoveMemberTeam(ctx _context.Context, superTeamId string, memberTeamId string) (*_nethttp.Response, error) { var ( localVarHTTPMethod = _nethttp.MethodDelete @@ -1694,6 +2048,74 @@ func (a *TeamsApi) RemoveMemberTeam(ctx _context.Context, superTeamId string, me return localVarHTTPResponse, nil } +// RemoveTeamHierarchyLink Remove a team hierarchy link. +// Remove a team hierarchy link by the given link_id. +func (a *TeamsApi) RemoveTeamHierarchyLink(ctx _context.Context, linkId string) (*_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodDelete + localVarPostBody interface{} + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.TeamsApi.RemoveTeamHierarchyLink") + if err != nil { + return nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/team-hierarchy-links/{link_id}" + localVarPath = datadog.ReplacePathParameter(localVarPath, "{link_id}", _neturl.PathEscape(datadog.ParameterToString(linkId, ""))) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "*/*" + + if a.Client.Cfg.DelegatedTokenConfig != nil { + err = datadog.UseDelegatedTokenAuth(ctx, &localVarHeaderParams, a.Client.Cfg.DelegatedTokenConfig) + if err != nil { + return nil, err + } + } else { + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + } + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarHTTPResponse, newErr + } + + return localVarHTTPResponse, nil +} + // SyncTeams Link Teams with GitHub Teams. // This endpoint attempts to link your existing Datadog teams with GitHub teams by matching their names. // It evaluates all current Datadog teams and compares them against teams in the GitHub organization diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index c5cf4723b97..072edd4c269 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -360,6 +360,17 @@ // - [LogsMetricsApi.GetLogsMetric] // - [LogsMetricsApi.ListLogsMetrics] // - [LogsMetricsApi.UpdateLogsMetric] +// - [LogsRestrictionQueriesApi.AddRoleToRestrictionQuery] +// - [LogsRestrictionQueriesApi.CreateRestrictionQuery] +// - [LogsRestrictionQueriesApi.DeleteRestrictionQuery] +// - [LogsRestrictionQueriesApi.GetRestrictionQuery] +// - [LogsRestrictionQueriesApi.GetRoleRestrictionQuery] +// - [LogsRestrictionQueriesApi.ListRestrictionQueries] +// - [LogsRestrictionQueriesApi.ListRestrictionQueryRoles] +// - [LogsRestrictionQueriesApi.ListUserRestrictionQueries] +// - [LogsRestrictionQueriesApi.RemoveRoleFromRestrictionQuery] +// - [LogsRestrictionQueriesApi.ReplaceRestrictionQuery] +// - [LogsRestrictionQueriesApi.UpdateRestrictionQuery] // - [MetricsApi.CreateBulkTagsMetricsConfiguration] // - [MetricsApi.CreateTagConfiguration] // - [MetricsApi.DeleteBulkTagsMetricsConfiguration] @@ -628,6 +639,7 @@ // - [TeamConnectionsApi.DeleteTeamConnections] // - [TeamConnectionsApi.ListTeamConnections] // - [TeamsApi.AddMemberTeam] +// - [TeamsApi.AddTeamHierarchyLink] // - [TeamsApi.CreateTeam] // - [TeamsApi.CreateTeamLink] // - [TeamsApi.CreateTeamMembership] @@ -635,6 +647,7 @@ // - [TeamsApi.DeleteTeamLink] // - [TeamsApi.DeleteTeamMembership] // - [TeamsApi.GetTeam] +// - [TeamsApi.GetTeamHierarchyLink] // - [TeamsApi.GetTeamLink] // - [TeamsApi.GetTeamLinks] // - [TeamsApi.GetTeamMemberships] @@ -642,8 +655,10 @@ // - [TeamsApi.GetTeamSync] // - [TeamsApi.GetUserMemberships] // - [TeamsApi.ListMemberTeams] +// - [TeamsApi.ListTeamHierarchyLinks] // - [TeamsApi.ListTeams] // - [TeamsApi.RemoveMemberTeam] +// - [TeamsApi.RemoveTeamHierarchyLink] // - [TeamsApi.SyncTeams] // - [TeamsApi.UpdateTeam] // - [TeamsApi.UpdateTeamLink] diff --git a/api/datadogV2/model_logs_restriction_queries_type.go b/api/datadogV2/model_logs_restriction_queries_type.go new file mode 100644 index 00000000000..eac117fa4a0 --- /dev/null +++ b/api/datadogV2/model_logs_restriction_queries_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// LogsRestrictionQueriesType Restriction query resource type. +type LogsRestrictionQueriesType string + +// List of LogsRestrictionQueriesType. +const ( + LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES LogsRestrictionQueriesType = "logs_restriction_queries" +) + +var allowedLogsRestrictionQueriesTypeEnumValues = []LogsRestrictionQueriesType{ + LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *LogsRestrictionQueriesType) GetAllowedValues() []LogsRestrictionQueriesType { + return allowedLogsRestrictionQueriesTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *LogsRestrictionQueriesType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = LogsRestrictionQueriesType(value) + return nil +} + +// NewLogsRestrictionQueriesTypeFromValue returns a pointer to a valid LogsRestrictionQueriesType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewLogsRestrictionQueriesTypeFromValue(v string) (*LogsRestrictionQueriesType, error) { + ev := LogsRestrictionQueriesType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for LogsRestrictionQueriesType: valid values are %v", v, allowedLogsRestrictionQueriesTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v LogsRestrictionQueriesType) IsValid() bool { + for _, existing := range allowedLogsRestrictionQueriesTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to LogsRestrictionQueriesType value. +func (v LogsRestrictionQueriesType) Ptr() *LogsRestrictionQueriesType { + return &v +} diff --git a/api/datadogV2/model_relationship_to_user_team_permission.go b/api/datadogV2/model_relationship_to_user_team_permission.go index ea13a1344f6..30dbb638065 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission.go +++ b/api/datadogV2/model_relationship_to_user_team_permission.go @@ -11,7 +11,7 @@ import ( // RelationshipToUserTeamPermission Relationship between a user team permission and a team type RelationshipToUserTeamPermission struct { // Related user team permission data - Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` + Data NullableRelationshipToUserTeamPermissionData `json:"data,omitempty"` // Links attributes. Links *TeamRelationshipsLinks `json:"links,omitempty"` // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct @@ -36,32 +36,43 @@ func NewRelationshipToUserTeamPermissionWithDefaults() *RelationshipToUserTeamPe return &this } -// GetData returns the Data field value if set, zero value otherwise. +// GetData returns the Data field value if set, zero value otherwise (both if not set or set to explicit null). func (o *RelationshipToUserTeamPermission) GetData() RelationshipToUserTeamPermissionData { - if o == nil || o.Data == nil { + if o == nil || o.Data.Get() == nil { var ret RelationshipToUserTeamPermissionData return ret } - return *o.Data + return *o.Data.Get() } // GetDataOk returns a tuple with the Data field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *RelationshipToUserTeamPermission) GetDataOk() (*RelationshipToUserTeamPermissionData, bool) { - if o == nil || o.Data == nil { + if o == nil { return nil, false } - return o.Data, true + return o.Data.Get(), o.Data.IsSet() } // HasData returns a boolean if a field has been set. func (o *RelationshipToUserTeamPermission) HasData() bool { - return o != nil && o.Data != nil + return o != nil && o.Data.IsSet() } -// SetData gets a reference to the given RelationshipToUserTeamPermissionData and assigns it to the Data field. +// SetData gets a reference to the given NullableRelationshipToUserTeamPermissionData and assigns it to the Data field. func (o *RelationshipToUserTeamPermission) SetData(v RelationshipToUserTeamPermissionData) { - o.Data = &v + o.Data.Set(&v) +} + +// SetDataNil sets the value for Data to be an explicit nil. +func (o *RelationshipToUserTeamPermission) SetDataNil() { + o.Data.Set(nil) +} + +// UnsetData ensures that no value is present for Data, not even an explicit nil. +func (o *RelationshipToUserTeamPermission) UnsetData() { + o.Data.Unset() } // GetLinks returns the Links field value if set, zero value otherwise. @@ -98,8 +109,8 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { if o.UnparsedObject != nil { return datadog.Marshal(o.UnparsedObject) } - if o.Data != nil { - toSerialize["data"] = o.Data + if o.Data.IsSet() { + toSerialize["data"] = o.Data.Get() } if o.Links != nil { toSerialize["links"] = o.Links @@ -114,8 +125,8 @@ func (o RelationshipToUserTeamPermission) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Data *RelationshipToUserTeamPermissionData `json:"data,omitempty"` - Links *TeamRelationshipsLinks `json:"links,omitempty"` + Data NullableRelationshipToUserTeamPermissionData `json:"data,omitempty"` + Links *TeamRelationshipsLinks `json:"links,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -128,9 +139,6 @@ func (o *RelationshipToUserTeamPermission) UnmarshalJSON(bytes []byte) (err erro } hasInvalidField := false - if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { - hasInvalidField = true - } o.Data = all.Data if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { hasInvalidField = true diff --git a/api/datadogV2/model_relationship_to_user_team_permission_data.go b/api/datadogV2/model_relationship_to_user_team_permission_data.go index 1573862c013..b7527ca83c3 100644 --- a/api/datadogV2/model_relationship_to_user_team_permission_data.go +++ b/api/datadogV2/model_relationship_to_user_team_permission_data.go @@ -143,3 +143,53 @@ func (o *RelationshipToUserTeamPermissionData) UnmarshalJSON(bytes []byte) (err return nil } + +// NullableRelationshipToUserTeamPermissionData handles when a null is used for RelationshipToUserTeamPermissionData. +type NullableRelationshipToUserTeamPermissionData struct { + value *RelationshipToUserTeamPermissionData + isSet bool +} + +// Get returns the associated value. +func (v NullableRelationshipToUserTeamPermissionData) Get() *RelationshipToUserTeamPermissionData { + return v.value +} + +// Set changes the value and indicates it's been called. +func (v *NullableRelationshipToUserTeamPermissionData) Set(val *RelationshipToUserTeamPermissionData) { + v.value = val + v.isSet = true +} + +// IsSet returns whether Set has been called. +func (v NullableRelationshipToUserTeamPermissionData) IsSet() bool { + return v.isSet +} + +// Unset sets the value to nil and resets the set flag/ +func (v *NullableRelationshipToUserTeamPermissionData) Unset() { + v.value = nil + v.isSet = false +} + +// NewNullableRelationshipToUserTeamPermissionData initializes the struct as if Set has been called. +func NewNullableRelationshipToUserTeamPermissionData(val *RelationshipToUserTeamPermissionData) *NullableRelationshipToUserTeamPermissionData { + return &NullableRelationshipToUserTeamPermissionData{value: val, isSet: true} +} + +// MarshalJSON serializes the associated value. +func (v NullableRelationshipToUserTeamPermissionData) MarshalJSON() ([]byte, error) { + return datadog.Marshal(v.value) +} + +// UnmarshalJSON deserializes the payload and sets the flag as if Set has been called. +func (v *NullableRelationshipToUserTeamPermissionData) UnmarshalJSON(src []byte) error { + v.isSet = true + + // this object is nullable so check if the payload is null or empty string + if string(src) == "" || string(src) == "{}" { + return nil + } + + return datadog.Unmarshal(src, &v.value) +} diff --git a/api/datadogV2/model_restriction_query_attributes.go b/api/datadogV2/model_restriction_query_attributes.go new file mode 100644 index 00000000000..f8fdba856a5 --- /dev/null +++ b/api/datadogV2/model_restriction_query_attributes.go @@ -0,0 +1,322 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryAttributes Attributes of the restriction query. +type RestrictionQueryAttributes struct { + // Creation time of the restriction query. + CreatedAt *time.Time `json:"created_at,omitempty"` + // Email of the user who last modified this restriction query. + LastModifierEmail *string `json:"last_modifier_email,omitempty"` + // Name of the user who last modified this restriction query. + LastModifierName *string `json:"last_modifier_name,omitempty"` + // Time of last restriction query modification. + ModifiedAt *time.Time `json:"modified_at,omitempty"` + // The query that defines the restriction. Only the content matching the query can be returned. + RestrictionQuery *string `json:"restriction_query,omitempty"` + // Number of roles associated with this restriction query. + RoleCount *int64 `json:"role_count,omitempty"` + // Number of users associated with this restriction query. + UserCount *int64 `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{} `json:"-"` +} + +// NewRestrictionQueryAttributes instantiates a new RestrictionQueryAttributes 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 NewRestrictionQueryAttributes() *RestrictionQueryAttributes { + this := RestrictionQueryAttributes{} + return &this +} + +// NewRestrictionQueryAttributesWithDefaults instantiates a new RestrictionQueryAttributes 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 NewRestrictionQueryAttributesWithDefaults() *RestrictionQueryAttributes { + this := RestrictionQueryAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetCreatedAt() time.Time { + if o == nil || o.CreatedAt == nil { + var ret time.Time + return ret + } + return *o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil || o.CreatedAt == nil { + return nil, false + } + return o.CreatedAt, true +} + +// HasCreatedAt returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasCreatedAt() bool { + return o != nil && o.CreatedAt != nil +} + +// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field. +func (o *RestrictionQueryAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = &v +} + +// GetLastModifierEmail returns the LastModifierEmail field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetLastModifierEmail() string { + if o == nil || o.LastModifierEmail == nil { + var ret string + return ret + } + return *o.LastModifierEmail +} + +// GetLastModifierEmailOk returns a tuple with the LastModifierEmail field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetLastModifierEmailOk() (*string, bool) { + if o == nil || o.LastModifierEmail == nil { + return nil, false + } + return o.LastModifierEmail, true +} + +// HasLastModifierEmail returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasLastModifierEmail() bool { + return o != nil && o.LastModifierEmail != nil +} + +// SetLastModifierEmail gets a reference to the given string and assigns it to the LastModifierEmail field. +func (o *RestrictionQueryAttributes) SetLastModifierEmail(v string) { + o.LastModifierEmail = &v +} + +// GetLastModifierName returns the LastModifierName field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetLastModifierName() string { + if o == nil || o.LastModifierName == nil { + var ret string + return ret + } + return *o.LastModifierName +} + +// GetLastModifierNameOk returns a tuple with the LastModifierName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetLastModifierNameOk() (*string, bool) { + if o == nil || o.LastModifierName == nil { + return nil, false + } + return o.LastModifierName, true +} + +// HasLastModifierName returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasLastModifierName() bool { + return o != nil && o.LastModifierName != nil +} + +// SetLastModifierName gets a reference to the given string and assigns it to the LastModifierName field. +func (o *RestrictionQueryAttributes) SetLastModifierName(v string) { + o.LastModifierName = &v +} + +// GetModifiedAt returns the ModifiedAt field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetModifiedAt() time.Time { + if o == nil || o.ModifiedAt == nil { + var ret time.Time + return ret + } + return *o.ModifiedAt +} + +// GetModifiedAtOk returns a tuple with the ModifiedAt field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetModifiedAtOk() (*time.Time, bool) { + if o == nil || o.ModifiedAt == nil { + return nil, false + } + return o.ModifiedAt, true +} + +// HasModifiedAt returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasModifiedAt() bool { + return o != nil && o.ModifiedAt != nil +} + +// SetModifiedAt gets a reference to the given time.Time and assigns it to the ModifiedAt field. +func (o *RestrictionQueryAttributes) SetModifiedAt(v time.Time) { + o.ModifiedAt = &v +} + +// GetRestrictionQuery returns the RestrictionQuery field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetRestrictionQuery() string { + if o == nil || o.RestrictionQuery == nil { + var ret string + return ret + } + return *o.RestrictionQuery +} + +// GetRestrictionQueryOk returns a tuple with the RestrictionQuery field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetRestrictionQueryOk() (*string, bool) { + if o == nil || o.RestrictionQuery == nil { + return nil, false + } + return o.RestrictionQuery, true +} + +// HasRestrictionQuery returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasRestrictionQuery() bool { + return o != nil && o.RestrictionQuery != nil +} + +// SetRestrictionQuery gets a reference to the given string and assigns it to the RestrictionQuery field. +func (o *RestrictionQueryAttributes) SetRestrictionQuery(v string) { + o.RestrictionQuery = &v +} + +// GetRoleCount returns the RoleCount field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetRoleCount() int64 { + if o == nil || o.RoleCount == nil { + var ret int64 + return ret + } + return *o.RoleCount +} + +// GetRoleCountOk returns a tuple with the RoleCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryAttributes) GetRoleCountOk() (*int64, bool) { + if o == nil || o.RoleCount == nil { + return nil, false + } + return o.RoleCount, true +} + +// HasRoleCount returns a boolean if a field has been set. +func (o *RestrictionQueryAttributes) HasRoleCount() bool { + return o != nil && o.RoleCount != nil +} + +// SetRoleCount gets a reference to the given int64 and assigns it to the RoleCount field. +func (o *RestrictionQueryAttributes) SetRoleCount(v int64) { + o.RoleCount = &v +} + +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *RestrictionQueryAttributes) GetUserCount() int64 { + if o == nil || o.UserCount == nil { + var ret int64 + 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 *RestrictionQueryAttributes) GetUserCountOk() (*int64, 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 *RestrictionQueryAttributes) HasUserCount() bool { + return o != nil && o.UserCount != nil +} + +// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. +func (o *RestrictionQueryAttributes) SetUserCount(v int64) { + o.UserCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt != nil { + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.LastModifierEmail != nil { + toSerialize["last_modifier_email"] = o.LastModifierEmail + } + if o.LastModifierName != nil { + toSerialize["last_modifier_name"] = o.LastModifierName + } + if o.ModifiedAt != nil { + if o.ModifiedAt.Nanosecond() == 0 { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["modified_at"] = o.ModifiedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + } + if o.RestrictionQuery != nil { + toSerialize["restriction_query"] = o.RestrictionQuery + } + if o.RoleCount != nil { + toSerialize["role_count"] = o.RoleCount + } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at,omitempty"` + LastModifierEmail *string `json:"last_modifier_email,omitempty"` + LastModifierName *string `json:"last_modifier_name,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + RestrictionQuery *string `json:"restriction_query,omitempty"` + RoleCount *int64 `json:"role_count,omitempty"` + UserCount *int64 `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", "last_modifier_email", "last_modifier_name", "modified_at", "restriction_query", "role_count", "user_count"}) + } else { + return err + } + o.CreatedAt = all.CreatedAt + o.LastModifierEmail = all.LastModifierEmail + o.LastModifierName = all.LastModifierName + o.ModifiedAt = all.ModifiedAt + o.RestrictionQuery = all.RestrictionQuery + o.RoleCount = all.RoleCount + o.UserCount = all.UserCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_create_attributes.go b/api/datadogV2/model_restriction_query_create_attributes.go new file mode 100644 index 00000000000..12b4a644cb7 --- /dev/null +++ b/api/datadogV2/model_restriction_query_create_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryCreateAttributes Attributes of the created restriction query. +type RestrictionQueryCreateAttributes struct { + // The restriction query. + RestrictionQuery string `json:"restriction_query"` + // 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{} `json:"-"` +} + +// NewRestrictionQueryCreateAttributes instantiates a new RestrictionQueryCreateAttributes 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 NewRestrictionQueryCreateAttributes(restrictionQuery string) *RestrictionQueryCreateAttributes { + this := RestrictionQueryCreateAttributes{} + this.RestrictionQuery = restrictionQuery + return &this +} + +// NewRestrictionQueryCreateAttributesWithDefaults instantiates a new RestrictionQueryCreateAttributes 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 NewRestrictionQueryCreateAttributesWithDefaults() *RestrictionQueryCreateAttributes { + this := RestrictionQueryCreateAttributes{} + return &this +} + +// GetRestrictionQuery returns the RestrictionQuery field value. +func (o *RestrictionQueryCreateAttributes) GetRestrictionQuery() string { + if o == nil { + var ret string + return ret + } + return o.RestrictionQuery +} + +// GetRestrictionQueryOk returns a tuple with the RestrictionQuery field value +// and a boolean to check if the value has been set. +func (o *RestrictionQueryCreateAttributes) GetRestrictionQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RestrictionQuery, true +} + +// SetRestrictionQuery sets field value. +func (o *RestrictionQueryCreateAttributes) SetRestrictionQuery(v string) { + o.RestrictionQuery = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryCreateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["restriction_query"] = o.RestrictionQuery + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryCreateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + RestrictionQuery *string `json:"restriction_query"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.RestrictionQuery == nil { + return fmt.Errorf("required field restriction_query missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"restriction_query"}) + } else { + return err + } + o.RestrictionQuery = *all.RestrictionQuery + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_create_data.go b/api/datadogV2/model_restriction_query_create_data.go new file mode 100644 index 00000000000..c97c1a6206b --- /dev/null +++ b/api/datadogV2/model_restriction_query_create_data.go @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryCreateData Data related to the creation of a restriction query. +type RestrictionQueryCreateData struct { + // Attributes of the created restriction query. + Attributes *RestrictionQueryCreateAttributes `json:"attributes,omitempty"` + // Restriction query resource type. + Type *LogsRestrictionQueriesType `json:"type,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{} `json:"-"` +} + +// NewRestrictionQueryCreateData instantiates a new RestrictionQueryCreateData 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 NewRestrictionQueryCreateData() *RestrictionQueryCreateData { + this := RestrictionQueryCreateData{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// NewRestrictionQueryCreateDataWithDefaults instantiates a new RestrictionQueryCreateData 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 NewRestrictionQueryCreateDataWithDefaults() *RestrictionQueryCreateData { + this := RestrictionQueryCreateData{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RestrictionQueryCreateData) GetAttributes() RestrictionQueryCreateAttributes { + if o == nil || o.Attributes == nil { + var ret RestrictionQueryCreateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryCreateData) GetAttributesOk() (*RestrictionQueryCreateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RestrictionQueryCreateData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given RestrictionQueryCreateAttributes and assigns it to the Attributes field. +func (o *RestrictionQueryCreateData) SetAttributes(v RestrictionQueryCreateAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RestrictionQueryCreateData) GetType() LogsRestrictionQueriesType { + if o == nil || o.Type == nil { + var ret LogsRestrictionQueriesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryCreateData) GetTypeOk() (*LogsRestrictionQueriesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RestrictionQueryCreateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given LogsRestrictionQueriesType and assigns it to the Type field. +func (o *RestrictionQueryCreateData) SetType(v LogsRestrictionQueriesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryCreateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryCreateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RestrictionQueryCreateAttributes `json:"attributes,omitempty"` + Type *LogsRestrictionQueriesType `json:"type,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{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_create_payload.go b/api/datadogV2/model_restriction_query_create_payload.go new file mode 100644 index 00000000000..e5b8a4e4ff6 --- /dev/null +++ b/api/datadogV2/model_restriction_query_create_payload.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryCreatePayload Create a restriction query. +type RestrictionQueryCreatePayload struct { + // Data related to the creation of a restriction query. + Data *RestrictionQueryCreateData `json:"data,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{} `json:"-"` +} + +// NewRestrictionQueryCreatePayload instantiates a new RestrictionQueryCreatePayload 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 NewRestrictionQueryCreatePayload() *RestrictionQueryCreatePayload { + this := RestrictionQueryCreatePayload{} + return &this +} + +// NewRestrictionQueryCreatePayloadWithDefaults instantiates a new RestrictionQueryCreatePayload 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 NewRestrictionQueryCreatePayloadWithDefaults() *RestrictionQueryCreatePayload { + this := RestrictionQueryCreatePayload{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryCreatePayload) GetData() RestrictionQueryCreateData { + if o == nil || o.Data == nil { + var ret RestrictionQueryCreateData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryCreatePayload) GetDataOk() (*RestrictionQueryCreateData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryCreatePayload) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given RestrictionQueryCreateData and assigns it to the Data field. +func (o *RestrictionQueryCreatePayload) SetData(v RestrictionQueryCreateData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryCreatePayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryCreatePayload) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RestrictionQueryCreateData `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_list_response.go b/api/datadogV2/model_restriction_query_list_response.go new file mode 100644 index 00000000000..196a3f6c6d8 --- /dev/null +++ b/api/datadogV2/model_restriction_query_list_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryListResponse Response containing information about multiple restriction queries. +type RestrictionQueryListResponse struct { + // Array of returned restriction queries. + Data []RestrictionQueryWithoutRelationships `json:"data,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{} `json:"-"` +} + +// NewRestrictionQueryListResponse instantiates a new RestrictionQueryListResponse 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 NewRestrictionQueryListResponse() *RestrictionQueryListResponse { + this := RestrictionQueryListResponse{} + return &this +} + +// NewRestrictionQueryListResponseWithDefaults instantiates a new RestrictionQueryListResponse 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 NewRestrictionQueryListResponseWithDefaults() *RestrictionQueryListResponse { + this := RestrictionQueryListResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryListResponse) GetData() []RestrictionQueryWithoutRelationships { + if o == nil || o.Data == nil { + var ret []RestrictionQueryWithoutRelationships + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryListResponse) GetDataOk() (*[]RestrictionQueryWithoutRelationships, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryListResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []RestrictionQueryWithoutRelationships and assigns it to the Data field. +func (o *RestrictionQueryListResponse) SetData(v []RestrictionQueryWithoutRelationships) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryListResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryListResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []RestrictionQueryWithoutRelationships `json:"data,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{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_response_included_item.go b/api/datadogV2/model_restriction_query_response_included_item.go new file mode 100644 index 00000000000..091d959823a --- /dev/null +++ b/api/datadogV2/model_restriction_query_response_included_item.go @@ -0,0 +1,73 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryResponseIncludedItem - An object related to a restriction query. +type RestrictionQueryResponseIncludedItem struct { + RestrictionQueryRole *RestrictionQueryRole + + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject interface{} +} + +// RestrictionQueryRoleAsRestrictionQueryResponseIncludedItem is a convenience function that returns RestrictionQueryRole wrapped in RestrictionQueryResponseIncludedItem. +func RestrictionQueryRoleAsRestrictionQueryResponseIncludedItem(v *RestrictionQueryRole) RestrictionQueryResponseIncludedItem { + return RestrictionQueryResponseIncludedItem{RestrictionQueryRole: v} +} + +// UnmarshalJSON turns data into one of the pointers in the struct. +func (obj *RestrictionQueryResponseIncludedItem) UnmarshalJSON(data []byte) error { + var err error + match := 0 + // try to unmarshal data into RestrictionQueryRole + err = datadog.Unmarshal(data, &obj.RestrictionQueryRole) + if err == nil { + if obj.RestrictionQueryRole != nil && obj.RestrictionQueryRole.UnparsedObject == nil { + jsonRestrictionQueryRole, _ := datadog.Marshal(obj.RestrictionQueryRole) + if string(jsonRestrictionQueryRole) == "{}" { // empty struct + obj.RestrictionQueryRole = nil + } else { + match++ + } + } else { + obj.RestrictionQueryRole = nil + } + } else { + obj.RestrictionQueryRole = nil + } + + if match != 1 { // more than 1 match + // reset to nil + obj.RestrictionQueryRole = nil + return datadog.Unmarshal(data, &obj.UnparsedObject) + } + return nil // exactly one match +} + +// MarshalJSON turns data from the first non-nil pointers in the struct to JSON. +func (obj RestrictionQueryResponseIncludedItem) MarshalJSON() ([]byte, error) { + if obj.RestrictionQueryRole != nil { + return datadog.Marshal(&obj.RestrictionQueryRole) + } + + if obj.UnparsedObject != nil { + return datadog.Marshal(obj.UnparsedObject) + } + return nil, nil // no data in oneOf schemas +} + +// GetActualInstance returns the actual instance. +func (obj *RestrictionQueryResponseIncludedItem) GetActualInstance() interface{} { + if obj.RestrictionQueryRole != nil { + return obj.RestrictionQueryRole + } + + // all schemas are nil + return nil +} diff --git a/api/datadogV2/model_restriction_query_role.go b/api/datadogV2/model_restriction_query_role.go new file mode 100644 index 00000000000..babb2203879 --- /dev/null +++ b/api/datadogV2/model_restriction_query_role.go @@ -0,0 +1,180 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryRole Partial role object. +type RestrictionQueryRole struct { + // Attributes of the role for a restriction query. + Attributes RestrictionQueryRoleAttribute `json:"attributes"` + // ID of the role. + Id string `json:"id"` + // Roles type. + Type RolesType `json:"type"` + // 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{} `json:"-"` +} + +// NewRestrictionQueryRole instantiates a new RestrictionQueryRole 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 NewRestrictionQueryRole(attributes RestrictionQueryRoleAttribute, id string, typeVar RolesType) *RestrictionQueryRole { + this := RestrictionQueryRole{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewRestrictionQueryRoleWithDefaults instantiates a new RestrictionQueryRole 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 NewRestrictionQueryRoleWithDefaults() *RestrictionQueryRole { + this := RestrictionQueryRole{} + var typeVar RolesType = ROLESTYPE_ROLES + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *RestrictionQueryRole) GetAttributes() RestrictionQueryRoleAttribute { + if o == nil { + var ret RestrictionQueryRoleAttribute + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *RestrictionQueryRole) GetAttributesOk() (*RestrictionQueryRoleAttribute, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *RestrictionQueryRole) SetAttributes(v RestrictionQueryRoleAttribute) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *RestrictionQueryRole) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *RestrictionQueryRole) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *RestrictionQueryRole) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *RestrictionQueryRole) GetType() RolesType { + if o == nil { + var ret RolesType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *RestrictionQueryRole) GetTypeOk() (*RolesType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *RestrictionQueryRole) SetType(v RolesType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryRole) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryRole) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RestrictionQueryRoleAttribute `json:"attributes"` + Id *string `json:"id"` + Type *RolesType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_role_attribute.go b/api/datadogV2/model_restriction_query_role_attribute.go new file mode 100644 index 00000000000..24219dae682 --- /dev/null +++ b/api/datadogV2/model_restriction_query_role_attribute.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryRoleAttribute Attributes of the role for a restriction query. +type RestrictionQueryRoleAttribute struct { + // The role name. + Name *string `json:"name,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{} `json:"-"` +} + +// NewRestrictionQueryRoleAttribute instantiates a new RestrictionQueryRoleAttribute 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 NewRestrictionQueryRoleAttribute() *RestrictionQueryRoleAttribute { + this := RestrictionQueryRoleAttribute{} + return &this +} + +// NewRestrictionQueryRoleAttributeWithDefaults instantiates a new RestrictionQueryRoleAttribute 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 NewRestrictionQueryRoleAttributeWithDefaults() *RestrictionQueryRoleAttribute { + this := RestrictionQueryRoleAttribute{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *RestrictionQueryRoleAttribute) GetName() string { + if o == nil || o.Name == nil { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryRoleAttribute) GetNameOk() (*string, bool) { + if o == nil || o.Name == nil { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *RestrictionQueryRoleAttribute) HasName() bool { + return o != nil && o.Name != nil +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *RestrictionQueryRoleAttribute) SetName(v string) { + o.Name = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryRoleAttribute) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Name != nil { + toSerialize["name"] = o.Name + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryRoleAttribute) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Name *string `json:"name,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{"name"}) + } else { + return err + } + o.Name = all.Name + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_roles_response.go b/api/datadogV2/model_restriction_query_roles_response.go new file mode 100644 index 00000000000..5fed0aeb8d9 --- /dev/null +++ b/api/datadogV2/model_restriction_query_roles_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryRolesResponse Response containing information about roles attached to a restriction query. +type RestrictionQueryRolesResponse struct { + // Array of roles. + Data []RestrictionQueryRole `json:"data,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{} `json:"-"` +} + +// NewRestrictionQueryRolesResponse instantiates a new RestrictionQueryRolesResponse 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 NewRestrictionQueryRolesResponse() *RestrictionQueryRolesResponse { + this := RestrictionQueryRolesResponse{} + return &this +} + +// NewRestrictionQueryRolesResponseWithDefaults instantiates a new RestrictionQueryRolesResponse 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 NewRestrictionQueryRolesResponseWithDefaults() *RestrictionQueryRolesResponse { + this := RestrictionQueryRolesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryRolesResponse) GetData() []RestrictionQueryRole { + if o == nil || o.Data == nil { + var ret []RestrictionQueryRole + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryRolesResponse) GetDataOk() (*[]RestrictionQueryRole, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryRolesResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []RestrictionQueryRole and assigns it to the Data field. +func (o *RestrictionQueryRolesResponse) SetData(v []RestrictionQueryRole) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryRolesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryRolesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []RestrictionQueryRole `json:"data,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{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_update_attributes.go b/api/datadogV2/model_restriction_query_update_attributes.go new file mode 100644 index 00000000000..6aaf698a9e9 --- /dev/null +++ b/api/datadogV2/model_restriction_query_update_attributes.go @@ -0,0 +1,101 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryUpdateAttributes Attributes of the edited restriction query. +type RestrictionQueryUpdateAttributes struct { + // The restriction query. + RestrictionQuery string `json:"restriction_query"` + // 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{} `json:"-"` +} + +// NewRestrictionQueryUpdateAttributes instantiates a new RestrictionQueryUpdateAttributes 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 NewRestrictionQueryUpdateAttributes(restrictionQuery string) *RestrictionQueryUpdateAttributes { + this := RestrictionQueryUpdateAttributes{} + this.RestrictionQuery = restrictionQuery + return &this +} + +// NewRestrictionQueryUpdateAttributesWithDefaults instantiates a new RestrictionQueryUpdateAttributes 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 NewRestrictionQueryUpdateAttributesWithDefaults() *RestrictionQueryUpdateAttributes { + this := RestrictionQueryUpdateAttributes{} + return &this +} + +// GetRestrictionQuery returns the RestrictionQuery field value. +func (o *RestrictionQueryUpdateAttributes) GetRestrictionQuery() string { + if o == nil { + var ret string + return ret + } + return o.RestrictionQuery +} + +// GetRestrictionQueryOk returns a tuple with the RestrictionQuery field value +// and a boolean to check if the value has been set. +func (o *RestrictionQueryUpdateAttributes) GetRestrictionQueryOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RestrictionQuery, true +} + +// SetRestrictionQuery sets field value. +func (o *RestrictionQueryUpdateAttributes) SetRestrictionQuery(v string) { + o.RestrictionQuery = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryUpdateAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["restriction_query"] = o.RestrictionQuery + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryUpdateAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + RestrictionQuery *string `json:"restriction_query"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.RestrictionQuery == nil { + return fmt.Errorf("required field restriction_query missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"restriction_query"}) + } else { + return err + } + o.RestrictionQuery = *all.RestrictionQuery + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_update_data.go b/api/datadogV2/model_restriction_query_update_data.go new file mode 100644 index 00000000000..d657fe51f11 --- /dev/null +++ b/api/datadogV2/model_restriction_query_update_data.go @@ -0,0 +1,154 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryUpdateData Data related to the update of a restriction query. +type RestrictionQueryUpdateData struct { + // Attributes of the edited restriction query. + Attributes *RestrictionQueryUpdateAttributes `json:"attributes,omitempty"` + // Restriction query resource type. + Type *LogsRestrictionQueriesType `json:"type,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{} `json:"-"` +} + +// NewRestrictionQueryUpdateData instantiates a new RestrictionQueryUpdateData 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 NewRestrictionQueryUpdateData() *RestrictionQueryUpdateData { + this := RestrictionQueryUpdateData{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// NewRestrictionQueryUpdateDataWithDefaults instantiates a new RestrictionQueryUpdateData 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 NewRestrictionQueryUpdateDataWithDefaults() *RestrictionQueryUpdateData { + this := RestrictionQueryUpdateData{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RestrictionQueryUpdateData) GetAttributes() RestrictionQueryUpdateAttributes { + if o == nil || o.Attributes == nil { + var ret RestrictionQueryUpdateAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryUpdateData) GetAttributesOk() (*RestrictionQueryUpdateAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RestrictionQueryUpdateData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given RestrictionQueryUpdateAttributes and assigns it to the Attributes field. +func (o *RestrictionQueryUpdateData) SetAttributes(v RestrictionQueryUpdateAttributes) { + o.Attributes = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RestrictionQueryUpdateData) GetType() LogsRestrictionQueriesType { + if o == nil || o.Type == nil { + var ret LogsRestrictionQueriesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryUpdateData) GetTypeOk() (*LogsRestrictionQueriesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RestrictionQueryUpdateData) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given LogsRestrictionQueriesType and assigns it to the Type field. +func (o *RestrictionQueryUpdateData) SetType(v LogsRestrictionQueriesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryUpdateData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryUpdateData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RestrictionQueryUpdateAttributes `json:"attributes,omitempty"` + Type *LogsRestrictionQueriesType `json:"type,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{"attributes", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_update_payload.go b/api/datadogV2/model_restriction_query_update_payload.go new file mode 100644 index 00000000000..e485304ca08 --- /dev/null +++ b/api/datadogV2/model_restriction_query_update_payload.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryUpdatePayload Update a restriction query. +type RestrictionQueryUpdatePayload struct { + // Data related to the update of a restriction query. + Data *RestrictionQueryUpdateData `json:"data,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{} `json:"-"` +} + +// NewRestrictionQueryUpdatePayload instantiates a new RestrictionQueryUpdatePayload 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 NewRestrictionQueryUpdatePayload() *RestrictionQueryUpdatePayload { + this := RestrictionQueryUpdatePayload{} + return &this +} + +// NewRestrictionQueryUpdatePayloadWithDefaults instantiates a new RestrictionQueryUpdatePayload 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 NewRestrictionQueryUpdatePayloadWithDefaults() *RestrictionQueryUpdatePayload { + this := RestrictionQueryUpdatePayload{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryUpdatePayload) GetData() RestrictionQueryUpdateData { + if o == nil || o.Data == nil { + var ret RestrictionQueryUpdateData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryUpdatePayload) GetDataOk() (*RestrictionQueryUpdateData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryUpdatePayload) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given RestrictionQueryUpdateData and assigns it to the Data field. +func (o *RestrictionQueryUpdatePayload) SetData(v RestrictionQueryUpdateData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryUpdatePayload) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryUpdatePayload) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RestrictionQueryUpdateData `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_with_relationships.go b/api/datadogV2/model_restriction_query_with_relationships.go new file mode 100644 index 00000000000..28fcf0f65e5 --- /dev/null +++ b/api/datadogV2/model_restriction_query_with_relationships.go @@ -0,0 +1,227 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryWithRelationships Restriction query object returned by the API. +type RestrictionQueryWithRelationships struct { + // Attributes of the restriction query. + Attributes *RestrictionQueryAttributes `json:"attributes,omitempty"` + // ID of the restriction query. + Id *string `json:"id,omitempty"` + // Relationships of the user object. + Relationships *UserRelationships `json:"relationships,omitempty"` + // Restriction query resource type. + Type *LogsRestrictionQueriesType `json:"type,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{} `json:"-"` +} + +// NewRestrictionQueryWithRelationships instantiates a new RestrictionQueryWithRelationships 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 NewRestrictionQueryWithRelationships() *RestrictionQueryWithRelationships { + this := RestrictionQueryWithRelationships{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// NewRestrictionQueryWithRelationshipsWithDefaults instantiates a new RestrictionQueryWithRelationships 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 NewRestrictionQueryWithRelationshipsWithDefaults() *RestrictionQueryWithRelationships { + this := RestrictionQueryWithRelationships{} + var typeVar LogsRestrictionQueriesType = LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES + this.Type = &typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationships) GetAttributes() RestrictionQueryAttributes { + if o == nil || o.Attributes == nil { + var ret RestrictionQueryAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationships) GetAttributesOk() (*RestrictionQueryAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationships) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given RestrictionQueryAttributes and assigns it to the Attributes field. +func (o *RestrictionQueryWithRelationships) SetAttributes(v RestrictionQueryAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationships) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationships) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationships) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RestrictionQueryWithRelationships) SetId(v string) { + o.Id = &v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationships) GetRelationships() UserRelationships { + if o == nil || o.Relationships == nil { + var ret UserRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationships) GetRelationshipsOk() (*UserRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationships) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given UserRelationships and assigns it to the Relationships field. +func (o *RestrictionQueryWithRelationships) SetRelationships(v UserRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationships) GetType() LogsRestrictionQueriesType { + if o == nil || o.Type == nil { + var ret LogsRestrictionQueriesType + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationships) GetTypeOk() (*LogsRestrictionQueriesType, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationships) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given LogsRestrictionQueriesType and assigns it to the Type field. +func (o *RestrictionQueryWithRelationships) SetType(v LogsRestrictionQueriesType) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryWithRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryWithRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RestrictionQueryAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Relationships *UserRelationships `json:"relationships,omitempty"` + Type *LogsRestrictionQueriesType `json:"type,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{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if all.Type != nil && !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_with_relationships_response.go b/api/datadogV2/model_restriction_query_with_relationships_response.go new file mode 100644 index 00000000000..5d5457fd187 --- /dev/null +++ b/api/datadogV2/model_restriction_query_with_relationships_response.go @@ -0,0 +1,146 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryWithRelationshipsResponse Response containing information about a single restriction query. +type RestrictionQueryWithRelationshipsResponse struct { + // Restriction query object returned by the API. + Data *RestrictionQueryWithRelationships `json:"data,omitempty"` + // Array of objects related to the restriction query. + Included []RestrictionQueryResponseIncludedItem `json:"included,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{} `json:"-"` +} + +// NewRestrictionQueryWithRelationshipsResponse instantiates a new RestrictionQueryWithRelationshipsResponse 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 NewRestrictionQueryWithRelationshipsResponse() *RestrictionQueryWithRelationshipsResponse { + this := RestrictionQueryWithRelationshipsResponse{} + return &this +} + +// NewRestrictionQueryWithRelationshipsResponseWithDefaults instantiates a new RestrictionQueryWithRelationshipsResponse 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 NewRestrictionQueryWithRelationshipsResponseWithDefaults() *RestrictionQueryWithRelationshipsResponse { + this := RestrictionQueryWithRelationshipsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationshipsResponse) GetData() RestrictionQueryWithRelationships { + if o == nil || o.Data == nil { + var ret RestrictionQueryWithRelationships + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationshipsResponse) GetDataOk() (*RestrictionQueryWithRelationships, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationshipsResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given RestrictionQueryWithRelationships and assigns it to the Data field. +func (o *RestrictionQueryWithRelationshipsResponse) SetData(v RestrictionQueryWithRelationships) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *RestrictionQueryWithRelationshipsResponse) GetIncluded() []RestrictionQueryResponseIncludedItem { + if o == nil || o.Included == nil { + var ret []RestrictionQueryResponseIncludedItem + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithRelationshipsResponse) GetIncludedOk() (*[]RestrictionQueryResponseIncludedItem, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *RestrictionQueryWithRelationshipsResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []RestrictionQueryResponseIncludedItem and assigns it to the Included field. +func (o *RestrictionQueryWithRelationshipsResponse) SetIncluded(v []RestrictionQueryResponseIncludedItem) { + o.Included = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryWithRelationshipsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryWithRelationshipsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RestrictionQueryWithRelationships `json:"data,omitempty"` + Included []RestrictionQueryResponseIncludedItem `json:"included,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{"data", "included"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + o.Included = all.Included + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_without_relationships.go b/api/datadogV2/model_restriction_query_without_relationships.go new file mode 100644 index 00000000000..166df8dc485 --- /dev/null +++ b/api/datadogV2/model_restriction_query_without_relationships.go @@ -0,0 +1,181 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryWithoutRelationships Restriction query object returned by the API. +type RestrictionQueryWithoutRelationships struct { + // Attributes of the restriction query. + Attributes *RestrictionQueryAttributes `json:"attributes,omitempty"` + // ID of the restriction query. + Id *string `json:"id,omitempty"` + // Restriction queries type. + Type *string `json:"type,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{} `json:"-"` +} + +// NewRestrictionQueryWithoutRelationships instantiates a new RestrictionQueryWithoutRelationships 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 NewRestrictionQueryWithoutRelationships() *RestrictionQueryWithoutRelationships { + this := RestrictionQueryWithoutRelationships{} + return &this +} + +// NewRestrictionQueryWithoutRelationshipsWithDefaults instantiates a new RestrictionQueryWithoutRelationships 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 NewRestrictionQueryWithoutRelationshipsWithDefaults() *RestrictionQueryWithoutRelationships { + this := RestrictionQueryWithoutRelationships{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *RestrictionQueryWithoutRelationships) GetAttributes() RestrictionQueryAttributes { + if o == nil || o.Attributes == nil { + var ret RestrictionQueryAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithoutRelationships) GetAttributesOk() (*RestrictionQueryAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *RestrictionQueryWithoutRelationships) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given RestrictionQueryAttributes and assigns it to the Attributes field. +func (o *RestrictionQueryWithoutRelationships) SetAttributes(v RestrictionQueryAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *RestrictionQueryWithoutRelationships) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithoutRelationships) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *RestrictionQueryWithoutRelationships) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *RestrictionQueryWithoutRelationships) SetId(v string) { + o.Id = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *RestrictionQueryWithoutRelationships) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithoutRelationships) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *RestrictionQueryWithoutRelationships) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *RestrictionQueryWithoutRelationships) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryWithoutRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryWithoutRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *RestrictionQueryAttributes `json:"attributes,omitempty"` + Id *string `json:"id,omitempty"` + Type *string `json:"type,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{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = all.Id + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_restriction_query_without_relationships_response.go b/api/datadogV2/model_restriction_query_without_relationships_response.go new file mode 100644 index 00000000000..80741160dbe --- /dev/null +++ b/api/datadogV2/model_restriction_query_without_relationships_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// RestrictionQueryWithoutRelationshipsResponse Response containing information about a single restriction query. +type RestrictionQueryWithoutRelationshipsResponse struct { + // Restriction query object returned by the API. + Data *RestrictionQueryWithoutRelationships `json:"data,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{} `json:"-"` +} + +// NewRestrictionQueryWithoutRelationshipsResponse instantiates a new RestrictionQueryWithoutRelationshipsResponse 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 NewRestrictionQueryWithoutRelationshipsResponse() *RestrictionQueryWithoutRelationshipsResponse { + this := RestrictionQueryWithoutRelationshipsResponse{} + return &this +} + +// NewRestrictionQueryWithoutRelationshipsResponseWithDefaults instantiates a new RestrictionQueryWithoutRelationshipsResponse 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 NewRestrictionQueryWithoutRelationshipsResponseWithDefaults() *RestrictionQueryWithoutRelationshipsResponse { + this := RestrictionQueryWithoutRelationshipsResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *RestrictionQueryWithoutRelationshipsResponse) GetData() RestrictionQueryWithoutRelationships { + if o == nil || o.Data == nil { + var ret RestrictionQueryWithoutRelationships + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *RestrictionQueryWithoutRelationshipsResponse) GetDataOk() (*RestrictionQueryWithoutRelationships, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *RestrictionQueryWithoutRelationshipsResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given RestrictionQueryWithoutRelationships and assigns it to the Data field. +func (o *RestrictionQueryWithoutRelationshipsResponse) SetData(v RestrictionQueryWithoutRelationships) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o RestrictionQueryWithoutRelationshipsResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *RestrictionQueryWithoutRelationshipsResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *RestrictionQueryWithoutRelationships `json:"data,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{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_attributes.go b/api/datadogV2/model_team_attributes.go index f212fc66acc..04cde898aa0 100644 --- a/api/datadogV2/model_team_attributes.go +++ b/api/datadogV2/model_team_attributes.go @@ -24,7 +24,9 @@ type TeamAttributes struct { // The team's identifier Handle string `json:"handle"` // Collection of hidden modules for the team - HiddenModules []string `json:"hidden_modules,omitempty"` + HiddenModules datadog.NullableList[string] `json:"hidden_modules,omitempty"` + // Whether the team is managed from an external source + IsManaged *bool `json:"is_managed,omitempty"` // The number of links belonging to the team LinkCount *int32 `json:"link_count,omitempty"` // Modification date of the team @@ -36,7 +38,7 @@ type TeamAttributes struct { // The number of users belonging to the team UserCount *int32 `json:"user_count,omitempty"` // Collection of visible modules for the team - VisibleModules []string `json:"visible_modules,omitempty"` + VisibleModules datadog.NullableList[string] `json:"visible_modules,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{} `json:"-"` @@ -229,32 +231,71 @@ func (o *TeamAttributes) SetHandle(v string) { o.Handle = v } -// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise. +// GetHiddenModules returns the HiddenModules field value if set, zero value otherwise (both if not set or set to explicit null). func (o *TeamAttributes) GetHiddenModules() []string { - if o == nil || o.HiddenModules == nil { + if o == nil || o.HiddenModules.Get() == nil { var ret []string return ret } - return o.HiddenModules + return *o.HiddenModules.Get() } // GetHiddenModulesOk returns a tuple with the HiddenModules field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *TeamAttributes) GetHiddenModulesOk() (*[]string, bool) { - if o == nil || o.HiddenModules == nil { + if o == nil { return nil, false } - return &o.HiddenModules, true + return o.HiddenModules.Get(), o.HiddenModules.IsSet() } // HasHiddenModules returns a boolean if a field has been set. func (o *TeamAttributes) HasHiddenModules() bool { - return o != nil && o.HiddenModules != nil + return o != nil && o.HiddenModules.IsSet() } -// SetHiddenModules gets a reference to the given []string and assigns it to the HiddenModules field. +// SetHiddenModules gets a reference to the given datadog.NullableList[string] and assigns it to the HiddenModules field. func (o *TeamAttributes) SetHiddenModules(v []string) { - o.HiddenModules = v + o.HiddenModules.Set(&v) +} + +// SetHiddenModulesNil sets the value for HiddenModules to be an explicit nil. +func (o *TeamAttributes) SetHiddenModulesNil() { + o.HiddenModules.Set(nil) +} + +// UnsetHiddenModules ensures that no value is present for HiddenModules, not even an explicit nil. +func (o *TeamAttributes) UnsetHiddenModules() { + o.HiddenModules.Unset() +} + +// GetIsManaged returns the IsManaged field value if set, zero value otherwise. +func (o *TeamAttributes) GetIsManaged() bool { + if o == nil || o.IsManaged == nil { + var ret bool + return ret + } + return *o.IsManaged +} + +// GetIsManagedOk returns a tuple with the IsManaged field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamAttributes) GetIsManagedOk() (*bool, bool) { + if o == nil || o.IsManaged == nil { + return nil, false + } + return o.IsManaged, true +} + +// HasIsManaged returns a boolean if a field has been set. +func (o *TeamAttributes) HasIsManaged() bool { + return o != nil && o.IsManaged != nil +} + +// SetIsManaged gets a reference to the given bool and assigns it to the IsManaged field. +func (o *TeamAttributes) SetIsManaged(v bool) { + o.IsManaged = &v } // GetLinkCount returns the LinkCount field value if set, zero value otherwise. @@ -403,32 +444,43 @@ func (o *TeamAttributes) SetUserCount(v int32) { o.UserCount = &v } -// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise. +// GetVisibleModules returns the VisibleModules field value if set, zero value otherwise (both if not set or set to explicit null). func (o *TeamAttributes) GetVisibleModules() []string { - if o == nil || o.VisibleModules == nil { + if o == nil || o.VisibleModules.Get() == nil { var ret []string return ret } - return o.VisibleModules + return *o.VisibleModules.Get() } // GetVisibleModulesOk returns a tuple with the VisibleModules field value if set, nil otherwise // and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. func (o *TeamAttributes) GetVisibleModulesOk() (*[]string, bool) { - if o == nil || o.VisibleModules == nil { + if o == nil { return nil, false } - return &o.VisibleModules, true + return o.VisibleModules.Get(), o.VisibleModules.IsSet() } // HasVisibleModules returns a boolean if a field has been set. func (o *TeamAttributes) HasVisibleModules() bool { - return o != nil && o.VisibleModules != nil + return o != nil && o.VisibleModules.IsSet() } -// SetVisibleModules gets a reference to the given []string and assigns it to the VisibleModules field. +// SetVisibleModules gets a reference to the given datadog.NullableList[string] and assigns it to the VisibleModules field. func (o *TeamAttributes) SetVisibleModules(v []string) { - o.VisibleModules = v + o.VisibleModules.Set(&v) +} + +// SetVisibleModulesNil sets the value for VisibleModules to be an explicit nil. +func (o *TeamAttributes) SetVisibleModulesNil() { + o.VisibleModules.Set(nil) +} + +// UnsetVisibleModules ensures that no value is present for VisibleModules, not even an explicit nil. +func (o *TeamAttributes) UnsetVisibleModules() { + o.VisibleModules.Unset() } // MarshalJSON serializes the struct using spec logic. @@ -454,8 +506,11 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { toSerialize["description"] = o.Description.Get() } toSerialize["handle"] = o.Handle - if o.HiddenModules != nil { - toSerialize["hidden_modules"] = o.HiddenModules + if o.HiddenModules.IsSet() { + toSerialize["hidden_modules"] = o.HiddenModules.Get() + } + if o.IsManaged != nil { + toSerialize["is_managed"] = o.IsManaged } if o.LinkCount != nil { toSerialize["link_count"] = o.LinkCount @@ -474,8 +529,8 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { if o.UserCount != nil { toSerialize["user_count"] = o.UserCount } - if o.VisibleModules != nil { - toSerialize["visible_modules"] = o.VisibleModules + if o.VisibleModules.IsSet() { + toSerialize["visible_modules"] = o.VisibleModules.Get() } for key, value := range o.AdditionalProperties { @@ -487,18 +542,19 @@ func (o TeamAttributes) MarshalJSON() ([]byte, error) { // UnmarshalJSON deserializes the given payload. func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { all := struct { - Avatar datadog.NullableString `json:"avatar,omitempty"` - Banner datadog.NullableInt64 `json:"banner,omitempty"` - CreatedAt *time.Time `json:"created_at,omitempty"` - Description datadog.NullableString `json:"description,omitempty"` - Handle *string `json:"handle"` - HiddenModules []string `json:"hidden_modules,omitempty"` - LinkCount *int32 `json:"link_count,omitempty"` - ModifiedAt *time.Time `json:"modified_at,omitempty"` - Name *string `json:"name"` - Summary datadog.NullableString `json:"summary,omitempty"` - UserCount *int32 `json:"user_count,omitempty"` - VisibleModules []string `json:"visible_modules,omitempty"` + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner datadog.NullableInt64 `json:"banner,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + Description datadog.NullableString `json:"description,omitempty"` + Handle *string `json:"handle"` + HiddenModules datadog.NullableList[string] `json:"hidden_modules,omitempty"` + IsManaged *bool `json:"is_managed,omitempty"` + LinkCount *int32 `json:"link_count,omitempty"` + ModifiedAt *time.Time `json:"modified_at,omitempty"` + Name *string `json:"name"` + Summary datadog.NullableString `json:"summary,omitempty"` + UserCount *int32 `json:"user_count,omitempty"` + VisibleModules datadog.NullableList[string] `json:"visible_modules,omitempty"` }{} if err = datadog.Unmarshal(bytes, &all); err != nil { return datadog.Unmarshal(bytes, &o.UnparsedObject) @@ -511,7 +567,7 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { } additionalProperties := make(map[string]interface{}) if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { - datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "created_at", "description", "handle", "hidden_modules", "link_count", "modified_at", "name", "summary", "user_count", "visible_modules"}) + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "created_at", "description", "handle", "hidden_modules", "is_managed", "link_count", "modified_at", "name", "summary", "user_count", "visible_modules"}) } else { return err } @@ -521,6 +577,7 @@ func (o *TeamAttributes) UnmarshalJSON(bytes []byte) (err error) { o.Description = all.Description o.Handle = *all.Handle o.HiddenModules = all.HiddenModules + o.IsManaged = all.IsManaged o.LinkCount = all.LinkCount o.ModifiedAt = all.ModifiedAt o.Name = *all.Name diff --git a/api/datadogV2/model_team_hierarchy_link.go b/api/datadogV2/model_team_hierarchy_link.go new file mode 100644 index 00000000000..a8d1beda72e --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link.go @@ -0,0 +1,218 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLink Team hierarchy link +type TeamHierarchyLink struct { + // Team hierarchy link attributes + Attributes TeamHierarchyLinkAttributes `json:"attributes"` + // The team hierarchy link's identifier + Id string `json:"id"` + // Team hierarchy link relationships + Relationships *TeamHierarchyLinkRelationships `json:"relationships,omitempty"` + // Team hierarchy link type + Type TeamHierarchyLinkType `json:"type"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLink instantiates a new TeamHierarchyLink 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 NewTeamHierarchyLink(attributes TeamHierarchyLinkAttributes, id string, typeVar TeamHierarchyLinkType) *TeamHierarchyLink { + this := TeamHierarchyLink{} + this.Attributes = attributes + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkWithDefaults instantiates a new TeamHierarchyLink 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 NewTeamHierarchyLinkWithDefaults() *TeamHierarchyLink { + this := TeamHierarchyLink{} + var typeVar TeamHierarchyLinkType = TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value. +func (o *TeamHierarchyLink) GetAttributes() TeamHierarchyLinkAttributes { + if o == nil { + var ret TeamHierarchyLinkAttributes + return ret + } + return o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetAttributesOk() (*TeamHierarchyLinkAttributes, bool) { + if o == nil { + return nil, false + } + return &o.Attributes, true +} + +// SetAttributes sets field value. +func (o *TeamHierarchyLink) SetAttributes(v TeamHierarchyLinkAttributes) { + o.Attributes = v +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLink) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLink) SetId(v string) { + o.Id = v +} + +// GetRelationships returns the Relationships field value if set, zero value otherwise. +func (o *TeamHierarchyLink) GetRelationships() TeamHierarchyLinkRelationships { + if o == nil || o.Relationships == nil { + var ret TeamHierarchyLinkRelationships + return ret + } + return *o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetRelationshipsOk() (*TeamHierarchyLinkRelationships, bool) { + if o == nil || o.Relationships == nil { + return nil, false + } + return o.Relationships, true +} + +// HasRelationships returns a boolean if a field has been set. +func (o *TeamHierarchyLink) HasRelationships() bool { + return o != nil && o.Relationships != nil +} + +// SetRelationships gets a reference to the given TeamHierarchyLinkRelationships and assigns it to the Relationships field. +func (o *TeamHierarchyLink) SetRelationships(v TeamHierarchyLinkRelationships) { + o.Relationships = &v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLink) GetType() TeamHierarchyLinkType { + if o == nil { + var ret TeamHierarchyLinkType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLink) GetTypeOk() (*TeamHierarchyLinkType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLink) SetType(v TeamHierarchyLinkType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLink) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["attributes"] = o.Attributes + toSerialize["id"] = o.Id + if o.Relationships != nil { + toSerialize["relationships"] = o.Relationships + } + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLink) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TeamHierarchyLinkAttributes `json:"attributes"` + Id *string `json:"id"` + Relationships *TeamHierarchyLinkRelationships `json:"relationships,omitempty"` + Type *TeamHierarchyLinkType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Attributes == nil { + return fmt.Errorf("required field attributes missing") + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = *all.Attributes + o.Id = *all.Id + if all.Relationships != nil && all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_attributes.go b/api/datadogV2/model_team_hierarchy_link_attributes.go new file mode 100644 index 00000000000..b8727633357 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_attributes.go @@ -0,0 +1,138 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + "time" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkAttributes Team hierarchy link attributes +type TeamHierarchyLinkAttributes struct { + // Timestamp when the team hierarchy link was created + CreatedAt time.Time `json:"created_at"` + // The provisioner of the team hierarchy link + ProvisionedBy string `json:"provisioned_by"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkAttributes instantiates a new TeamHierarchyLinkAttributes 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 NewTeamHierarchyLinkAttributes(createdAt time.Time, provisionedBy string) *TeamHierarchyLinkAttributes { + this := TeamHierarchyLinkAttributes{} + this.CreatedAt = createdAt + this.ProvisionedBy = provisionedBy + return &this +} + +// NewTeamHierarchyLinkAttributesWithDefaults instantiates a new TeamHierarchyLinkAttributes 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 NewTeamHierarchyLinkAttributesWithDefaults() *TeamHierarchyLinkAttributes { + this := TeamHierarchyLinkAttributes{} + return &this +} + +// GetCreatedAt returns the CreatedAt field value. +func (o *TeamHierarchyLinkAttributes) GetCreatedAt() time.Time { + if o == nil { + var ret time.Time + return ret + } + return o.CreatedAt +} + +// GetCreatedAtOk returns a tuple with the CreatedAt field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkAttributes) GetCreatedAtOk() (*time.Time, bool) { + if o == nil { + return nil, false + } + return &o.CreatedAt, true +} + +// SetCreatedAt sets field value. +func (o *TeamHierarchyLinkAttributes) SetCreatedAt(v time.Time) { + o.CreatedAt = v +} + +// GetProvisionedBy returns the ProvisionedBy field value. +func (o *TeamHierarchyLinkAttributes) GetProvisionedBy() string { + if o == nil { + var ret string + return ret + } + return o.ProvisionedBy +} + +// GetProvisionedByOk returns a tuple with the ProvisionedBy field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkAttributes) GetProvisionedByOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProvisionedBy, true +} + +// SetProvisionedBy sets field value. +func (o *TeamHierarchyLinkAttributes) SetProvisionedBy(v string) { + o.ProvisionedBy = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.CreatedAt.Nanosecond() == 0 { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05Z07:00") + } else { + toSerialize["created_at"] = o.CreatedAt.Format("2006-01-02T15:04:05.000Z07:00") + } + toSerialize["provisioned_by"] = o.ProvisionedBy + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + CreatedAt *time.Time `json:"created_at"` + ProvisionedBy *string `json:"provisioned_by"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.CreatedAt == nil { + return fmt.Errorf("required field created_at missing") + } + if all.ProvisionedBy == nil { + return fmt.Errorf("required field provisioned_by missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"created_at", "provisioned_by"}) + } else { + return err + } + o.CreatedAt = *all.CreatedAt + o.ProvisionedBy = *all.ProvisionedBy + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create.go b/api/datadogV2/model_team_hierarchy_link_create.go new file mode 100644 index 00000000000..29b09947f62 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create.go @@ -0,0 +1,148 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreate Data provided when creating a team hierarchy link +type TeamHierarchyLinkCreate struct { + // The related teams that will be connected by the team hierarchy link + Relationships TeamHierarchyLinkCreateRelationships `json:"relationships"` + // Team hierarchy link type + Type TeamHierarchyLinkType `json:"type"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkCreate instantiates a new TeamHierarchyLinkCreate 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 NewTeamHierarchyLinkCreate(relationships TeamHierarchyLinkCreateRelationships, typeVar TeamHierarchyLinkType) *TeamHierarchyLinkCreate { + this := TeamHierarchyLinkCreate{} + this.Relationships = relationships + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkCreateWithDefaults instantiates a new TeamHierarchyLinkCreate 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 NewTeamHierarchyLinkCreateWithDefaults() *TeamHierarchyLinkCreate { + this := TeamHierarchyLinkCreate{} + var typeVar TeamHierarchyLinkType = TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS + this.Type = typeVar + return &this +} + +// GetRelationships returns the Relationships field value. +func (o *TeamHierarchyLinkCreate) GetRelationships() TeamHierarchyLinkCreateRelationships { + if o == nil { + var ret TeamHierarchyLinkCreateRelationships + return ret + } + return o.Relationships +} + +// GetRelationshipsOk returns a tuple with the Relationships field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreate) GetRelationshipsOk() (*TeamHierarchyLinkCreateRelationships, bool) { + if o == nil { + return nil, false + } + return &o.Relationships, true +} + +// SetRelationships sets field value. +func (o *TeamHierarchyLinkCreate) SetRelationships(v TeamHierarchyLinkCreateRelationships) { + o.Relationships = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkCreate) GetType() TeamHierarchyLinkType { + if o == nil { + var ret TeamHierarchyLinkType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreate) GetTypeOk() (*TeamHierarchyLinkType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkCreate) SetType(v TeamHierarchyLinkType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreate) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["relationships"] = o.Relationships + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreate) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Relationships *TeamHierarchyLinkCreateRelationships `json:"relationships"` + Type *TeamHierarchyLinkType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Relationships == nil { + return fmt.Errorf("required field relationships missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"relationships", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Relationships.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Relationships = *all.Relationships + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_relationships.go b/api/datadogV2/model_team_hierarchy_link_create_relationships.go new file mode 100644 index 00000000000..fa55a43e5a7 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_relationships.go @@ -0,0 +1,145 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateRelationships The related teams that will be connected by the team hierarchy link +type TeamHierarchyLinkCreateRelationships struct { + // Data about each team that will be connected by the team hierarchy link + ParentTeam TeamHierarchyLinkCreateTeamRelationship `json:"parent_team"` + // Data about each team that will be connected by the team hierarchy link + SubTeam TeamHierarchyLinkCreateTeamRelationship `json:"sub_team"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateRelationships instantiates a new TeamHierarchyLinkCreateRelationships 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 NewTeamHierarchyLinkCreateRelationships(parentTeam TeamHierarchyLinkCreateTeamRelationship, subTeam TeamHierarchyLinkCreateTeamRelationship) *TeamHierarchyLinkCreateRelationships { + this := TeamHierarchyLinkCreateRelationships{} + this.ParentTeam = parentTeam + this.SubTeam = subTeam + return &this +} + +// NewTeamHierarchyLinkCreateRelationshipsWithDefaults instantiates a new TeamHierarchyLinkCreateRelationships 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 NewTeamHierarchyLinkCreateRelationshipsWithDefaults() *TeamHierarchyLinkCreateRelationships { + this := TeamHierarchyLinkCreateRelationships{} + return &this +} + +// GetParentTeam returns the ParentTeam field value. +func (o *TeamHierarchyLinkCreateRelationships) GetParentTeam() TeamHierarchyLinkCreateTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkCreateTeamRelationship + return ret + } + return o.ParentTeam +} + +// GetParentTeamOk returns a tuple with the ParentTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRelationships) GetParentTeamOk() (*TeamHierarchyLinkCreateTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.ParentTeam, true +} + +// SetParentTeam sets field value. +func (o *TeamHierarchyLinkCreateRelationships) SetParentTeam(v TeamHierarchyLinkCreateTeamRelationship) { + o.ParentTeam = v +} + +// GetSubTeam returns the SubTeam field value. +func (o *TeamHierarchyLinkCreateRelationships) GetSubTeam() TeamHierarchyLinkCreateTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkCreateTeamRelationship + return ret + } + return o.SubTeam +} + +// GetSubTeamOk returns a tuple with the SubTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRelationships) GetSubTeamOk() (*TeamHierarchyLinkCreateTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.SubTeam, true +} + +// SetSubTeam sets field value. +func (o *TeamHierarchyLinkCreateRelationships) SetSubTeam(v TeamHierarchyLinkCreateTeamRelationship) { + o.SubTeam = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["parent_team"] = o.ParentTeam + toSerialize["sub_team"] = o.SubTeam + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ParentTeam *TeamHierarchyLinkCreateTeamRelationship `json:"parent_team"` + SubTeam *TeamHierarchyLinkCreateTeamRelationship `json:"sub_team"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ParentTeam == nil { + return fmt.Errorf("required field parent_team missing") + } + if all.SubTeam == nil { + return fmt.Errorf("required field sub_team missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"parent_team", "sub_team"}) + } else { + return err + } + + hasInvalidField := false + if all.ParentTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ParentTeam = *all.ParentTeam + if all.SubTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SubTeam = *all.SubTeam + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_request.go b/api/datadogV2/model_team_hierarchy_link_create_request.go new file mode 100644 index 00000000000..60e8b75423f --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_request.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateRequest Request to create a team hierarchy link +type TeamHierarchyLinkCreateRequest struct { + // Data provided when creating a team hierarchy link + Data TeamHierarchyLinkCreate `json:"data"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateRequest instantiates a new TeamHierarchyLinkCreateRequest 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 NewTeamHierarchyLinkCreateRequest(data TeamHierarchyLinkCreate) *TeamHierarchyLinkCreateRequest { + this := TeamHierarchyLinkCreateRequest{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkCreateRequestWithDefaults instantiates a new TeamHierarchyLinkCreateRequest 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 NewTeamHierarchyLinkCreateRequestWithDefaults() *TeamHierarchyLinkCreateRequest { + this := TeamHierarchyLinkCreateRequest{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkCreateRequest) GetData() TeamHierarchyLinkCreate { + if o == nil { + var ret TeamHierarchyLinkCreate + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateRequest) GetDataOk() (*TeamHierarchyLinkCreate, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkCreateRequest) SetData(v TeamHierarchyLinkCreate) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkCreate `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_team.go b/api/datadogV2/model_team_hierarchy_link_create_team.go new file mode 100644 index 00000000000..e2659f5612d --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_team.go @@ -0,0 +1,145 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateTeam This schema defines the attributes about each team that has to be provided when creating a team hierarchy link +type TeamHierarchyLinkCreateTeam struct { + // The team's identifier + Id string `json:"id"` + // Team type + Type TeamType `json:"type"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateTeam instantiates a new TeamHierarchyLinkCreateTeam 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 NewTeamHierarchyLinkCreateTeam(id string, typeVar TeamType) *TeamHierarchyLinkCreateTeam { + this := TeamHierarchyLinkCreateTeam{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkCreateTeamWithDefaults instantiates a new TeamHierarchyLinkCreateTeam 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 NewTeamHierarchyLinkCreateTeamWithDefaults() *TeamHierarchyLinkCreateTeam { + this := TeamHierarchyLinkCreateTeam{} + var typeVar TeamType = TEAMTYPE_TEAM + this.Type = typeVar + return &this +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLinkCreateTeam) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeam) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLinkCreateTeam) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkCreateTeam) GetType() TeamType { + if o == nil { + var ret TeamType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeam) GetTypeOk() (*TeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkCreateTeam) SetType(v TeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateTeam) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateTeam) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id"` + Type *TeamType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id", "type"}) + } else { + return err + } + + hasInvalidField := false + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go b/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go new file mode 100644 index 00000000000..31119c144b0 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_create_team_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkCreateTeamRelationship Data about each team that will be connected by the team hierarchy link +type TeamHierarchyLinkCreateTeamRelationship struct { + // This schema defines the attributes about each team that has to be provided when creating a team hierarchy link + Data TeamHierarchyLinkCreateTeam `json:"data"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkCreateTeamRelationship instantiates a new TeamHierarchyLinkCreateTeamRelationship 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 NewTeamHierarchyLinkCreateTeamRelationship(data TeamHierarchyLinkCreateTeam) *TeamHierarchyLinkCreateTeamRelationship { + this := TeamHierarchyLinkCreateTeamRelationship{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkCreateTeamRelationshipWithDefaults instantiates a new TeamHierarchyLinkCreateTeamRelationship 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 NewTeamHierarchyLinkCreateTeamRelationshipWithDefaults() *TeamHierarchyLinkCreateTeamRelationship { + this := TeamHierarchyLinkCreateTeamRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkCreateTeamRelationship) GetData() TeamHierarchyLinkCreateTeam { + if o == nil { + var ret TeamHierarchyLinkCreateTeam + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkCreateTeamRelationship) GetDataOk() (*TeamHierarchyLinkCreateTeam, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkCreateTeamRelationship) SetData(v TeamHierarchyLinkCreateTeam) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkCreateTeamRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkCreateTeamRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkCreateTeam `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_relationships.go b/api/datadogV2/model_team_hierarchy_link_relationships.go new file mode 100644 index 00000000000..61d02aabbc0 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_relationships.go @@ -0,0 +1,145 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkRelationships Team hierarchy link relationships +type TeamHierarchyLinkRelationships struct { + // Team hierarchy link team relationship + ParentTeam TeamHierarchyLinkTeamRelationship `json:"parent_team"` + // Team hierarchy link team relationship + SubTeam TeamHierarchyLinkTeamRelationship `json:"sub_team"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkRelationships instantiates a new TeamHierarchyLinkRelationships 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 NewTeamHierarchyLinkRelationships(parentTeam TeamHierarchyLinkTeamRelationship, subTeam TeamHierarchyLinkTeamRelationship) *TeamHierarchyLinkRelationships { + this := TeamHierarchyLinkRelationships{} + this.ParentTeam = parentTeam + this.SubTeam = subTeam + return &this +} + +// NewTeamHierarchyLinkRelationshipsWithDefaults instantiates a new TeamHierarchyLinkRelationships 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 NewTeamHierarchyLinkRelationshipsWithDefaults() *TeamHierarchyLinkRelationships { + this := TeamHierarchyLinkRelationships{} + return &this +} + +// GetParentTeam returns the ParentTeam field value. +func (o *TeamHierarchyLinkRelationships) GetParentTeam() TeamHierarchyLinkTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkTeamRelationship + return ret + } + return o.ParentTeam +} + +// GetParentTeamOk returns a tuple with the ParentTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkRelationships) GetParentTeamOk() (*TeamHierarchyLinkTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.ParentTeam, true +} + +// SetParentTeam sets field value. +func (o *TeamHierarchyLinkRelationships) SetParentTeam(v TeamHierarchyLinkTeamRelationship) { + o.ParentTeam = v +} + +// GetSubTeam returns the SubTeam field value. +func (o *TeamHierarchyLinkRelationships) GetSubTeam() TeamHierarchyLinkTeamRelationship { + if o == nil { + var ret TeamHierarchyLinkTeamRelationship + return ret + } + return o.SubTeam +} + +// GetSubTeamOk returns a tuple with the SubTeam field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkRelationships) GetSubTeamOk() (*TeamHierarchyLinkTeamRelationship, bool) { + if o == nil { + return nil, false + } + return &o.SubTeam, true +} + +// SetSubTeam sets field value. +func (o *TeamHierarchyLinkRelationships) SetSubTeam(v TeamHierarchyLinkTeamRelationship) { + o.SubTeam = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkRelationships) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["parent_team"] = o.ParentTeam + toSerialize["sub_team"] = o.SubTeam + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkRelationships) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + ParentTeam *TeamHierarchyLinkTeamRelationship `json:"parent_team"` + SubTeam *TeamHierarchyLinkTeamRelationship `json:"sub_team"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.ParentTeam == nil { + return fmt.Errorf("required field parent_team missing") + } + if all.SubTeam == nil { + return fmt.Errorf("required field sub_team missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"parent_team", "sub_team"}) + } else { + return err + } + + hasInvalidField := false + if all.ParentTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.ParentTeam = *all.ParentTeam + if all.SubTeam.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.SubTeam = *all.SubTeam + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_response.go b/api/datadogV2/model_team_hierarchy_link_response.go new file mode 100644 index 00000000000..540431895f3 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_response.go @@ -0,0 +1,184 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkResponse Team hierarchy link response +type TeamHierarchyLinkResponse struct { + // Team hierarchy link + Data *TeamHierarchyLink `json:"data,omitempty"` + // Included teams + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + // When querying team hierarchy links, a set of links for navigation between different pages is included + Links *TeamsHierarchyLinksResponseLinks `json:"links,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{} `json:"-"` +} + +// NewTeamHierarchyLinkResponse instantiates a new TeamHierarchyLinkResponse 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 NewTeamHierarchyLinkResponse() *TeamHierarchyLinkResponse { + this := TeamHierarchyLinkResponse{} + return &this +} + +// NewTeamHierarchyLinkResponseWithDefaults instantiates a new TeamHierarchyLinkResponse 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 NewTeamHierarchyLinkResponseWithDefaults() *TeamHierarchyLinkResponse { + this := TeamHierarchyLinkResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetData() TeamHierarchyLink { + if o == nil || o.Data == nil { + var ret TeamHierarchyLink + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetDataOk() (*TeamHierarchyLink, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given TeamHierarchyLink and assigns it to the Data field. +func (o *TeamHierarchyLinkResponse) SetData(v TeamHierarchyLink) { + o.Data = &v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetIncluded() []TeamHierarchyLinkTeam { + if o == nil || o.Included == nil { + var ret []TeamHierarchyLinkTeam + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetIncludedOk() (*[]TeamHierarchyLinkTeam, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []TeamHierarchyLinkTeam and assigns it to the Included field. +func (o *TeamHierarchyLinkResponse) SetIncluded(v []TeamHierarchyLinkTeam) { + o.Included = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TeamHierarchyLinkResponse) GetLinks() TeamsHierarchyLinksResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsHierarchyLinksResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkResponse) GetLinksOk() (*TeamsHierarchyLinksResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *TeamHierarchyLinkResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsHierarchyLinksResponseLinks and assigns it to the Links field. +func (o *TeamHierarchyLinkResponse) SetLinks(v TeamsHierarchyLinksResponseLinks) { + o.Links = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLink `json:"data,omitempty"` + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + Links *TeamsHierarchyLinksResponseLinks `json:"links,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{"data", "included", "links"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + o.Included = all.Included + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team.go b/api/datadogV2/model_team_hierarchy_link_team.go new file mode 100644 index 00000000000..1ce3a3d305d --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team.go @@ -0,0 +1,183 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeam Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link. +type TeamHierarchyLinkTeam struct { + // Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. + Attributes *TeamHierarchyLinkTeamAttributes `json:"attributes,omitempty"` + // The team's identifier + Id string `json:"id"` + // Team type + Type TeamType `json:"type"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkTeam instantiates a new TeamHierarchyLinkTeam 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 NewTeamHierarchyLinkTeam(id string, typeVar TeamType) *TeamHierarchyLinkTeam { + this := TeamHierarchyLinkTeam{} + this.Id = id + this.Type = typeVar + return &this +} + +// NewTeamHierarchyLinkTeamWithDefaults instantiates a new TeamHierarchyLinkTeam 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 NewTeamHierarchyLinkTeamWithDefaults() *TeamHierarchyLinkTeam { + this := TeamHierarchyLinkTeam{} + var typeVar TeamType = TEAMTYPE_TEAM + this.Type = typeVar + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeam) GetAttributes() TeamHierarchyLinkTeamAttributes { + if o == nil || o.Attributes == nil { + var ret TeamHierarchyLinkTeamAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetAttributesOk() (*TeamHierarchyLinkTeamAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeam) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given TeamHierarchyLinkTeamAttributes and assigns it to the Attributes field. +func (o *TeamHierarchyLinkTeam) SetAttributes(v TeamHierarchyLinkTeamAttributes) { + o.Attributes = &v +} + +// GetId returns the Id field value. +func (o *TeamHierarchyLinkTeam) GetId() string { + if o == nil { + var ret string + return ret + } + return o.Id +} + +// GetIdOk returns a tuple with the Id field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Id, true +} + +// SetId sets field value. +func (o *TeamHierarchyLinkTeam) SetId(v string) { + o.Id = v +} + +// GetType returns the Type field value. +func (o *TeamHierarchyLinkTeam) GetType() TeamType { + if o == nil { + var ret TeamType + return ret + } + return o.Type +} + +// GetTypeOk returns a tuple with the Type field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeam) GetTypeOk() (*TeamType, bool) { + if o == nil { + return nil, false + } + return &o.Type, true +} + +// SetType sets field value. +func (o *TeamHierarchyLinkTeam) SetType(v TeamType) { + o.Type = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeam) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + toSerialize["id"] = o.Id + toSerialize["type"] = o.Type + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeam) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *TeamHierarchyLinkTeamAttributes `json:"attributes,omitempty"` + Id *string `json:"id"` + Type *TeamType `json:"type"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Id == nil { + return fmt.Errorf("required field id missing") + } + if all.Type == nil { + return fmt.Errorf("required field type missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes", "id", "type"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + o.Id = *all.Id + if !all.Type.IsValid() { + hasInvalidField = true + } else { + o.Type = *all.Type + } + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team_attributes.go b/api/datadogV2/model_team_hierarchy_link_team_attributes.go new file mode 100644 index 00000000000..a96a7849817 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team_attributes.go @@ -0,0 +1,400 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeamAttributes Team hierarchy links connect different teams. This represents attributes from teams that are connected by the team hierarchy link. +type TeamHierarchyLinkTeamAttributes struct { + // The team's avatar + Avatar datadog.NullableString `json:"avatar,omitempty"` + // The team's banner + Banner *int64 `json:"banner,omitempty"` + // The team's handle + Handle string `json:"handle"` + // Whether the team is managed + IsManaged *bool `json:"is_managed,omitempty"` + // Whether the team has open membership + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + // The number of links for the team + LinkCount *int64 `json:"link_count,omitempty"` + // The team's name + Name string `json:"name"` + // The team's summary + Summary datadog.NullableString `json:"summary,omitempty"` + // The number of users in the team + UserCount *int64 `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{} `json:"-"` +} + +// NewTeamHierarchyLinkTeamAttributes instantiates a new TeamHierarchyLinkTeamAttributes 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 NewTeamHierarchyLinkTeamAttributes(handle string, name string) *TeamHierarchyLinkTeamAttributes { + this := TeamHierarchyLinkTeamAttributes{} + this.Handle = handle + this.Name = name + return &this +} + +// NewTeamHierarchyLinkTeamAttributesWithDefaults instantiates a new TeamHierarchyLinkTeamAttributes 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 NewTeamHierarchyLinkTeamAttributesWithDefaults() *TeamHierarchyLinkTeamAttributes { + this := TeamHierarchyLinkTeamAttributes{} + return &this +} + +// GetAvatar returns the Avatar field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamHierarchyLinkTeamAttributes) GetAvatar() string { + if o == nil || o.Avatar.Get() == nil { + var ret string + return ret + } + return *o.Avatar.Get() +} + +// GetAvatarOk returns a tuple with the Avatar field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamHierarchyLinkTeamAttributes) GetAvatarOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Avatar.Get(), o.Avatar.IsSet() +} + +// HasAvatar returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasAvatar() bool { + return o != nil && o.Avatar.IsSet() +} + +// SetAvatar gets a reference to the given datadog.NullableString and assigns it to the Avatar field. +func (o *TeamHierarchyLinkTeamAttributes) SetAvatar(v string) { + o.Avatar.Set(&v) +} + +// SetAvatarNil sets the value for Avatar to be an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) SetAvatarNil() { + o.Avatar.Set(nil) +} + +// UnsetAvatar ensures that no value is present for Avatar, not even an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) UnsetAvatar() { + o.Avatar.Unset() +} + +// GetBanner returns the Banner field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetBanner() int64 { + if o == nil || o.Banner == nil { + var ret int64 + return ret + } + return *o.Banner +} + +// GetBannerOk returns a tuple with the Banner field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetBannerOk() (*int64, bool) { + if o == nil || o.Banner == nil { + return nil, false + } + return o.Banner, true +} + +// HasBanner returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasBanner() bool { + return o != nil && o.Banner != nil +} + +// SetBanner gets a reference to the given int64 and assigns it to the Banner field. +func (o *TeamHierarchyLinkTeamAttributes) SetBanner(v int64) { + o.Banner = &v +} + +// GetHandle returns the Handle field value. +func (o *TeamHierarchyLinkTeamAttributes) GetHandle() string { + if o == nil { + var ret string + return ret + } + return o.Handle +} + +// GetHandleOk returns a tuple with the Handle field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetHandleOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Handle, true +} + +// SetHandle sets field value. +func (o *TeamHierarchyLinkTeamAttributes) SetHandle(v string) { + o.Handle = v +} + +// GetIsManaged returns the IsManaged field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetIsManaged() bool { + if o == nil || o.IsManaged == nil { + var ret bool + return ret + } + return *o.IsManaged +} + +// GetIsManagedOk returns a tuple with the IsManaged field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetIsManagedOk() (*bool, bool) { + if o == nil || o.IsManaged == nil { + return nil, false + } + return o.IsManaged, true +} + +// HasIsManaged returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasIsManaged() bool { + return o != nil && o.IsManaged != nil +} + +// SetIsManaged gets a reference to the given bool and assigns it to the IsManaged field. +func (o *TeamHierarchyLinkTeamAttributes) SetIsManaged(v bool) { + o.IsManaged = &v +} + +// GetIsOpenMembership returns the IsOpenMembership field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetIsOpenMembership() bool { + if o == nil || o.IsOpenMembership == nil { + var ret bool + return ret + } + return *o.IsOpenMembership +} + +// GetIsOpenMembershipOk returns a tuple with the IsOpenMembership field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetIsOpenMembershipOk() (*bool, bool) { + if o == nil || o.IsOpenMembership == nil { + return nil, false + } + return o.IsOpenMembership, true +} + +// HasIsOpenMembership returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasIsOpenMembership() bool { + return o != nil && o.IsOpenMembership != nil +} + +// SetIsOpenMembership gets a reference to the given bool and assigns it to the IsOpenMembership field. +func (o *TeamHierarchyLinkTeamAttributes) SetIsOpenMembership(v bool) { + o.IsOpenMembership = &v +} + +// GetLinkCount returns the LinkCount field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetLinkCount() int64 { + if o == nil || o.LinkCount == nil { + var ret int64 + return ret + } + return *o.LinkCount +} + +// GetLinkCountOk returns a tuple with the LinkCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetLinkCountOk() (*int64, bool) { + if o == nil || o.LinkCount == nil { + return nil, false + } + return o.LinkCount, true +} + +// HasLinkCount returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasLinkCount() bool { + return o != nil && o.LinkCount != nil +} + +// SetLinkCount gets a reference to the given int64 and assigns it to the LinkCount field. +func (o *TeamHierarchyLinkTeamAttributes) SetLinkCount(v int64) { + o.LinkCount = &v +} + +// GetName returns the Name field value. +func (o *TeamHierarchyLinkTeamAttributes) GetName() string { + if o == nil { + var ret string + return ret + } + return o.Name +} + +// GetNameOk returns a tuple with the Name field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamAttributes) GetNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.Name, true +} + +// SetName sets field value. +func (o *TeamHierarchyLinkTeamAttributes) SetName(v string) { + o.Name = v +} + +// GetSummary returns the Summary field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamHierarchyLinkTeamAttributes) GetSummary() string { + if o == nil || o.Summary.Get() == nil { + var ret string + return ret + } + return *o.Summary.Get() +} + +// GetSummaryOk returns a tuple with the Summary field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamHierarchyLinkTeamAttributes) GetSummaryOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Summary.Get(), o.Summary.IsSet() +} + +// HasSummary returns a boolean if a field has been set. +func (o *TeamHierarchyLinkTeamAttributes) HasSummary() bool { + return o != nil && o.Summary.IsSet() +} + +// SetSummary gets a reference to the given datadog.NullableString and assigns it to the Summary field. +func (o *TeamHierarchyLinkTeamAttributes) SetSummary(v string) { + o.Summary.Set(&v) +} + +// SetSummaryNil sets the value for Summary to be an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) SetSummaryNil() { + o.Summary.Set(nil) +} + +// UnsetSummary ensures that no value is present for Summary, not even an explicit nil. +func (o *TeamHierarchyLinkTeamAttributes) UnsetSummary() { + o.Summary.Unset() +} + +// GetUserCount returns the UserCount field value if set, zero value otherwise. +func (o *TeamHierarchyLinkTeamAttributes) GetUserCount() int64 { + if o == nil || o.UserCount == nil { + var ret int64 + 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 *TeamHierarchyLinkTeamAttributes) GetUserCountOk() (*int64, 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 *TeamHierarchyLinkTeamAttributes) HasUserCount() bool { + return o != nil && o.UserCount != nil +} + +// SetUserCount gets a reference to the given int64 and assigns it to the UserCount field. +func (o *TeamHierarchyLinkTeamAttributes) SetUserCount(v int64) { + o.UserCount = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeamAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Avatar.IsSet() { + toSerialize["avatar"] = o.Avatar.Get() + } + if o.Banner != nil { + toSerialize["banner"] = o.Banner + } + toSerialize["handle"] = o.Handle + if o.IsManaged != nil { + toSerialize["is_managed"] = o.IsManaged + } + if o.IsOpenMembership != nil { + toSerialize["is_open_membership"] = o.IsOpenMembership + } + if o.LinkCount != nil { + toSerialize["link_count"] = o.LinkCount + } + toSerialize["name"] = o.Name + if o.Summary.IsSet() { + toSerialize["summary"] = o.Summary.Get() + } + if o.UserCount != nil { + toSerialize["user_count"] = o.UserCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeamAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Avatar datadog.NullableString `json:"avatar,omitempty"` + Banner *int64 `json:"banner,omitempty"` + Handle *string `json:"handle"` + IsManaged *bool `json:"is_managed,omitempty"` + IsOpenMembership *bool `json:"is_open_membership,omitempty"` + LinkCount *int64 `json:"link_count,omitempty"` + Name *string `json:"name"` + Summary datadog.NullableString `json:"summary,omitempty"` + UserCount *int64 `json:"user_count,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Handle == nil { + return fmt.Errorf("required field handle missing") + } + if all.Name == nil { + return fmt.Errorf("required field name missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"avatar", "banner", "handle", "is_managed", "is_open_membership", "link_count", "name", "summary", "user_count"}) + } else { + return err + } + o.Avatar = all.Avatar + o.Banner = all.Banner + o.Handle = *all.Handle + o.IsManaged = all.IsManaged + o.IsOpenMembership = all.IsOpenMembership + o.LinkCount = all.LinkCount + o.Name = *all.Name + o.Summary = all.Summary + o.UserCount = all.UserCount + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_team_relationship.go b/api/datadogV2/model_team_hierarchy_link_team_relationship.go new file mode 100644 index 00000000000..7c4aab533c5 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_team_relationship.go @@ -0,0 +1,110 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkTeamRelationship Team hierarchy link team relationship +type TeamHierarchyLinkTeamRelationship struct { + // Team hierarchy links connect different teams. This represents team objects that are connected by the team hierarchy link. + Data TeamHierarchyLinkTeam `json:"data"` + // 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{} `json:"-"` +} + +// NewTeamHierarchyLinkTeamRelationship instantiates a new TeamHierarchyLinkTeamRelationship 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 NewTeamHierarchyLinkTeamRelationship(data TeamHierarchyLinkTeam) *TeamHierarchyLinkTeamRelationship { + this := TeamHierarchyLinkTeamRelationship{} + this.Data = data + return &this +} + +// NewTeamHierarchyLinkTeamRelationshipWithDefaults instantiates a new TeamHierarchyLinkTeamRelationship 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 NewTeamHierarchyLinkTeamRelationshipWithDefaults() *TeamHierarchyLinkTeamRelationship { + this := TeamHierarchyLinkTeamRelationship{} + return &this +} + +// GetData returns the Data field value. +func (o *TeamHierarchyLinkTeamRelationship) GetData() TeamHierarchyLinkTeam { + if o == nil { + var ret TeamHierarchyLinkTeam + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinkTeamRelationship) GetDataOk() (*TeamHierarchyLinkTeam, bool) { + if o == nil { + return nil, false + } + return &o.Data, true +} + +// SetData sets field value. +func (o *TeamHierarchyLinkTeamRelationship) SetData(v TeamHierarchyLinkTeam) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinkTeamRelationship) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + toSerialize["data"] = o.Data + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinkTeamRelationship) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *TeamHierarchyLinkTeam `json:"data"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + if all.Data == nil { + return fmt.Errorf("required field data missing") + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = *all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_team_hierarchy_link_type.go b/api/datadogV2/model_team_hierarchy_link_type.go new file mode 100644 index 00000000000..c2c5de6c679 --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_link_type.go @@ -0,0 +1,64 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "fmt" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinkType Team hierarchy link type +type TeamHierarchyLinkType string + +// List of TeamHierarchyLinkType. +const ( + TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS TeamHierarchyLinkType = "team_hierarchy_links" +) + +var allowedTeamHierarchyLinkTypeEnumValues = []TeamHierarchyLinkType{ + TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS, +} + +// GetAllowedValues reeturns the list of possible values. +func (v *TeamHierarchyLinkType) GetAllowedValues() []TeamHierarchyLinkType { + return allowedTeamHierarchyLinkTypeEnumValues +} + +// UnmarshalJSON deserializes the given payload. +func (v *TeamHierarchyLinkType) UnmarshalJSON(src []byte) error { + var value string + err := datadog.Unmarshal(src, &value) + if err != nil { + return err + } + *v = TeamHierarchyLinkType(value) + return nil +} + +// NewTeamHierarchyLinkTypeFromValue returns a pointer to a valid TeamHierarchyLinkType +// for the value passed as argument, or an error if the value passed is not allowed by the enum. +func NewTeamHierarchyLinkTypeFromValue(v string) (*TeamHierarchyLinkType, error) { + ev := TeamHierarchyLinkType(v) + if ev.IsValid() { + return &ev, nil + } + return nil, fmt.Errorf("invalid value '%v' for TeamHierarchyLinkType: valid values are %v", v, allowedTeamHierarchyLinkTypeEnumValues) +} + +// IsValid return true if the value is valid for the enum, false otherwise. +func (v TeamHierarchyLinkType) IsValid() bool { + for _, existing := range allowedTeamHierarchyLinkTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to TeamHierarchyLinkType value. +func (v TeamHierarchyLinkType) Ptr() *TeamHierarchyLinkType { + return &v +} diff --git a/api/datadogV2/model_team_hierarchy_links_response.go b/api/datadogV2/model_team_hierarchy_links_response.go new file mode 100644 index 00000000000..095ea9e312c --- /dev/null +++ b/api/datadogV2/model_team_hierarchy_links_response.go @@ -0,0 +1,219 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamHierarchyLinksResponse Team hierarchy links response +type TeamHierarchyLinksResponse struct { + // Team hierarchy links response data + Data []TeamHierarchyLink `json:"data,omitempty"` + // Included teams + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + // When querying team hierarchy links, a set of links for navigation between different pages is included + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + // Metadata that is included in the response when querying the team hierarchy links + Meta *TeamsHierarchyLinksResponseMeta `json:"meta,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{} `json:"-"` +} + +// NewTeamHierarchyLinksResponse instantiates a new TeamHierarchyLinksResponse 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 NewTeamHierarchyLinksResponse() *TeamHierarchyLinksResponse { + this := TeamHierarchyLinksResponse{} + return &this +} + +// NewTeamHierarchyLinksResponseWithDefaults instantiates a new TeamHierarchyLinksResponse 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 NewTeamHierarchyLinksResponseWithDefaults() *TeamHierarchyLinksResponse { + this := TeamHierarchyLinksResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetData() []TeamHierarchyLink { + if o == nil || o.Data == nil { + var ret []TeamHierarchyLink + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetDataOk() (*[]TeamHierarchyLink, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []TeamHierarchyLink and assigns it to the Data field. +func (o *TeamHierarchyLinksResponse) SetData(v []TeamHierarchyLink) { + o.Data = v +} + +// GetIncluded returns the Included field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetIncluded() []TeamHierarchyLinkTeam { + if o == nil || o.Included == nil { + var ret []TeamHierarchyLinkTeam + return ret + } + return o.Included +} + +// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetIncludedOk() (*[]TeamHierarchyLinkTeam, bool) { + if o == nil || o.Included == nil { + return nil, false + } + return &o.Included, true +} + +// HasIncluded returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasIncluded() bool { + return o != nil && o.Included != nil +} + +// SetIncluded gets a reference to the given []TeamHierarchyLinkTeam and assigns it to the Included field. +func (o *TeamHierarchyLinksResponse) SetIncluded(v []TeamHierarchyLinkTeam) { + o.Included = v +} + +// GetLinks returns the Links field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetLinks() TeamsHierarchyLinksResponseLinks { + if o == nil || o.Links == nil { + var ret TeamsHierarchyLinksResponseLinks + return ret + } + return *o.Links +} + +// GetLinksOk returns a tuple with the Links field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetLinksOk() (*TeamsHierarchyLinksResponseLinks, bool) { + if o == nil || o.Links == nil { + return nil, false + } + return o.Links, true +} + +// HasLinks returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasLinks() bool { + return o != nil && o.Links != nil +} + +// SetLinks gets a reference to the given TeamsHierarchyLinksResponseLinks and assigns it to the Links field. +func (o *TeamHierarchyLinksResponse) SetLinks(v TeamsHierarchyLinksResponseLinks) { + o.Links = &v +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *TeamHierarchyLinksResponse) GetMeta() TeamsHierarchyLinksResponseMeta { + if o == nil || o.Meta == nil { + var ret TeamsHierarchyLinksResponseMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamHierarchyLinksResponse) GetMetaOk() (*TeamsHierarchyLinksResponseMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *TeamHierarchyLinksResponse) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given TeamsHierarchyLinksResponseMeta and assigns it to the Meta field. +func (o *TeamHierarchyLinksResponse) SetMeta(v TeamsHierarchyLinksResponseMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamHierarchyLinksResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + if o.Included != nil { + toSerialize["included"] = o.Included + } + if o.Links != nil { + toSerialize["links"] = o.Links + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamHierarchyLinksResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []TeamHierarchyLink `json:"data,omitempty"` + Included []TeamHierarchyLinkTeam `json:"included,omitempty"` + Links *TeamsHierarchyLinksResponseLinks `json:"links,omitempty"` + Meta *TeamsHierarchyLinksResponseMeta `json:"meta,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{"data", "included", "links", "meta"}) + } else { + return err + } + + hasInvalidField := false + o.Data = all.Data + o.Included = all.Included + if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Links = all.Links + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_links.go b/api/datadogV2/model_teams_hierarchy_links_response_links.go new file mode 100644 index 00000000000..34882c7516e --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_links.go @@ -0,0 +1,286 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseLinks When querying team hierarchy links, a set of links for navigation between different pages is included +type TeamsHierarchyLinksResponseLinks struct { + // Link to the first page. + First datadog.NullableString `json:"first,omitempty"` + // Link to the last page. + Last datadog.NullableString `json:"last,omitempty"` + // Link to the next page. + Next datadog.NullableString `json:"next,omitempty"` + // Link to the previous page. + Prev datadog.NullableString `json:"prev,omitempty"` + // Link to the current object. + Self *string `json:"self,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{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseLinks instantiates a new TeamsHierarchyLinksResponseLinks 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 NewTeamsHierarchyLinksResponseLinks() *TeamsHierarchyLinksResponseLinks { + this := TeamsHierarchyLinksResponseLinks{} + return &this +} + +// NewTeamsHierarchyLinksResponseLinksWithDefaults instantiates a new TeamsHierarchyLinksResponseLinks 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 NewTeamsHierarchyLinksResponseLinksWithDefaults() *TeamsHierarchyLinksResponseLinks { + this := TeamsHierarchyLinksResponseLinks{} + return &this +} + +// GetFirst returns the First field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetFirst() string { + if o == nil || o.First.Get() == nil { + var ret string + return ret + } + return *o.First.Get() +} + +// GetFirstOk returns a tuple with the First field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetFirstOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.First.Get(), o.First.IsSet() +} + +// HasFirst returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasFirst() bool { + return o != nil && o.First.IsSet() +} + +// SetFirst gets a reference to the given datadog.NullableString and assigns it to the First field. +func (o *TeamsHierarchyLinksResponseLinks) SetFirst(v string) { + o.First.Set(&v) +} + +// SetFirstNil sets the value for First to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetFirstNil() { + o.First.Set(nil) +} + +// UnsetFirst ensures that no value is present for First, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetFirst() { + o.First.Unset() +} + +// GetLast returns the Last field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetLast() string { + if o == nil || o.Last.Get() == nil { + var ret string + return ret + } + return *o.Last.Get() +} + +// GetLastOk returns a tuple with the Last field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetLastOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Last.Get(), o.Last.IsSet() +} + +// HasLast returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasLast() bool { + return o != nil && o.Last.IsSet() +} + +// SetLast gets a reference to the given datadog.NullableString and assigns it to the Last field. +func (o *TeamsHierarchyLinksResponseLinks) SetLast(v string) { + o.Last.Set(&v) +} + +// SetLastNil sets the value for Last to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetLastNil() { + o.Last.Set(nil) +} + +// UnsetLast ensures that no value is present for Last, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetLast() { + o.Last.Unset() +} + +// GetNext returns the Next field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetNext() string { + if o == nil || o.Next.Get() == nil { + var ret string + return ret + } + return *o.Next.Get() +} + +// GetNextOk returns a tuple with the Next field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetNextOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Next.Get(), o.Next.IsSet() +} + +// HasNext returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasNext() bool { + return o != nil && o.Next.IsSet() +} + +// SetNext gets a reference to the given datadog.NullableString and assigns it to the Next field. +func (o *TeamsHierarchyLinksResponseLinks) SetNext(v string) { + o.Next.Set(&v) +} + +// SetNextNil sets the value for Next to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetNextNil() { + o.Next.Set(nil) +} + +// UnsetNext ensures that no value is present for Next, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetNext() { + o.Next.Unset() +} + +// GetPrev returns the Prev field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseLinks) GetPrev() string { + if o == nil || o.Prev.Get() == nil { + var ret string + return ret + } + return *o.Prev.Get() +} + +// GetPrevOk returns a tuple with the Prev field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseLinks) GetPrevOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Prev.Get(), o.Prev.IsSet() +} + +// HasPrev returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasPrev() bool { + return o != nil && o.Prev.IsSet() +} + +// SetPrev gets a reference to the given datadog.NullableString and assigns it to the Prev field. +func (o *TeamsHierarchyLinksResponseLinks) SetPrev(v string) { + o.Prev.Set(&v) +} + +// SetPrevNil sets the value for Prev to be an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) SetPrevNil() { + o.Prev.Set(nil) +} + +// UnsetPrev ensures that no value is present for Prev, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseLinks) UnsetPrev() { + o.Prev.Unset() +} + +// GetSelf returns the Self field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseLinks) GetSelf() string { + if o == nil || o.Self == nil { + var ret string + return ret + } + return *o.Self +} + +// GetSelfOk returns a tuple with the Self field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseLinks) GetSelfOk() (*string, bool) { + if o == nil || o.Self == nil { + return nil, false + } + return o.Self, true +} + +// HasSelf returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseLinks) HasSelf() bool { + return o != nil && o.Self != nil +} + +// SetSelf gets a reference to the given string and assigns it to the Self field. +func (o *TeamsHierarchyLinksResponseLinks) SetSelf(v string) { + o.Self = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseLinks) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.First.IsSet() { + toSerialize["first"] = o.First.Get() + } + if o.Last.IsSet() { + toSerialize["last"] = o.Last.Get() + } + if o.Next.IsSet() { + toSerialize["next"] = o.Next.Get() + } + if o.Prev.IsSet() { + toSerialize["prev"] = o.Prev.Get() + } + if o.Self != nil { + toSerialize["self"] = o.Self + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseLinks) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + First datadog.NullableString `json:"first,omitempty"` + Last datadog.NullableString `json:"last,omitempty"` + Next datadog.NullableString `json:"next,omitempty"` + Prev datadog.NullableString `json:"prev,omitempty"` + Self *string `json:"self,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{"first", "last", "next", "prev", "self"}) + } else { + return err + } + o.First = all.First + o.Last = all.Last + o.Next = all.Next + o.Prev = all.Prev + o.Self = all.Self + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_meta.go b/api/datadogV2/model_teams_hierarchy_links_response_meta.go new file mode 100644 index 00000000000..6c225865ed7 --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_meta.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseMeta Metadata that is included in the response when querying the team hierarchy links +type TeamsHierarchyLinksResponseMeta struct { + // Metadata related to paging information that is included in the response when querying the team hierarchy links + Page *TeamsHierarchyLinksResponseMetaPage `json:"page,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{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseMeta instantiates a new TeamsHierarchyLinksResponseMeta 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 NewTeamsHierarchyLinksResponseMeta() *TeamsHierarchyLinksResponseMeta { + this := TeamsHierarchyLinksResponseMeta{} + return &this +} + +// NewTeamsHierarchyLinksResponseMetaWithDefaults instantiates a new TeamsHierarchyLinksResponseMeta 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 NewTeamsHierarchyLinksResponseMetaWithDefaults() *TeamsHierarchyLinksResponseMeta { + this := TeamsHierarchyLinksResponseMeta{} + return &this +} + +// GetPage returns the Page field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMeta) GetPage() TeamsHierarchyLinksResponseMetaPage { + if o == nil || o.Page == nil { + var ret TeamsHierarchyLinksResponseMetaPage + return ret + } + return *o.Page +} + +// GetPageOk returns a tuple with the Page field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMeta) GetPageOk() (*TeamsHierarchyLinksResponseMetaPage, bool) { + if o == nil || o.Page == nil { + return nil, false + } + return o.Page, true +} + +// HasPage returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMeta) HasPage() bool { + return o != nil && o.Page != nil +} + +// SetPage gets a reference to the given TeamsHierarchyLinksResponseMetaPage and assigns it to the Page field. +func (o *TeamsHierarchyLinksResponseMeta) SetPage(v TeamsHierarchyLinksResponseMetaPage) { + o.Page = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Page != nil { + toSerialize["page"] = o.Page + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Page *TeamsHierarchyLinksResponseMetaPage `json:"page,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{"page"}) + } else { + return err + } + + hasInvalidField := false + if all.Page != nil && all.Page.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Page = all.Page + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go b/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go new file mode 100644 index 00000000000..8776e9f3d32 --- /dev/null +++ b/api/datadogV2/model_teams_hierarchy_links_response_meta_page.go @@ -0,0 +1,369 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// TeamsHierarchyLinksResponseMetaPage Metadata related to paging information that is included in the response when querying the team hierarchy links +type TeamsHierarchyLinksResponseMetaPage struct { + // First page number. + FirstNumber *int64 `json:"first_number,omitempty"` + // Last page number. + LastNumber *int64 `json:"last_number,omitempty"` + // Next page number. + NextNumber datadog.NullableInt64 `json:"next_number,omitempty"` + // Page number. + Number *int64 `json:"number,omitempty"` + // Previous page number. + PrevNumber datadog.NullableInt64 `json:"prev_number,omitempty"` + // Page size. + Size *int64 `json:"size,omitempty"` + // Total number of results. + Total *int64 `json:"total,omitempty"` + // Pagination type. + Type *string `json:"type,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{} `json:"-"` +} + +// NewTeamsHierarchyLinksResponseMetaPage instantiates a new TeamsHierarchyLinksResponseMetaPage 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 NewTeamsHierarchyLinksResponseMetaPage() *TeamsHierarchyLinksResponseMetaPage { + this := TeamsHierarchyLinksResponseMetaPage{} + return &this +} + +// NewTeamsHierarchyLinksResponseMetaPageWithDefaults instantiates a new TeamsHierarchyLinksResponseMetaPage 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 NewTeamsHierarchyLinksResponseMetaPageWithDefaults() *TeamsHierarchyLinksResponseMetaPage { + this := TeamsHierarchyLinksResponseMetaPage{} + return &this +} + +// GetFirstNumber returns the FirstNumber field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetFirstNumber() int64 { + if o == nil || o.FirstNumber == nil { + var ret int64 + return ret + } + return *o.FirstNumber +} + +// GetFirstNumberOk returns a tuple with the FirstNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetFirstNumberOk() (*int64, bool) { + if o == nil || o.FirstNumber == nil { + return nil, false + } + return o.FirstNumber, true +} + +// HasFirstNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasFirstNumber() bool { + return o != nil && o.FirstNumber != nil +} + +// SetFirstNumber gets a reference to the given int64 and assigns it to the FirstNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetFirstNumber(v int64) { + o.FirstNumber = &v +} + +// GetLastNumber returns the LastNumber field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetLastNumber() int64 { + if o == nil || o.LastNumber == nil { + var ret int64 + return ret + } + return *o.LastNumber +} + +// GetLastNumberOk returns a tuple with the LastNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetLastNumberOk() (*int64, bool) { + if o == nil || o.LastNumber == nil { + return nil, false + } + return o.LastNumber, true +} + +// HasLastNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasLastNumber() bool { + return o != nil && o.LastNumber != nil +} + +// SetLastNumber gets a reference to the given int64 and assigns it to the LastNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetLastNumber(v int64) { + o.LastNumber = &v +} + +// GetNextNumber returns the NextNumber field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseMetaPage) GetNextNumber() int64 { + if o == nil || o.NextNumber.Get() == nil { + var ret int64 + return ret + } + return *o.NextNumber.Get() +} + +// GetNextNumberOk returns a tuple with the NextNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNextNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.NextNumber.Get(), o.NextNumber.IsSet() +} + +// HasNextNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasNextNumber() bool { + return o != nil && o.NextNumber.IsSet() +} + +// SetNextNumber gets a reference to the given datadog.NullableInt64 and assigns it to the NextNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNextNumber(v int64) { + o.NextNumber.Set(&v) +} + +// SetNextNumberNil sets the value for NextNumber to be an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNextNumberNil() { + o.NextNumber.Set(nil) +} + +// UnsetNextNumber ensures that no value is present for NextNumber, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) UnsetNextNumber() { + o.NextNumber.Unset() +} + +// GetNumber returns the Number field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNumber() int64 { + if o == nil || o.Number == nil { + var ret int64 + return ret + } + return *o.Number +} + +// GetNumberOk returns a tuple with the Number field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetNumberOk() (*int64, bool) { + if o == nil || o.Number == nil { + return nil, false + } + return o.Number, true +} + +// HasNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasNumber() bool { + return o != nil && o.Number != nil +} + +// SetNumber gets a reference to the given int64 and assigns it to the Number field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetNumber(v int64) { + o.Number = &v +} + +// GetPrevNumber returns the PrevNumber field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TeamsHierarchyLinksResponseMetaPage) GetPrevNumber() int64 { + if o == nil || o.PrevNumber.Get() == nil { + var ret int64 + return ret + } + return *o.PrevNumber.Get() +} + +// GetPrevNumberOk returns a tuple with the PrevNumber field value if set, nil otherwise +// and a boolean to check if the value has been set. +// NOTE: If the value is an explicit nil, `nil, true` will be returned. +func (o *TeamsHierarchyLinksResponseMetaPage) GetPrevNumberOk() (*int64, bool) { + if o == nil { + return nil, false + } + return o.PrevNumber.Get(), o.PrevNumber.IsSet() +} + +// HasPrevNumber returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasPrevNumber() bool { + return o != nil && o.PrevNumber.IsSet() +} + +// SetPrevNumber gets a reference to the given datadog.NullableInt64 and assigns it to the PrevNumber field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetPrevNumber(v int64) { + o.PrevNumber.Set(&v) +} + +// SetPrevNumberNil sets the value for PrevNumber to be an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) SetPrevNumberNil() { + o.PrevNumber.Set(nil) +} + +// UnsetPrevNumber ensures that no value is present for PrevNumber, not even an explicit nil. +func (o *TeamsHierarchyLinksResponseMetaPage) UnsetPrevNumber() { + o.PrevNumber.Unset() +} + +// GetSize returns the Size field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetSize() int64 { + if o == nil || o.Size == nil { + var ret int64 + return ret + } + return *o.Size +} + +// GetSizeOk returns a tuple with the Size field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetSizeOk() (*int64, bool) { + if o == nil || o.Size == nil { + return nil, false + } + return o.Size, true +} + +// HasSize returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasSize() bool { + return o != nil && o.Size != nil +} + +// SetSize gets a reference to the given int64 and assigns it to the Size field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetSize(v int64) { + o.Size = &v +} + +// GetTotal returns the Total field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTotal() int64 { + if o == nil || o.Total == nil { + var ret int64 + return ret + } + return *o.Total +} + +// GetTotalOk returns a tuple with the Total field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTotalOk() (*int64, bool) { + if o == nil || o.Total == nil { + return nil, false + } + return o.Total, true +} + +// HasTotal returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasTotal() bool { + return o != nil && o.Total != nil +} + +// SetTotal gets a reference to the given int64 and assigns it to the Total field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetTotal(v int64) { + o.Total = &v +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *TeamsHierarchyLinksResponseMetaPage) GetType() string { + if o == nil || o.Type == nil { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) GetTypeOk() (*string, bool) { + if o == nil || o.Type == nil { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *TeamsHierarchyLinksResponseMetaPage) HasType() bool { + return o != nil && o.Type != nil +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *TeamsHierarchyLinksResponseMetaPage) SetType(v string) { + o.Type = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o TeamsHierarchyLinksResponseMetaPage) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.FirstNumber != nil { + toSerialize["first_number"] = o.FirstNumber + } + if o.LastNumber != nil { + toSerialize["last_number"] = o.LastNumber + } + if o.NextNumber.IsSet() { + toSerialize["next_number"] = o.NextNumber.Get() + } + if o.Number != nil { + toSerialize["number"] = o.Number + } + if o.PrevNumber.IsSet() { + toSerialize["prev_number"] = o.PrevNumber.Get() + } + if o.Size != nil { + toSerialize["size"] = o.Size + } + if o.Total != nil { + toSerialize["total"] = o.Total + } + if o.Type != nil { + toSerialize["type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *TeamsHierarchyLinksResponseMetaPage) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + FirstNumber *int64 `json:"first_number,omitempty"` + LastNumber *int64 `json:"last_number,omitempty"` + NextNumber datadog.NullableInt64 `json:"next_number,omitempty"` + Number *int64 `json:"number,omitempty"` + PrevNumber datadog.NullableInt64 `json:"prev_number,omitempty"` + Size *int64 `json:"size,omitempty"` + Total *int64 `json:"total,omitempty"` + Type *string `json:"type,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{"first_number", "last_number", "next_number", "number", "prev_number", "size", "total", "type"}) + } else { + return err + } + o.FirstNumber = all.FirstNumber + o.LastNumber = all.LastNumber + o.NextNumber = all.NextNumber + o.Number = all.Number + o.PrevNumber = all.PrevNumber + o.Size = all.Size + o.Total = all.Total + o.Type = all.Type + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.go b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.go new file mode 100644 index 00000000000..b32a0995f2f --- /dev/null +++ b/examples/v2/logs-restriction-queries/AddRoleToRestrictionQuery.go @@ -0,0 +1,38 @@ +// Grant role to a restriction query returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + // there is a valid "role" in the system + RoleDataID := os.Getenv("ROLE_DATA_ID") + + body := datadogV2.RelationshipToRole{ + Data: &datadogV2.RelationshipToRoleData{ + Id: datadog.PtrString(RoleDataID), + Type: datadogV2.ROLESTYPE_ROLES.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.AddRoleToRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + r, err := api.AddRoleToRestrictionQuery(ctx, RestrictionQueryDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.AddRoleToRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/logs-restriction-queries/CreateRestrictionQuery.go b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.go new file mode 100644 index 00000000000..f70119a745b --- /dev/null +++ b/examples/v2/logs-restriction-queries/CreateRestrictionQuery.go @@ -0,0 +1,38 @@ +// Create a restriction query returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.RestrictionQueryCreatePayload{ + Data: &datadogV2.RestrictionQueryCreateData{ + Attributes: &datadogV2.RestrictionQueryCreateAttributes{ + RestrictionQuery: "env:sandbox", + }, + Type: datadogV2.LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.CreateRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.CreateRestrictionQuery(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.CreateRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.CreateRestrictionQuery`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.go b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.go new file mode 100644 index 00000000000..ae524e7b73b --- /dev/null +++ b/examples/v2/logs-restriction-queries/DeleteRestrictionQuery.go @@ -0,0 +1,29 @@ +// Delete a restriction query returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.DeleteRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + r, err := api.DeleteRestrictionQuery(ctx, RestrictionQueryDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.DeleteRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/logs-restriction-queries/GetRestrictionQuery.go b/examples/v2/logs-restriction-queries/GetRestrictionQuery.go new file mode 100644 index 00000000000..6f00659446b --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRestrictionQuery.go @@ -0,0 +1,33 @@ +// Get a restriction query returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.GetRestrictionQuery(ctx, RestrictionQueryDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.GetRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.GetRestrictionQuery`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.go b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.go new file mode 100644 index 00000000000..b75626534e2 --- /dev/null +++ b/examples/v2/logs-restriction-queries/GetRoleRestrictionQuery.go @@ -0,0 +1,33 @@ +// Get restriction query for a given role returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "role" in the system + RoleDataID := os.Getenv("ROLE_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.GetRoleRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.GetRoleRestrictionQuery(ctx, RoleDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.GetRoleRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.GetRoleRestrictionQuery`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueries.go b/examples/v2/logs-restriction-queries/ListRestrictionQueries.go new file mode 100644 index 00000000000..5556085c194 --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueries.go @@ -0,0 +1,30 @@ +// List restriction queries returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListRestrictionQueries", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.ListRestrictionQueries(ctx, *datadogV2.NewListRestrictionQueriesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.ListRestrictionQueries`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.ListRestrictionQueries`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.go b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.go new file mode 100644 index 00000000000..6bb7a28142f --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListRestrictionQueryRoles.go @@ -0,0 +1,33 @@ +// List roles for a restriction query returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListRestrictionQueryRoles", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.ListRestrictionQueryRoles(ctx, RestrictionQueryDataID, *datadogV2.NewListRestrictionQueryRolesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.ListRestrictionQueryRoles`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.ListRestrictionQueryRoles`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.go b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.go new file mode 100644 index 00000000000..1dd1d3255fc --- /dev/null +++ b/examples/v2/logs-restriction-queries/ListUserRestrictionQueries.go @@ -0,0 +1,33 @@ +// Get all restriction queries for a given user returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "user" in the system + UserDataID := os.Getenv("USER_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ListUserRestrictionQueries", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.ListUserRestrictionQueries(ctx, UserDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.ListUserRestrictionQueries`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.ListUserRestrictionQueries`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.go b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.go new file mode 100644 index 00000000000..66d3b857b46 --- /dev/null +++ b/examples/v2/logs-restriction-queries/RemoveRoleFromRestrictionQuery.go @@ -0,0 +1,38 @@ +// Revoke role from a restriction query returns "OK" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + // there is a valid "role" in the system + RoleDataID := os.Getenv("ROLE_DATA_ID") + + body := datadogV2.RelationshipToRole{ + Data: &datadogV2.RelationshipToRoleData{ + Id: datadog.PtrString(RoleDataID), + Type: datadogV2.ROLESTYPE_ROLES.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.RemoveRoleFromRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + r, err := api.RemoveRoleFromRestrictionQuery(ctx, RestrictionQueryDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.RemoveRoleFromRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.go b/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.go new file mode 100644 index 00000000000..b4a8f34b72d --- /dev/null +++ b/examples/v2/logs-restriction-queries/ReplaceRestrictionQuery.go @@ -0,0 +1,41 @@ +// Replace a restriction query returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + body := datadogV2.RestrictionQueryUpdatePayload{ + Data: &datadogV2.RestrictionQueryUpdateData{ + Attributes: &datadogV2.RestrictionQueryUpdateAttributes{ + RestrictionQuery: "env:staging", + }, + Type: datadogV2.LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.ReplaceRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.ReplaceRestrictionQuery(ctx, RestrictionQueryDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.ReplaceRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.ReplaceRestrictionQuery`:\n%s\n", responseContent) +} diff --git a/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.go b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.go new file mode 100644 index 00000000000..ee7c95c8f98 --- /dev/null +++ b/examples/v2/logs-restriction-queries/UpdateRestrictionQuery.go @@ -0,0 +1,41 @@ +// Update a restriction query returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "restriction_query" in the system + RestrictionQueryDataID := os.Getenv("RESTRICTION_QUERY_DATA_ID") + + body := datadogV2.RestrictionQueryUpdatePayload{ + Data: &datadogV2.RestrictionQueryUpdateData{ + Attributes: &datadogV2.RestrictionQueryUpdateAttributes{ + RestrictionQuery: "env:production", + }, + Type: datadogV2.LOGSRESTRICTIONQUERIESTYPE_LOGS_RESTRICTION_QUERIES.Ptr(), + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + configuration.SetUnstableOperationEnabled("v2.UpdateRestrictionQuery", true) + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewLogsRestrictionQueriesApi(apiClient) + resp, r, err := api.UpdateRestrictionQuery(ctx, RestrictionQueryDataID, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `LogsRestrictionQueriesApi.UpdateRestrictionQuery`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `LogsRestrictionQueriesApi.UpdateRestrictionQuery`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/AddTeamHierarchyLink.go b/examples/v2/teams/AddTeamHierarchyLink.go new file mode 100644 index 00000000000..470c1d5506e --- /dev/null +++ b/examples/v2/teams/AddTeamHierarchyLink.go @@ -0,0 +1,54 @@ +// Create a team hierarchy link returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "dd_team" in the system + DdTeamDataID := os.Getenv("DD_TEAM_DATA_ID") + + // there is a valid "dd_team_2" in the system + DdTeam2DataID := os.Getenv("DD_TEAM_2_DATA_ID") + + body := datadogV2.TeamHierarchyLinkCreateRequest{ + Data: datadogV2.TeamHierarchyLinkCreate{ + Relationships: datadogV2.TeamHierarchyLinkCreateRelationships{ + ParentTeam: datadogV2.TeamHierarchyLinkCreateTeamRelationship{ + Data: datadogV2.TeamHierarchyLinkCreateTeam{ + Id: DdTeamDataID, + Type: datadogV2.TEAMTYPE_TEAM, + }, + }, + SubTeam: datadogV2.TeamHierarchyLinkCreateTeamRelationship{ + Data: datadogV2.TeamHierarchyLinkCreateTeam{ + Id: DdTeam2DataID, + Type: datadogV2.TEAMTYPE_TEAM, + }, + }, + }, + Type: datadogV2.TEAMHIERARCHYLINKTYPE_TEAM_HIERARCHY_LINKS, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.AddTeamHierarchyLink(ctx, body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.AddTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.AddTeamHierarchyLink`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/GetTeamHierarchyLink.go b/examples/v2/teams/GetTeamHierarchyLink.go new file mode 100644 index 00000000000..8b2a9b035a6 --- /dev/null +++ b/examples/v2/teams/GetTeamHierarchyLink.go @@ -0,0 +1,32 @@ +// Get a team hierarchy link returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.GetTeamHierarchyLink(ctx, TeamHierarchyLinkDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.GetTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.GetTeamHierarchyLink`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/ListTeamHierarchyLinks.go b/examples/v2/teams/ListTeamHierarchyLinks.go new file mode 100644 index 00000000000..2467c2fa849 --- /dev/null +++ b/examples/v2/teams/ListTeamHierarchyLinks.go @@ -0,0 +1,33 @@ +// Get team hierarchy links returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataRelationshipsParentTeamDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_RELATIONSHIPS_PARENT_TEAM_DATA_ID") + TeamHierarchyLinkDataRelationshipsSubTeamDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_RELATIONSHIPS_SUB_TEAM_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, r, err := api.ListTeamHierarchyLinks(ctx, *datadogV2.NewListTeamHierarchyLinksOptionalParameters().WithFilterParentTeam(TeamHierarchyLinkDataRelationshipsParentTeamDataID).WithFilterSubTeam(TeamHierarchyLinkDataRelationshipsSubTeamDataID).WithPageNumber(0).WithPageSize(100)) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.ListTeamHierarchyLinks`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `TeamsApi.ListTeamHierarchyLinks`:\n%s\n", responseContent) +} diff --git a/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go b/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go new file mode 100644 index 00000000000..2100f34fa5c --- /dev/null +++ b/examples/v2/teams/ListTeamHierarchyLinks_3360757486.go @@ -0,0 +1,29 @@ +// Get team hierarchy links returns "OK" response with pagination + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + resp, _ := api.ListTeamHierarchyLinksWithPagination(ctx, *datadogV2.NewListTeamHierarchyLinksOptionalParameters()) + + for paginationResult := range resp { + if paginationResult.Error != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.ListTeamHierarchyLinks`: %v\n", paginationResult.Error) + } + responseContent, _ := json.MarshalIndent(paginationResult.Item, "", " ") + fmt.Fprintf(os.Stdout, "%s\n", responseContent) + } +} diff --git a/examples/v2/teams/RemoveTeamHierarchyLink.go b/examples/v2/teams/RemoveTeamHierarchyLink.go new file mode 100644 index 00000000000..d6690982165 --- /dev/null +++ b/examples/v2/teams/RemoveTeamHierarchyLink.go @@ -0,0 +1,28 @@ +// Remove a team hierarchy link returns "No Content" response + +package main + +import ( + "context" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + // there is a valid "team_hierarchy_link" in the system + TeamHierarchyLinkDataID := os.Getenv("TEAM_HIERARCHY_LINK_DATA_ID") + + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewTeamsApi(apiClient) + r, err := api.RemoveTeamHierarchyLink(ctx, TeamHierarchyLinkDataID) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `TeamsApi.RemoveTeamHierarchyLink`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 6fedea1b018..4f9dcb43517 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -92,6 +92,7 @@ var apiMappings = map[string]map[string]reflect.Value{ "LogsArchivesApi": reflect.ValueOf(datadogV2.NewLogsArchivesApi), "LogsCustomDestinationsApi": reflect.ValueOf(datadogV2.NewLogsCustomDestinationsApi), "LogsMetricsApi": reflect.ValueOf(datadogV2.NewLogsMetricsApi), + "LogsRestrictionQueriesApi": reflect.ValueOf(datadogV2.NewLogsRestrictionQueriesApi), "MetricsApi": reflect.ValueOf(datadogV2.NewMetricsApi), "MonitorsApi": reflect.ValueOf(datadogV2.NewMonitorsApi), "NetworkDeviceMonitoringApi": reflect.ValueOf(datadogV2.NewNetworkDeviceMonitoringApi), diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..46f704ffe2a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:04.509Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..703205d5a8a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_Bad_Request_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: | + {"test":"bad_request"} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"errors":["API input validation failed: {''_schema'': [{''detail'': ''Object + must include `data` key.'', ''source'': {''pointer'': ''/''}}]}"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.freeze new file mode 100644 index 00000000000..e7d3eb34c15 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:05.128Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.yaml new file mode 100644 index 00000000000..f1fdf8ba4f6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Create_a_restriction_query_returns_OK_response.yaml @@ -0,0 +1,41 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2b5594f8-c4b3-11f0-a05d-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:05.370176+00:00","modified_at":"2025-11-18T19:17:05.370176+00:00"}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2b5594f8-c4b3-11f0-a05d-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..606a5c297d1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:06.402Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..4605e1a5348 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Bad_Request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id + response: + body: '{"errors":["uuid is not proper type"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.freeze new file mode 100644 index 00000000000..b407dce9fca --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:06.567Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.yaml new file mode 100644 index 00000000000..fd388c48713 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_Not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000 + response: + body: '{"errors":["Restriction query not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.freeze new file mode 100644 index 00000000000..233ffaffa5c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:06.720Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.yaml new file mode 100644 index 00000000000..39e3d6d3a39 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Delete_a_restriction_query_returns_OK_response.yaml @@ -0,0 +1,58 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2c373dc2-c4b3-11f0-8ca7-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:06.848316+00:00","modified_at":"2025-11-18T19:17:06.848316+00:00"}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 1 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2c373dc2-c4b3-11f0-8ca7-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2c373dc2-c4b3-11f0-8ca7-da7ad0900002 + response: + body: '{"errors":["Restriction query not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..35466be5038 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:07.277Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..c290bf72abc --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Bad_Request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id + response: + body: '{"errors":["uuid is not proper type"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.freeze new file mode 100644 index 00000000000..27aff0c3f07 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:07.461Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.yaml new file mode 100644 index 00000000000..99bce8f6cb8 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_Not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000 + response: + body: '{"errors":["Restriction query not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.freeze new file mode 100644 index 00000000000..1f267748178 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:07.622Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.yaml new file mode 100644 index 00000000000..c6a63138491 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_a_restriction_query_returns_OK_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2cc39998-c4b3-11f0-8b4b-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:07.768188+00:00","modified_at":"2025-11-18T19:17:07.768188+00:00"}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2cc39998-c4b3-11f0-8b4b-da7ad0900002 + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2cc39998-c4b3-11f0-8b4b-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:07.768188+00:00","modified_at":"2025-11-18T19:17:07.768188+00:00"},"relationships":{"roles":{"data":[]}}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2cc39998-c4b3-11f0-8b4b-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..57b32bd8904 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:08.172Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..759b68eb91c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Bad_Request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/user/malformed_id + response: + body: '{"errors":["uuid is not proper type"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.freeze new file mode 100644 index 00000000000..9ee4a5d5206 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:08.336Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.yaml new file mode 100644 index 00000000000..f44e382f45d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_all_restriction_queries_for_a_given_user_returns_Not_found_response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/user/00000000-0000-0000-0000-000000000000 + response: + body: '{"errors":["user with uuid 00000000-0000-0000-0000-000000000000 doesn''t + exist"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..57897532acf --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:08.604Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..ad8831f75f2 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Bad_Request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/malformed_id + response: + body: '{"errors":["Missing Role malformed_id"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.freeze new file mode 100644 index 00000000000..bd0df2da885 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:08.828Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.yaml new file mode 100644 index 00000000000..c1b674f6d92 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_Not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/00000000-0000-0000-0000-000000000000 + response: + body: '{"errors":["Missing Role 00000000-0000-0000-0000-000000000000"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.freeze new file mode 100644 index 00000000000..8dc9f697b0c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:08.994Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.yaml new file mode 100644 index 00000000000..2234b4e13f1 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Get_restriction_query_for_a_given_role_returns_OK_response.yaml @@ -0,0 +1,56 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"name":"Test-Get_restriction_query_for_a_given_role_returns_OK_response-1763493428"},"type":"roles"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/roles + response: + body: '{"data":{"id":"2d925300-c4b3-11f0-a252-da7ad0900002","type":"roles","attributes":{"created_at":"2025-11-18T19:17:09.12367Z","modified_at":"2025-11-18T19:17:09.123777Z","name":"Test-Get_restriction_query_for_a_given_role_returns_OK_response-1763493428","team_count":0,"user_count":0},"relationships":{"permissions":{"data":[{"id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","type":"permissions"},{"id":"4441648c-d8b1-11e9-a77a-1b899a04b304","type":"permissions"},{"id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","type":"permissions"},{"id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","type":"permissions"},{"id":"7605ef24-f376-11eb-b90b-da7ad0900002","type":"permissions"},{"id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002","type":"permissions"},{"id":"f8e941cf-e746-11ec-b22d-da7ad0900002","type":"permissions"},{"id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","type":"permissions"},{"id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","type":"permissions"},{"id":"50c270de-69ee-11ee-9151-da7ad0900002","type":"permissions"}]}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/role/2d925300-c4b3-11f0-a252-da7ad0900002 + response: + body: '{"data":[]} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/roles/2d925300-c4b3-11f0-a252-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..48cf494a95d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:09.440Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..d0da87342cd --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id/roles + response: + body: '{"errors":["Role with id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.freeze new file mode 100644 index 00000000000..f281a86a45c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:09.623Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.yaml new file mode 100644 index 00000000000..d8757dfea53 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_Not_found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: | + {"data":{"id":"3653d3c6-0c75-11ea-ad28-fb5701eabc7d","type":"roles"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000/roles + response: + body: '{"errors":["Role with id: 3653d3c6-0c75-11ea-ad28-fb5701eabc7d not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.freeze new file mode 100644 index 00000000000..ac88614fb58 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:09.783Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.yaml new file mode 100644 index 00000000000..dd770af8939 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_Grant_role_to_a_restriction_query_returns_OK_response.yaml @@ -0,0 +1,96 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2e0a0abc-c4b3-11f0-9b1d-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:09.907646+00:00","modified_at":"2025-11-18T19:17:09.907646+00:00"}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: | + {"data":{"attributes":{"name":"Test-Grant_role_to_a_restriction_query_returns_OK_response-1763493429"},"type":"roles"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/roles + response: + body: '{"data":{"id":"2e209fb6-c4b3-11f0-8483-da7ad0900002","type":"roles","attributes":{"created_at":"2025-11-18T19:17:10.056015Z","modified_at":"2025-11-18T19:17:10.056318Z","name":"Test-Grant_role_to_a_restriction_query_returns_OK_response-1763493429","team_count":0,"user_count":0},"relationships":{"permissions":{"data":[{"id":"d90f6830-d3d8-11e9-a77a-b3404e5e9ee2","type":"permissions"},{"id":"4441648c-d8b1-11e9-a77a-1b899a04b304","type":"permissions"},{"id":"417ba636-2dce-11eb-84c0-6bce5b0d9de0","type":"permissions"},{"id":"12efc20e-d36c-11eb-a9b8-da7ad0900002","type":"permissions"},{"id":"7605ef24-f376-11eb-b90b-da7ad0900002","type":"permissions"},{"id":"b6bf9ac6-9a59-11ec-8480-da7ad0900002","type":"permissions"},{"id":"f8e941cf-e746-11ec-b22d-da7ad0900002","type":"permissions"},{"id":"6c5ad874-7aff-11ed-a5cd-da7ad0900002","type":"permissions"},{"id":"a8b4d6e8-4ea4-11ee-b482-da7ad0900002","type":"permissions"},{"id":"50c270de-69ee-11ee-9151-da7ad0900002","type":"permissions"}]}}}}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"id":"2e209fb6-c4b3-11f0-8483-da7ad0900002","type":"roles"}} + form: {} + headers: + Accept: + - '*/*' + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2e0a0abc-c4b3-11f0-9b1d-da7ad0900002/roles + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/roles/2e209fb6-c4b3-11f0-8483-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2e0a0abc-c4b3-11f0-9b1d-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.freeze new file mode 100644 index 00000000000..d227ca557fa --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:10.912Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.yaml new file mode 100644 index 00000000000..a8572b5acd0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_restriction_queries_returns_OK_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":[{"type":"logs_restriction_queries","id":"6358d012-be7e-11f0-8999-da7ad0900002","attributes":{"restriction_query":"env:production","created_at":"2025-11-10T21:44:09.039708+00:00","modified_at":"2025-11-10T21:44:09.164487+00:00"}}]} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..0badf861112 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:11.052Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..a974e75791d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Bad_Request_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/malformed_id/roles + response: + body: '{"errors":["uuid is not proper type"]}' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.freeze new file mode 100644 index 00000000000..358663320c3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:11.231Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.yaml new file mode 100644 index 00000000000..27073951251 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_Not_found_response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/00000000-0000-0000-0000-000000000000/roles + response: + body: '{"errors":["Restriction query not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.freeze new file mode 100644 index 00000000000..5e8d0cb60e0 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-18T19:17:11.376Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.yaml new file mode 100644 index 00000000000..3ef05630367 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Logs_Restriction_Queries/Scenario_List_roles_for_a_restriction_query_returns_OK_response.yaml @@ -0,0 +1,60 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"restriction_query":"env:sandbox"},"type":"logs_restriction_queries"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries + response: + body: '{"data":{"type":"logs_restriction_queries","id":"2efc1406-c4b3-11f0-a6d9-da7ad0900002","attributes":{"restriction_query":"env:sandbox","created_at":"2025-11-18T19:17:11.492694+00:00","modified_at":"2025-11-18T19:17:11.492694+00:00"}}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 1 + method: GET + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2efc1406-c4b3-11f0-a6d9-da7ad0900002/roles + response: + body: '{"data":[]} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 2 + method: DELETE + url: https://api.datadoghq.com/api/v2/logs/config/restriction_queries/2efc1406-c4b3-11f0-a6d9-da7ad0900002 + response: + body: '' + code: 204 + duration: 0ms + headers: + Content-Type: + - text/html; charset=utf-8 + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze new file mode 100644 index 00000000000..5ca151ab8b7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.freeze @@ -0,0 +1 @@ +2025-11-24T14:29:58.684Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml new file mode 100644 index 00000000000..92f23b8097f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_CREATED_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-34095e00d70ee50a","name":"test-name-34095e00d70ee50a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team","attributes":{"avatar":null,"banner":3,"created_at":"2025-11-24T14:29:59.195740+00:00","description":null,"handle":"test-handle-34095e00d70ee50a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T14:29:59.195740+00:00","name":"test-name-34095e00d70ee50a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-34095e00d70ee50a","name":"test-name-2-34095e00d70ee50a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team","attributes":{"avatar":null,"banner":14,"created_at":"2025-11-24T14:29:59.754699+00:00","description":null,"handle":"test-handle-2-34095e00d70ee50a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T14:29:59.754699+00:00","name":"test-name-2-34095e00d70ee50a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team"}},"sub_team":{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"c53bed14-1c0a-4895-b845-1c04be086ba0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T14:30:00.032477595Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team"}},"sub_team":{"data":{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team"}}}},"included":[{"id":"551c947a-0f0f-4ff0-8c41-0ceddabe3551","type":"team","attributes":{"avatar":null,"banner":3,"handle":"test-handle-34095e00d70ee50a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-34095e00d70ee50a","summary":null,"user_count":0}},{"id":"e1c6ab08-0325-4df7-aea1-6bec76692d55","type":"team","attributes":{"avatar":null,"banner":14,"handle":"test-handle-2-34095e00d70ee50a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-34095e00d70ee50a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/c53bed14-1c0a-4895-b845-1c04be086ba0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/e1c6ab08-0325-4df7-aea1-6bec76692d55 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/551c947a-0f0f-4ff0-8c41-0ceddabe3551 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze new file mode 100644 index 00000000000..4da94657eeb --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:06:46.856Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml new file mode 100644 index 00000000000..9fe1272ea99 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_Conflict_response.yaml @@ -0,0 +1,130 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-6c891437b748aea8","name":"test-name-6c891437b748aea8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team","attributes":{"avatar":null,"banner":0,"created_at":"2025-11-24T17:06:47.453319+00:00","description":null,"handle":"test-handle-6c891437b748aea8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:06:47.453319+00:00","name":"test-name-6c891437b748aea8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-6c891437b748aea8","name":"test-name-2-6c891437b748aea8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team","attributes":{"avatar":null,"banner":2,"created_at":"2025-11-24T17:06:48.020887+00:00","description":null,"handle":"test-handle-2-6c891437b748aea8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:06:48.020887+00:00","name":"test-name-2-6c891437b748aea8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"e980108e-d535-4bdf-84ca-5e8f84a68480","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:06:48.279316439Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}}},"included":[{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team","attributes":{"avatar":null,"banner":0,"handle":"test-handle-6c891437b748aea8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-6c891437b748aea8","summary":null,"user_count":0}},{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team","attributes":{"avatar":null,"banner":2,"handle":"test-handle-2-6c891437b748aea8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-6c891437b748aea8","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87","type":"team"}},"sub_team":{"data":{"id":"21296c73-c9e2-4889-a33f-417d2974b2bd","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 3 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"errors":["Conflict: could not add team 21296c73-c9e2-4889-a33f-417d2974b2bd + as a member team of team 4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 in org 321813: + team hierarchy link between super team 4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 + and member team 21296c73-c9e2-4889-a33f-417d2974b2bd already exists in org 321813"]}' + code: 409 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 409 Conflict +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/e980108e-d535-4bdf-84ca-5e8f84a68480 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/21296c73-c9e2-4889-a33f-417d2974b2bd + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/4a9a1845-0ba7-4a6f-a34d-6e72a4ffda87 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze new file mode 100644 index 00000000000..bf8a8d4fa45 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T16:01:16.053Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml new file mode 100644 index 00000000000..4646c15d807 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_OK_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-4d8084da4dfa4ed8","name":"test-name-4d8084da4dfa4ed8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team","attributes":{"avatar":null,"banner":11,"created_at":"2025-11-24T16:01:16.149673+00:00","description":null,"handle":"test-handle-4d8084da4dfa4ed8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T16:01:16.149673+00:00","name":"test-name-4d8084da4dfa4ed8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-4d8084da4dfa4ed8","name":"test-name-2-4d8084da4dfa4ed8"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team","attributes":{"avatar":null,"banner":4,"created_at":"2025-11-24T16:01:16.315013+00:00","description":null,"handle":"test-handle-2-4d8084da4dfa4ed8","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T16:01:16.315013+00:00","name":"test-name-2-4d8084da4dfa4ed8","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team"}},"sub_team":{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"6cf86539-2c6e-497e-8cef-0b285ff05514","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T16:01:16.460042023Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team"}},"sub_team":{"data":{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team"}}}},"included":[{"id":"d5b049f4-59f1-474d-ad98-5a7342a8961f","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-4d8084da4dfa4ed8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-4d8084da4dfa4ed8","summary":null,"user_count":0}},{"id":"790428f6-10bc-427d-bf36-f53ca3c197e0","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-4d8084da4dfa4ed8","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-4d8084da4dfa4ed8","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/6cf86539-2c6e-497e-8cef-0b285ff05514 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/790428f6-10bc-427d-bf36-f53ca3c197e0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/d5b049f4-59f1-474d-ad98-5a7342a8961f + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze new file mode 100644 index 00000000000..e4ed51cc867 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.freeze @@ -0,0 +1 @@ +2025-11-24T15:48:39.900Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml new file mode 100644 index 00000000000..3a4677e53a9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Create_a_team_hierarchy_link_returns_SUCCESS_response.yaml @@ -0,0 +1,107 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-a75ee0b8b483d66f","name":"test-name-a75ee0b8b483d66f"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team","attributes":{"avatar":null,"banner":3,"created_at":"2025-11-24T15:48:40.359260+00:00","description":null,"handle":"test-handle-a75ee0b8b483d66f","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T15:48:40.359261+00:00","name":"test-name-a75ee0b8b483d66f","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-a75ee0b8b483d66f","name":"test-name-2-a75ee0b8b483d66f"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team","attributes":{"avatar":null,"banner":8,"created_at":"2025-11-24T15:48:40.893488+00:00","description":null,"handle":"test-handle-2-a75ee0b8b483d66f","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T15:48:40.893488+00:00","name":"test-name-2-a75ee0b8b483d66f","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team"}},"sub_team":{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"fb94d43b-fe10-4c5f-ae7c-4ad745428651","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T15:48:41.150923395Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team"}},"sub_team":{"data":{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team"}}}},"included":[{"id":"b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd","type":"team","attributes":{"avatar":null,"banner":3,"handle":"test-handle-a75ee0b8b483d66f","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-a75ee0b8b483d66f","summary":null,"user_count":0}},{"id":"2d096572-eb6a-4579-ba38-b4247cf75e17","type":"team","attributes":{"avatar":null,"banner":8,"handle":"test-handle-2-a75ee0b8b483d66f","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-a75ee0b8b483d66f","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/fb94d43b-fe10-4c5f-ae7c-4ad745428651 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/2d096572-eb6a-4579-ba38-b4247cf75e17 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/b85e63cd-1d9f-4b71-a47c-f5a99d4a4afd + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..21b6221c0da --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2025-11-24T13:19:11.816Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..e5fc2980998 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_API_error_response._response.yaml @@ -0,0 +1,19 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/aaa11111-aa11-aa11-aaaa-aaaaaa111111 + response: + body: '{"errors":["Not Found: team hierarchy link not found (linkId=aaa11111-aa11-aa11-aaaa-aaaaaa111111)"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze new file mode 100644 index 00000000000..be8e0fd4a38 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:07:09.212Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml new file mode 100644 index 00000000000..c235c3fb729 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_a_team_hierarchy_link_returns_OK_response.yaml @@ -0,0 +1,124 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-ae3e76a23be3747a","name":"test-name-ae3e76a23be3747a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"created_at":"2025-11-24T17:07:09.817794+00:00","description":null,"handle":"test-handle-ae3e76a23be3747a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:07:09.817794+00:00","name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-ae3e76a23be3747a","name":"test-name-2-ae3e76a23be3747a"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"created_at":"2025-11-24T17:07:10.381761+00:00","description":null,"handle":"test-handle-2-ae3e76a23be3747a","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:07:10.381761+00:00","name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"5401e712-de1b-4deb-ac35-2c6ee1943ad0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:07:10.643798843Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}}},"included":[{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-ae3e76a23be3747a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0}},{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-ae3e76a23be3747a","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 3 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0 + response: + body: '{"data":{"id":"5401e712-de1b-4deb-ac35-2c6ee1943ad0","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:07:10.643799Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team"}},"sub_team":{"data":{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team"}}}},"links":{"self":"https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0"},"included":[{"id":"196bcc55-bd30-4cfd-8549-b3d255a0517b","type":"team","attributes":{"avatar":null,"banner":4,"handle":"test-handle-2-ae3e76a23be3747a","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-2-ae3e76a23be3747a","summary":null,"user_count":0}},{"id":"fafeac94-42b4-4469-91e8-0ae5ca3f564b","type":"team","attributes":{"avatar":null,"banner":11,"handle":"test-handle-ae3e76a23be3747a","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-ae3e76a23be3747a","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/5401e712-de1b-4deb-ac35-2c6ee1943ad0 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/196bcc55-bd30-4cfd-8549-b3d255a0517b + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/fafeac94-42b4-4469-91e8-0ae5ca3f564b + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze new file mode 100644 index 00000000000..1d3731961ea --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:18:13.180Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml new file mode 100644 index 00000000000..b70b4f5f0c3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Get_team_hierarchy_links_returns_OK_response.yaml @@ -0,0 +1,124 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-ab0ee85594ae1dfd","name":"test-name-ab0ee85594ae1dfd"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"created_at":"2025-11-24T17:18:13.814865+00:00","description":null,"handle":"test-handle-ab0ee85594ae1dfd","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:18:13.814865+00:00","name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-ab0ee85594ae1dfd","name":"test-name-2-ab0ee85594ae1dfd"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"created_at":"2025-11-24T17:18:14.383042+00:00","description":null,"handle":"test-handle-2-ab0ee85594ae1dfd","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:18:14.383042+00:00","name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"61509612-5bb0-42c5-a16e-bf4920acf473","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:18:14.635205462Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}}},"included":[{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0}},{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"handle":"test-handle-2-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 3 + method: GET + url: https://api.datadoghq.com/api/v2/team-hierarchy-links?filter%5Bparent_team%5D=d1baf3de-7316-43b5-8582-dc887acc26ef&filter%5Bsub_team%5D=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d&page%5Bnumber%5D=0&page%5Bsize%5D=100 + response: + body: '{"data":[{"id":"61509612-5bb0-42c5-a16e-bf4920acf473","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:18:14.635205Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team"}},"sub_team":{"data":{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team"}}}}],"meta":{"page":{"type":"number_size","number":0,"size":100,"total":1,"first_number":0,"prev_number":null,"next_number":null,"last_number":0}},"links":{"self":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter%5Bparent_team%5D=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter%5Bsub_team%5D=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page%5Bnumber%5D=0\u0026page%5Bsize%5D=100","first":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter[parent_team]=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter[sub_team]=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page[number]=0\u0026page[size]=100","last":"https://api.datadoghq.com/api/v2/team-hierarchy-links?filter[parent_team]=d1baf3de-7316-43b5-8582-dc887acc26ef\u0026filter[sub_team]=61b0ab36-c1e5-47fd-898a-ba9bfc860e9d\u0026page[number]=0\u0026page[size]=100"},"included":[{"id":"61b0ab36-c1e5-47fd-898a-ba9bfc860e9d","type":"team","attributes":{"avatar":null,"banner":13,"handle":"test-handle-2-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-2-ab0ee85594ae1dfd","summary":null,"user_count":0}},{"id":"d1baf3de-7316-43b5-8582-dc887acc26ef","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-ab0ee85594ae1dfd","is_managed":false,"is_open_membership":true,"link_count":0,"name":"test-name-ab0ee85594ae1dfd","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/61509612-5bb0-42c5-a16e-bf4920acf473 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/61b0ab36-c1e5-47fd-898a-ba9bfc860e9d + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/d1baf3de-7316-43b5-8582-dc887acc26ef + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze new file mode 100644 index 00000000000..73f686747b4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.freeze @@ -0,0 +1 @@ +2025-11-24T13:14:20.481Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml new file mode 100644 index 00000000000..27a61a63fc4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_API_error_response._response.yaml @@ -0,0 +1,20 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 0 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/aaa11111-aa11-aa11-aaaa-aaaaaa111111 + response: + body: '{"errors":["Not Found: link with id aaa11111-aa11-aa11-aaaa-aaaaaa111111 + not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze new file mode 100644 index 00000000000..be1311ed7c9 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.freeze @@ -0,0 +1 @@ +2025-11-24T17:08:01.196Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml new file mode 100644 index 00000000000..6a39040a3d7 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Teams/Scenario_Remove_a_team_hierarchy_link_returns_No_Content_response.yaml @@ -0,0 +1,125 @@ +interactions: +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-db31819631324305","name":"test-name-db31819631324305"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team","attributes":{"avatar":null,"banner":10,"created_at":"2025-11-24T17:08:01.930314+00:00","description":null,"handle":"test-handle-db31819631324305","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:08:01.930314+00:00","name":"test-name-db31819631324305","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"attributes":{"handle":"test-handle-2-db31819631324305","name":"test-name-2-db31819631324305"},"type":"team"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 1 + method: POST + url: https://api.datadoghq.com/api/v2/team + response: + body: '{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team","attributes":{"avatar":null,"banner":6,"created_at":"2025-11-24T17:08:02.174211+00:00","description":null,"handle":"test-handle-2-db31819631324305","hidden_modules":null,"is_managed":false,"link_count":0,"modified_at":"2025-11-24T17:08:02.174211+00:00","name":"test-name-2-db31819631324305","summary":null,"user_count":0,"visible_modules":null},"relationships":{"team_links":{"data":[],"links":{"related":"/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c/links"}},"user_team_permissions":{"data":null,"links":{"related":"/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c/permission-settings"}}}}}' + code: 201 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 201 Created +- request: + body: | + {"data":{"relationships":{"parent_team":{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team"}},"sub_team":{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team"}}},"type":"team_hierarchy_links"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 2 + method: POST + url: https://api.datadoghq.com/api/v2/team-hierarchy-links + response: + body: '{"data":{"id":"185446b8-1e88-419c-b266-3933f1411b6e","type":"team_hierarchy_links","attributes":{"created_at":"2025-11-24T17:08:02.736655421Z","provisioned_by":""},"relationships":{"parent_team":{"data":{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team"}},"sub_team":{"data":{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team"}}}},"included":[{"id":"eaf01981-6b63-41ba-b49f-30449c50e865","type":"team","attributes":{"avatar":null,"banner":10,"handle":"test-handle-db31819631324305","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-db31819631324305","summary":null,"user_count":0}},{"id":"120aeb27-ca42-4e38-a9e4-6497b8f9407c","type":"team","attributes":{"avatar":null,"banner":6,"handle":"test-handle-2-db31819631324305","is_managed":false,"is_open_membership":false,"link_count":0,"name":"test-name-2-db31819631324305","summary":null,"user_count":0}}]}' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 200 OK +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 3 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/185446b8-1e88-419c-b266-3933f1411b6e + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 4 + method: DELETE + url: https://api.datadoghq.com/api/v2/team-hierarchy-links/185446b8-1e88-419c-b266-3933f1411b6e + response: + body: '{"errors":["Not Found: link with id 185446b8-1e88-419c-b266-3933f1411b6e + not found"]}' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/vnd.api+json + status: 404 Not Found +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 5 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/120aeb27-ca42-4e38-a9e4-6497b8f9407c + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +- request: + body: '' + form: {} + headers: + Accept: + - '*/*' + id: 6 + method: DELETE + url: https://api.datadoghq.com/api/v2/team/eaf01981-6b63-41ba-b49f-30449c50e865 + response: + body: '' + code: 204 + duration: 0ms + headers: {} + status: 204 No Content +version: 2 diff --git a/tests/scenarios/features/v2/given.json b/tests/scenarios/features/v2/given.json index 198c7af1b51..6c6d3bf98f4 100644 --- a/tests/scenarios/features/v2/given.json +++ b/tests/scenarios/features/v2/given.json @@ -679,6 +679,18 @@ "tag": "Logs Metrics", "operationId": "CreateLogsMetric" }, + { + "parameters": [ + { + "name": "body", + "value": "{\"data\": {\"attributes\": {\"restriction_query\": \"env:sandbox\"}, \"type\": \"logs_restriction_queries\"}}" + } + ], + "step": "there is a valid \"restriction_query\" in the system", + "key": "restriction_query", + "tag": "Logs Restriction Queries", + "operationId": "CreateRestrictionQuery" + }, { "parameters": [ { @@ -1169,6 +1181,30 @@ "tag": "Teams", "operationId": "CreateTeam" }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"attributes\": {\n \"handle\": \"test-handle-2-{{ unique_hash }}\",\n \"name\": \"test-name-2-{{ unique_hash }}\"\n },\n \"type\": \"team\"\n }\n}" + } + ], + "step": "there is a valid \"dd_team_2\" in the system", + "key": "dd_team_2", + "tag": "Teams", + "operationId": "CreateTeam" + }, + { + "parameters": [ + { + "name": "body", + "value": "{\n \"data\": {\n \"type\": \"team_hierarchy_links\",\n \"relationships\": {\n \"parent_team\": {\n \"data\": {\n \"id\": \"{{ dd_team.data.id }}\",\n \"type\": \"team\"\n }\n },\n \"sub_team\": {\n \"data\": {\n \"id\": \"{{ dd_team_2.data.id }}\",\n \"type\": \"team\"\n }\n }\n }\n }\n}" + } + ], + "step": "there is a valid \"team_hierarchy_link\" in the system", + "key": "team_hierarchy_link", + "tag": "Teams", + "operationId": "AddTeamHierarchyLink" + }, { "source": "data.data[0]", "step": "there is a valid \"team_connection\" in the system", diff --git a/tests/scenarios/features/v2/logs_restriction_queries.feature b/tests/scenarios/features/v2/logs_restriction_queries.feature new file mode 100644 index 00000000000..44d65b92fd5 --- /dev/null +++ b/tests/scenarios/features/v2/logs_restriction_queries.feature @@ -0,0 +1,287 @@ +@endpoint(logs-restriction-queries) @endpoint(logs-restriction-queries-v2) +Feature: Logs Restriction Queries + **Note: This endpoint is in public beta. If you have any feedback, contact + [Datadog support](https://docs.datadoghq.com/help/).** A Restriction + Query is a logs query that restricts which logs the `logs_read_data` + permission grants read access to. For users whose roles have Restriction + Queries, any log query they make only returns those log events that also + match one of their Restriction Queries. This is true whether the user + queries log events from any log-related feature, including the log + explorer, Live Tail, re-hydration, or a dashboard widget. Restriction + Queries currently only support use of the following components of log + events: - Reserved attributes - The log message - Tags To restrict read + access on log data, add a team tag to log events to indicate which teams + own them, and then scope Restriction Queries to the relevant values of the + team tag. Tags can be applied to log events in many ways, and a log event + can have multiple tags with the same key (like team) and different values. + This means the same log event can be visible to roles whose restriction + queries are scoped to different team values. See [How to Set Up RBAC for + Logs](https://docs.datadoghq.com/logs/guide/logs-rbac/?tab=api#restrict- + access-to-logs) for details on how to add restriction queries. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "LogsRestrictionQueries" API + + @skip-go @skip-java @skip-python @skip-ruby @skip-rust @skip-terraform-config @skip-typescript @skip-validation @team:DataDog/logs-app + Scenario: Create a restriction query returns "Bad Request" response + Given operation "CreateRestrictionQuery" enabled + And new "CreateRestrictionQuery" request + And body with value {"test": "bad_request"} + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Create a restriction query returns "OK" response + Given operation "CreateRestrictionQuery" enabled + And new "CreateRestrictionQuery" request + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Delete a restriction query returns "Bad Request" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Delete a restriction query returns "Not found" response + Given operation "DeleteRestrictionQuery" enabled + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-app + Scenario: Delete a restriction query returns "OK" response + Given operation "DeleteRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "DeleteRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 204 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get a restriction query returns "Bad Request" response + Given operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get a restriction query returns "Not found" response + Given operation "GetRestrictionQuery" enabled + And new "GetRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-app + Scenario: Get a restriction query returns "OK" response + Given operation "GetRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "GetRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "Bad Request" response + Given operation "ListUserRestrictionQueries" enabled + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "Not found" response + Given operation "ListUserRestrictionQueries" enabled + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/logs-app + Scenario: Get all restriction queries for a given user returns "OK" response + Given operation "ListUserRestrictionQueries" enabled + And there is a valid "user" in the system + And new "ListUserRestrictionQueries" request + And request contains "user_id" parameter from "user.data.id" + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Get restriction query for a given role returns "Bad Request" response + Given operation "GetRoleRestrictionQuery" enabled + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get restriction query for a given role returns "Not found" response + Given operation "GetRoleRestrictionQuery" enabled + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 400 Bad Request + + @team:DataDog/logs-app + Scenario: Get restriction query for a given role returns "OK" response + Given operation "GetRoleRestrictionQuery" enabled + And there is a valid "role" in the system + And new "GetRoleRestrictionQuery" request + And request contains "role_id" parameter from "role.data.id" + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Grant role to a restriction query returns "Bad Request" response + Given operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 404 Not found + + @skip-terraform-config @team:DataDog/logs-app + Scenario: Grant role to a restriction query returns "Not found" response + Given operation "AddRoleToRestrictionQuery" enabled + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-app + Scenario: Grant role to a restriction query returns "OK" response + Given operation "AddRoleToRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And new "AddRoleToRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"id": "{{ role.data.id }}", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: List restriction queries returns "OK" response + Given operation "ListRestrictionQueries" enabled + And new "ListRestrictionQueries" request + When the request is sent + Then the response status is 200 OK + + @skip-terraform-config @team:DataDog/logs-app + Scenario: List roles for a restriction query returns "Bad Request" response + Given operation "ListRestrictionQueryRoles" enabled + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter with value "malformed_id" + When the request is sent + Then the response status is 400 Bad Request + + @skip-terraform-config @team:DataDog/logs-app + Scenario: List roles for a restriction query returns "Not found" response + Given operation "ListRestrictionQueryRoles" enabled + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + When the request is sent + Then the response status is 404 Not found + + @team:DataDog/logs-app + Scenario: List roles for a restriction query returns "OK" response + Given operation "ListRestrictionQueryRoles" enabled + And there is a valid "restriction_query" in the system + And new "ListRestrictionQueryRoles" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + When the request is sent + Then the response status is 200 OK + + @skip @team:DataDog/logs-app + Scenario: Replace a restriction query returns "Bad Request" response + Given operation "ReplaceRestrictionQuery" enabled + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @team:DataDog/logs-app + Scenario: Replace a restriction query returns "Not found" response + Given operation "ReplaceRestrictionQuery" enabled + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 404 Not found + + @skip @team:DataDog/logs-app + Scenario: Replace a restriction query returns "OK" response + Given operation "ReplaceRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "ReplaceRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"attributes": {"restriction_query": "env:staging"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Revoke role from a restriction query returns "Bad Request" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Revoke role from a restriction query returns "Not found" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"id": "3653d3c6-0c75-11ea-ad28-fb5701eabc7d", "type": "roles"}} + When the request is sent + Then the response status is 404 Not found + + @skip @team:DataDog/logs-app + Scenario: Revoke role from a restriction query returns "OK" response + Given operation "RemoveRoleFromRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And there is a valid "role" in the system + And new "RemoveRoleFromRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"id": "{{ role.data.id }}", "type": "roles"}} + When the request is sent + Then the response status is 204 OK + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Update a restriction query returns "Bad Request" response + Given operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "malformed_id" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 400 Bad Request + + @skip @skip-terraform-config @team:DataDog/logs-app + Scenario: Update a restriction query returns "Not found" response + Given operation "UpdateRestrictionQuery" enabled + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter with value "00000000-0000-0000-0000-000000000000" + And body with value {"data": {"attributes": {"restriction_query": "env:sandbox"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 404 Not found + + @skip @team:DataDog/logs-app + Scenario: Update a restriction query returns "OK" response + Given operation "UpdateRestrictionQuery" enabled + And there is a valid "restriction_query" in the system + And new "UpdateRestrictionQuery" request + And request contains "restriction_query_id" parameter from "restriction_query.data.id" + And body with value {"data": {"attributes": {"restriction_query": "env:production"}, "type": "logs_restriction_queries"}} + When the request is sent + Then the response status is 200 OK diff --git a/tests/scenarios/features/v2/teams.feature b/tests/scenarios/features/v2/teams.feature index bf11bd0316d..faa1ca0889d 100644 --- a/tests/scenarios/features/v2/teams.feature +++ b/tests/scenarios/features/v2/teams.feature @@ -43,6 +43,25 @@ Feature: Teams When the request is sent Then the response status is 200 Represents a user's association to a team + @team:DataDog/aaa-omg + Scenario: Create a team hierarchy link returns "Conflict" response + Given new "AddTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And body with value {"data": {"relationships": {"parent_team": {"data": {"id": "{{team_hierarchy_link.data.relationships.parent_team.data.id}}", "type": "team"}}, "sub_team": {"data": {"id": "{{team_hierarchy_link.data.relationships.sub_team.data.id}}", "type": "team"}}}, "type": "team_hierarchy_links"}} + When the request is sent + Then the response status is 409 Conflict + + @team:DataDog/aaa-omg + Scenario: Create a team hierarchy link returns "OK" response + Given new "AddTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And body with value {"data": {"relationships": {"parent_team": {"data": {"id": "{{dd_team.data.id}}", "type": "team"}}, "sub_team": {"data": {"id": "{{dd_team_2.data.id}}", "type": "team"}}}, "type": "team_hierarchy_links"}} + When the request is sent + Then the response status is 200 OK + @team:DataDog/aaa-omg Scenario: Create a team link returns "API error response." response Given new "CreateTeamLink" request @@ -96,6 +115,28 @@ Feature: Teams And the response "data.attributes.visible_modules" is equal to ["m1","m2"] And the response "data.attributes.hidden_modules" is equal to ["m3"] + @team:DataDog/aaa-omg + Scenario: Get a team hierarchy link returns "API error response." response + Given new "GetTeamHierarchyLink" request + And request contains "link_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Get a team hierarchy link returns "OK" response + Given new "GetTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "link_id" parameter from "team_hierarchy_link.data.id" + When the request is sent + Then the response status is 200 OK + And the response "data.id" is equal to "{{ team_hierarchy_link.data.id }}" + And the response "data.relationships.parent_team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data.relationships.sub_team.data.id" is equal to "{{ dd_team_2.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team_2.data.id }}" + @team:DataDog/aaa-omg Scenario: Get a team link returns "API error response." response Given new "GetTeamLink" request @@ -211,6 +252,31 @@ Feature: Teams When the request is sent Then the response status is 200 OK + @team:DataDog/aaa-omg + Scenario: Get team hierarchy links returns "OK" response + Given new "ListTeamHierarchyLinks" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "filter[parent_team]" parameter from "team_hierarchy_link.data.relationships.parent_team.data.id" + And request contains "filter[sub_team]" parameter from "team_hierarchy_link.data.relationships.sub_team.data.id" + And request contains "page[number]" parameter with value 0 + And request contains "page[size]" parameter with value 100 + When the request is sent + Then the response status is 200 OK + And the response "data" has length 1 + And the response "data[0].id" is equal to "{{ team_hierarchy_link.data.id }}" + And the response "data[0].relationships.parent_team.data.id" is equal to "{{ dd_team.data.id }}" + And the response "data[0].relationships.sub_team.data.id" is equal to "{{ dd_team_2.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team.data.id }}" + And the response "included" has item with field "id" with value "{{ dd_team_2.data.id }}" + + @generated @skip @team:DataDog/aaa-omg @with-pagination + Scenario: Get team hierarchy links returns "OK" response with pagination + Given new "ListTeamHierarchyLinks" request + When the request with pagination is sent + Then the response status is 200 OK + @team:DataDog/aaa-omg Scenario: Get team memberships returns "API error response." response Given new "GetTeamMemberships" request @@ -293,6 +359,23 @@ Feature: Teams When the request is sent Then the response status is 204 No Content + @team:DataDog/aaa-omg + Scenario: Remove a team hierarchy link returns "API error response." response + Given new "RemoveTeamHierarchyLink" request + And request contains "link_id" parameter with value "aaa11111-aa11-aa11-aaaa-aaaaaa111111" + When the request is sent + Then the response status is 404 API error response. + + @team:DataDog/aaa-omg + Scenario: Remove a team hierarchy link returns "No Content" response + Given new "RemoveTeamHierarchyLink" request + And there is a valid "dd_team" in the system + And there is a valid "dd_team_2" in the system + And there is a valid "team_hierarchy_link" in the system + And request contains "link_id" parameter from "team_hierarchy_link.data.id" + When the request is sent + Then the response status is 204 No Content + @team:DataDog/aaa-omg Scenario: Remove a team link returns "API error response." response Given new "DeleteTeamLink" request diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 3799e64e630..7c226bf60d3 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2443,6 +2443,79 @@ "type": "idempotent" } }, + "ListRestrictionQueries": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "CreateRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "operationId": "DeleteRestrictionQuery", + "parameters": [ + { + "name": "restriction_query_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "GetRoleRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "ListUserRestrictionQueries": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "DeleteRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "GetRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "UpdateRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "ReplaceRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "RemoveRoleFromRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "idempotent" + } + }, + "ListRestrictionQueryRoles": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, + "AddRoleToRestrictionQuery": { + "tag": "Logs Restriction Queries", + "undo": { + "type": "safe" + } + }, "ListLogsGet": { "tag": "Logs", "undo": { @@ -4345,6 +4418,37 @@ "type": "unsafe" } }, + "ListTeamHierarchyLinks": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, + "AddTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "operationId": "RemoveTeamHierarchyLink", + "parameters": [ + { + "name": "link_id", + "source": "data.id" + } + ], + "type": "unsafe" + } + }, + "RemoveTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "type": "idempotent" + } + }, + "GetTeamHierarchyLink": { + "tag": "Teams", + "undo": { + "type": "safe" + } + }, "DeleteTeamConnections": { "tag": "Team Connections", "undo": {