Skip to content

Commit

Permalink
Regenerate client from commit 5031c4b4 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jul 30, 2024
1 parent f33e892 commit af56071
Show file tree
Hide file tree
Showing 15 changed files with 496 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:58:47.789565",
"spec_repo_commit": "2c4b4e85"
"regenerated": "2024-07-30 15:00:26.470254",
"spec_repo_commit": "5031c4b4"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-07-26 19:58:47.806497",
"spec_repo_commit": "2c4b4e85"
"regenerated": "2024-07-30 15:00:26.487215",
"spec_repo_commit": "5031c4b4"
}
}
}
75 changes: 72 additions & 3 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ components:
schema:
type: string
RuleId:
description: The ID of the rule/scorecard.
description: The ID of the rule.
in: path
name: rule_id
required: true
Expand Down Expand Up @@ -16532,7 +16532,7 @@ components:
properties:
id:
description: The unique ID for a scorecard.
example: 00000000-0000-beef-0000-000000000000
example: q8MQxk8TCqrHnWkp
type: string
type:
$ref: '#/components/schemas/ScorecardType'
Expand Down Expand Up @@ -17377,7 +17377,7 @@ components:
type: object
RuleId:
description: The unique ID for a scorecard rule.
example: 00000000-0000-beef-0000-000000000000
example: q8MQxk8TCqrHnWkx
type: string
RuleOutcomeRelationships:
description: The JSON:API relationship to a scorecard rule.
Expand Down Expand Up @@ -23214,6 +23214,38 @@ components:
id:
$ref: '#/components/schemas/ApiID'
type: object
UpdateRuleRequest:
description: Scorecard update rule request.
properties:
data:
$ref: '#/components/schemas/UpdateRuleRequestData'
type: object
UpdateRuleRequestData:
description: Scorecard update rule request data.
properties:
attributes:
$ref: '#/components/schemas/RuleAttributes'
type:
$ref: '#/components/schemas/RuleType'
type: object
UpdateRuleResponse:
description: Updated rule in response.
properties:
data:
$ref: '#/components/schemas/UpdateRuleResponseData'
type: object
UpdateRuleResponseData:
description: Update rule response data.
properties:
attributes:
$ref: '#/components/schemas/RuleAttributes'
id:
$ref: '#/components/schemas/RuleId'
relationships:
$ref: '#/components/schemas/RelationshipToRule'
type:
$ref: '#/components/schemas/RuleType'
type: object
UsageApplicationSecurityMonitoringResponse:
description: Application Security Monitoring usage response.
properties:
Expand Down Expand Up @@ -33554,6 +33586,43 @@ paths:
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
put:
description: Updates an existing rule.
operationId: UpdateScorecardRule
parameters:
- $ref: '#/components/parameters/RuleId'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRuleRequest'
description: Rule attributes.
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/UpdateRuleResponse'
description: Rule updated successfully
'400':
$ref: '#/components/responses/BadRequestResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- apm_service_catalog_write
summary: Update an existing rule
tags:
- Service Scorecards
x-codegen-request-body-name: body
x-unstable: '**Note**: This endpoint is in public beta.

If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help/).'
/api/v2/security/cloud_workload/policy/download:
get:
description: 'The download endpoint generates a Cloud Workload Security policy
Expand Down
28 changes: 28 additions & 0 deletions docs/datadog_api_client.v2.model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10371,6 +10371,34 @@ datadog\_api\_client.v2.model.update\_open\_api\_response\_data module
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_rule\_request module
----------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_rule_request
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_rule\_request\_data module
----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_rule_request_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_rule\_response module
-----------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_rule_response
:members:
:show-inheritance:

datadog\_api\_client.v2.model.update\_rule\_response\_data module
-----------------------------------------------------------------

.. automodule:: datadog_api_client.v2.model.update_rule_response_data
:members:
:show-inheritance:

datadog\_api\_client.v2.model.usage\_application\_security\_monitoring\_response module
---------------------------------------------------------------------------------------

Expand Down
34 changes: 34 additions & 0 deletions examples/v2/service-scorecards/UpdateScorecardRule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""
Update an existing rule returns "Rule updated successfully" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.service_scorecards_api import ServiceScorecardsApi
from datadog_api_client.v2.model.rule_attributes import RuleAttributes
from datadog_api_client.v2.model.update_rule_request import UpdateRuleRequest
from datadog_api_client.v2.model.update_rule_request_data import UpdateRuleRequestData

# there is a valid "create_scorecard_rule" in the system
CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME = environ["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME"]
CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME = environ["CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME"]
CREATE_SCORECARD_RULE_DATA_ID = environ["CREATE_SCORECARD_RULE_DATA_ID"]

body = UpdateRuleRequest(
data=UpdateRuleRequestData(
attributes=RuleAttributes(
enabled=True,
name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_NAME,
scorecard_name=CREATE_SCORECARD_RULE_DATA_ATTRIBUTES_SCORECARD_NAME,
description="Updated description via test",
),
),
)

