Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump synthetics private location config data on create #164

Merged
merged 3 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions datadog_sync/model/synthetics_private_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ class SyntheticsPrivateLocations(BaseResource):
resource_type = "synthetics_private_locations"
resource_config = ResourceConfig(
base_path="/api/v1/synthetics/private-locations",
excluded_attributes=["id", "modifiedAt", "createdAt", "createdBy", "metadata", "secrets", "config"],
excluded_attributes=[
"id",
"modifiedAt",
"createdAt",
"createdBy",
"metadata",
"secrets",
"config",
"result_encryption",
],
)
# Additional SyntheticsPrivateLocations specific attributes
base_locations_path: str = "/api/v1/synthetics/locations"
Expand All @@ -45,9 +54,12 @@ def pre_apply_hook(self) -> None:

def create_resource(self, _id: str, resource: Dict) -> None:
destination_client = self.config.destination_client
resp = destination_client.post(self.resource_config.base_path, resource).json()["private_location"]

self.resource_config.destination_resources[_id] = resp
resp = destination_client.post(self.resource_config.base_path, resource).json()

self.resource_config.destination_resources[_id] = resp["private_location"]
self.resource_config.destination_resources[_id]["config"] = resp.get("config")
self.resource_config.destination_resources[_id]["result_encryption"] = resp.get("result_encryption")

def update_resource(self, _id: str, resource: Dict) -> None:
destination_client = self.config.destination_client
Expand Down
1 change: 1 addition & 0 deletions datadog_sync/utils/custom_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def remaining_func(idx, resp, page_size, page_number):
def page_number_func(idx, page_size, page_number):
return page_number + 1


@dataclass
class PaginationConfig(object):
page_size: Optional[int] = 100
Expand Down
Loading