|
| 1 | +""" |
| 2 | +Create degradation template returns "Created" response |
| 3 | +""" |
| 4 | + |
| 5 | +from datadog_api_client import ApiClient, Configuration |
| 6 | +from datadog_api_client.v2.api.status_pages_api import StatusPagesApi |
| 7 | +from datadog_api_client.v2.model.create_degradation_request_data_attributes_status import ( |
| 8 | + CreateDegradationRequestDataAttributesStatus, |
| 9 | +) |
| 10 | +from datadog_api_client.v2.model.create_degradation_template_request import CreateDegradationTemplateRequest |
| 11 | +from datadog_api_client.v2.model.create_degradation_template_request_data import CreateDegradationTemplateRequestData |
| 12 | +from datadog_api_client.v2.model.create_degradation_template_request_data_attributes import ( |
| 13 | + CreateDegradationTemplateRequestDataAttributes, |
| 14 | +) |
| 15 | +from datadog_api_client.v2.model.create_degradation_template_request_data_attributes_components_affected_items import ( |
| 16 | + CreateDegradationTemplateRequestDataAttributesComponentsAffectedItems, |
| 17 | +) |
| 18 | +from datadog_api_client.v2.model.create_degradation_template_request_data_attributes_updates_items import ( |
| 19 | + CreateDegradationTemplateRequestDataAttributesUpdatesItems, |
| 20 | +) |
| 21 | +from datadog_api_client.v2.model.patch_degradation_template_request_data_attributes_components_affected_items_status import ( |
| 22 | + PatchDegradationTemplateRequestDataAttributesComponentsAffectedItemsStatus, |
| 23 | +) |
| 24 | +from datadog_api_client.v2.model.patch_degradation_template_request_data_type import ( |
| 25 | + PatchDegradationTemplateRequestDataType, |
| 26 | +) |
| 27 | +from uuid import UUID |
| 28 | + |
| 29 | +body = CreateDegradationTemplateRequest( |
| 30 | + data=CreateDegradationTemplateRequestData( |
| 31 | + attributes=CreateDegradationTemplateRequestDataAttributes( |
| 32 | + components_affected=[ |
| 33 | + CreateDegradationTemplateRequestDataAttributesComponentsAffectedItems( |
| 34 | + id="", |
| 35 | + status=PatchDegradationTemplateRequestDataAttributesComponentsAffectedItemsStatus.OPERATIONAL, |
| 36 | + ), |
| 37 | + ], |
| 38 | + name="", |
| 39 | + updates=[ |
| 40 | + CreateDegradationTemplateRequestDataAttributesUpdatesItems( |
| 41 | + status=CreateDegradationRequestDataAttributesStatus.INVESTIGATING, |
| 42 | + ), |
| 43 | + ], |
| 44 | + ), |
| 45 | + type=PatchDegradationTemplateRequestDataType.DEGRADATION_TEMPLATES, |
| 46 | + ), |
| 47 | +) |
| 48 | + |
| 49 | +configuration = Configuration() |
| 50 | +with ApiClient(configuration) as api_client: |
| 51 | + api_instance = StatusPagesApi(api_client) |
| 52 | + response = api_instance.create_degradation_template(page_id=UUID("9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"), body=body) |
| 53 | + |
| 54 | + print(response) |
0 commit comments