configuration = Configuration()
configuration.unstable_operations["update_scorecard_rule"] = True
with ApiClient(configuration) as api_client:
api_instance = ServiceScorecardsApi(api_client)
response = api_instance.update_scorecard_rule(rule_id=CREATE_SCORECARD_RULE_DATA_ID, body=body)

print(response)
1 change: 1 addition & 0 deletions src/datadog_api_client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ def __init__(
"v2.delete_scorecard_rule": False,
"v2.list_scorecard_outcomes": False,
"v2.list_scorecard_rules": False,
"v2.update_scorecard_rule": False,
"v2.create_incident_service": False,
"v2.delete_incident_service": False,
"v2.get_incident_service": False,
Expand Down
52 changes: 51 additions & 1 deletion src/datadog_api_client/v2/api/service_scorecards_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
from datadog_api_client.v2.model.list_rules_response_data_item import ListRulesResponseDataItem
from datadog_api_client.v2.model.create_rule_response import CreateRuleResponse
from datadog_api_client.v2.model.create_rule_request import CreateRuleRequest
from datadog_api_client.v2.model.update_rule_response import UpdateRuleResponse
from datadog_api_client.v2.model.update_rule_request import UpdateRuleRequest


class ServiceScorecardsApi:
Expand Down Expand Up @@ -233,6 +235,32 @@ def __init__(self, api_client=None):
api_client=api_client,
)

self._update_scorecard_rule_endpoint = _Endpoint(
settings={
"response_type": (UpdateRuleResponse,),
"auth": ["apiKeyAuth", "appKeyAuth", "AuthZ"],
"endpoint_path": "/api/v2/scorecard/rules/{rule_id}",
"operation_id": "update_scorecard_rule",
"http_method": "PUT",
"version": "v2",
},
params_map={
"rule_id": {
"required": True,
"openapi_types": (str,),
"attribute": "rule_id",
"location": "path",
},
"body": {
"required": True,
"openapi_types": (UpdateRuleRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)

def create_scorecard_outcomes_batch(
self,
body: OutcomesBatchRequest,
Expand Down Expand Up @@ -275,7 +303,7 @@ def delete_scorecard_rule(
Deletes a single rule.
:param rule_id: The ID of the rule/scorecard.
:param rule_id: The ID of the rule.
:type rule_id: str
:rtype: None
"""
Expand Down Expand Up @@ -599,3 +627,25 @@ def list_scorecard_rules_with_pagination(
"kwargs": kwargs,
}
return endpoint.call_with_http_info_paginated(pagination)

def update_scorecard_rule(
self,
rule_id: str,
body: UpdateRuleRequest,
) -> UpdateRuleResponse:
"""Update an existing rule.
Updates an existing rule.
:param rule_id: The ID of the rule.
:type rule_id: str
:param body: Rule attributes.
:type body: UpdateRuleRequest
:rtype: UpdateRuleResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["rule_id"] = rule_id

kwargs["body"] = body

return self._update_scorecard_rule_endpoint.call_with_http_info(**kwargs)
42 changes: 42 additions & 0 deletions src/datadog_api_client/v2/model/update_rule_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# 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.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.update_rule_request_data import UpdateRuleRequestData


class UpdateRuleRequest(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.update_rule_request_data import UpdateRuleRequestData

return {
"data": (UpdateRuleRequestData,),
}

attribute_map = {
"data": "data",
}

def __init__(self_, data: Union[UpdateRuleRequestData, UnsetType] = unset, **kwargs):
"""
Scorecard update rule request.
:param data: Scorecard update rule request data.
:type data: UpdateRuleRequestData, optional
"""
if data is not unset:
kwargs["data"] = data
super().__init__(kwargs)
53 changes: 53 additions & 0 deletions src/datadog_api_client/v2/model/update_rule_request_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# 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.
from __future__ import annotations

from typing import Union, TYPE_CHECKING

from datadog_api_client.model_utils import (
ModelNormal,
cached_property,
unset,
UnsetType,
)


if TYPE_CHECKING:
from datadog_api_client.v2.model.rule_attributes import RuleAttributes
from datadog_api_client.v2.model.rule_type import RuleType


class UpdateRuleRequestData(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.rule_attributes import RuleAttributes
from datadog_api_client.v2.model.rule_type import RuleType

return {
"attributes": (RuleAttributes,),
"type": (RuleType,),
}

attribute_map = {
"attributes": "attributes",
"type": "type",
}

def __init__(
self_, attributes: Union[RuleAttributes, UnsetType] = unset, type: Union[RuleType, UnsetType] = unset, **kwargs
):
"""
Scorecard update rule request data.
:param attributes: Details of a rule.
:type attributes: RuleAttributes, optional
:param type: The JSON:API type for scorecard rules.
:type type: RuleType, optional
"""
if attributes is not unset:
kwargs["attributes"] = attributes
if type is not unset:
kwargs["type"] = type
super().__init__(kwargs)
Loading

0 comments on commit af56071

Please sign in to comment.