-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathstorage_management_api.py
More file actions
98 lines (83 loc) · 3.93 KB
/
storage_management_api.py
File metadata and controls
98 lines (83 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# 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 Any, Dict
from datadog_api_client.api_client import ApiClient, Endpoint as _Endpoint
from datadog_api_client.configuration import Configuration
from datadog_api_client.v2.model.cloud_inventory_sync_config_response import CloudInventorySyncConfigResponse
from datadog_api_client.v2.model.upsert_cloud_inventory_sync_config_request import UpsertCloudInventorySyncConfigRequest
class StorageManagementApi:
"""
Enable Storage Management for S3 buckets, GCS buckets, and Azure containers. Each configuration registers the destination that holds inventory reports for the storage being monitored.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient(Configuration())
self.api_client = api_client
self._delete_sync_config_endpoint = _Endpoint(
settings={
"response_type": None,
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/cloudinventoryservice/syncconfigs/{id}",
"operation_id": "delete_sync_config",
"http_method": "DELETE",
"version": "v2",
},
params_map={
"id": {
"required": True,
"openapi_types": (str,),
"attribute": "id",
"location": "path",
},
},
headers_map={
"accept": ["*/*"],
},
api_client=api_client,
)
self._upsert_sync_config_endpoint = _Endpoint(
settings={
"response_type": (CloudInventorySyncConfigResponse,),
"auth": ["apiKeyAuth", "appKeyAuth"],
"endpoint_path": "/api/v2/cloudinventoryservice/syncconfigs",
"operation_id": "upsert_sync_config",
"http_method": "PUT",
"version": "v2",
},
params_map={
"body": {
"required": True,
"openapi_types": (UpsertCloudInventorySyncConfigRequest,),
"location": "body",
},
},
headers_map={"accept": ["application/json"], "content_type": ["application/json"]},
api_client=api_client,
)
def delete_sync_config(
self,
id: str,
) -> None:
"""Delete a Storage Management configuration.
Delete a Storage Management configuration by its unique identifier. Deleting a configuration stops inventory file synchronization for the associated cloud account.
:param id: Unique identifier of the Storage Management configuration.
:type id: str
:rtype: None
"""
kwargs: Dict[str, Any] = {}
kwargs["id"] = id
return self._delete_sync_config_endpoint.call_with_http_info(**kwargs)
def upsert_sync_config(
self,
body: UpsertCloudInventorySyncConfigRequest,
) -> CloudInventorySyncConfigResponse:
"""Enable Storage Management for a bucket.
Enable Storage Management for an S3 bucket, GCS bucket, or Azure container by registering the destination that holds its inventory reports. Set ``data.id`` to the cloud provider ( ``aws`` , ``gcp`` , or ``azure`` ) and provide the matching settings under data.attributes. Calling this endpoint with the same provider replaces the existing configuration.
:type body: UpsertCloudInventorySyncConfigRequest
:rtype: CloudInventorySyncConfigResponse
"""
kwargs: Dict[str, Any] = {}
kwargs["body"] = body
return self._upsert_sync_config_endpoint.call_with_http_info(**kwargs)