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

Add support for restricted_roles connection in synthetics private location #209

Merged
merged 1 commit into from
Feb 2, 2024
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
4 changes: 2 additions & 2 deletions datadog_sync/model/synthetics_private_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
class SyntheticsPrivateLocations(BaseResource):
resource_type = "synthetics_private_locations"
resource_config = ResourceConfig(
resource_connections={"roles": ["metadata.restricted_roles"]},
base_path="/api/v1/synthetics/private-locations",
excluded_attributes=[
"id",
"modifiedAt",
"createdAt",
"createdBy",
"metadata",
"secrets",
"config",
"result_encryption",
Expand Down Expand Up @@ -77,4 +77,4 @@ def delete_resource(self, _id: str) -> None:
)

def connect_id(self, key: str, r_obj: Dict, resource_to_connect: str) -> Optional[List[str]]:
pass
return super(SyntheticsPrivateLocations, self).connect_id(key, r_obj, resource_to_connect)
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-19T16:54:00.563669+00:00
2024-02-01T22:13:59.700313-05:00
2,086 changes: 932 additions & 1,154 deletions tests/integration/cassettes/test_cli/TestCli.test_cleanup.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-19T16:53:18.864872+00:00
2024-02-01T22:13:31.938509-05:00
1,284 changes: 571 additions & 713 deletions tests/integration/cassettes/test_cli/TestCli.test_import.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-12-19T16:53:22.126282+00:00
2024-02-01T22:13:35.096336-05:00
4,717 changes: 3,460 additions & 1,257 deletions tests/integration/cassettes/test_cli/TestCli.test_sync.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-04T16:32:02.691349-05:00
2024-02-01T22:13:09.320008-05:00
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-04T16:32:02.710794-05:00
2024-02-01T22:13:09.328281-05:00
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interactions:
Content-Type:
- application/json
method: DELETE
uri: https://api.datadoghq.eu/api/v1/synthetics/private-locations/pl:test-private-variable-73eed01c79c1fca3cd51c2423cb66c70
uri: https://api.datadoghq.eu/api/v1/synthetics/private-locations/pl:custom-location-e09a2f45e85c67a66f2a30b1e0370927
response:
body:
string: ''
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-04T16:32:00.408348-05:00
2024-02-01T22:13:06.810771-05:00
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@ interactions:
string: '{"locations": [{"id": "aws:af-south-1", "name": "Cape Town (AWS)"},
{"id": "aws:ap-east-1", "name": "Hong Kong (AWS)"}, {"id": "aws:ap-northeast-1",
"name": "Tokyo (AWS)"}, {"id": "aws:ap-northeast-2", "name": "Seoul (AWS)"},
{"id": "aws:ap-south-1", "name": "Mumbai (AWS)"}, {"id": "aws:ap-southeast-1",
"name": "Singapore (AWS)"}, {"id": "aws:ap-southeast-2", "name": "Sydney (AWS)"},
{"id": "aws:ca-central-1", "name": "Canada Central (AWS)"}, {"id": "aws:eu-central-1",
"name": "Frankfurt (AWS)"}, {"id": "aws:eu-north-1", "name": "Stockholm (AWS)"},
{"id": "aws:ap-northeast-3", "name": "Osaka (AWS)"}, {"id": "aws:ap-south-1",
"name": "Mumbai (AWS)"}, {"id": "aws:ap-southeast-1", "name": "Singapore (AWS)"},
{"id": "aws:ap-southeast-2", "name": "Sydney (AWS)"}, {"id": "aws:ap-southeast-3",
"name": "Jakarta (AWS)"}, {"id": "aws:ca-central-1", "name": "Canada Central
(AWS)"}, {"id": "aws:eu-central-1", "name": "Frankfurt (AWS)"}, {"id": "aws:eu-north-1",
"name": "Stockholm (AWS)"}, {"id": "aws:eu-south-1", "name": "Milan (AWS)"},
{"id": "aws:eu-west-1", "name": "Ireland (AWS)"}, {"id": "aws:eu-west-2",
"name": "London (AWS)"}, {"id": "aws:eu-west-3", "name": "Paris (AWS)"}, {"id":
"aws:sa-east-1", "name": "S\u00e3o Paulo (AWS)"}, {"id": "aws:us-east-1",
"name": "N. Virginia (AWS)"}, {"id": "aws:us-east-2", "name": "Ohio (AWS)"},
{"id": "aws:us-west-1", "name": "N. California (AWS)"}, {"id": "aws:us-west-2",
"name": "Oregon (AWS)"}, {"id": "azure:eastus", "name": "Virginia (Azure)"},
{"id": "pl:test-private-variable-b66e383ccf2ec6911eb962a9c2577451", "name":
"Test Private Variable"}]}'
"aws:me-south-1", "name": "Bahrain (AWS)"}, {"id": "aws:sa-east-1", "name":
"S\u00e3o Paulo (AWS)"}, {"id": "aws:us-east-1", "name": "N. Virginia (AWS)"},
{"id": "aws:us-east-2", "name": "Ohio (AWS)"}, {"id": "aws:us-west-1", "name":
"N. California (AWS)"}, {"id": "aws:us-west-2", "name": "Oregon (AWS)"}, {"id":
"azure:eastus", "name": "Virginia (Azure)"}, {"id": "pl:custom-location-0bf64e97eec8416e292447a0a902f5c6",
"name": "Custom Location"}, {"id": "pl:custom-location-with-restricted-roles-946ecd8f86d8de1b74926a3c18e3e7fe",
"name": "Custom location with restricted roles"}]}'
headers:
Content-Type:
- application/json
Expand All @@ -43,13 +46,37 @@ interactions:
Content-Type:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v1/synthetics/private-locations/pl:test-private-variable-b66e383ccf2ec6911eb962a9c2577451
uri: https://api.datadoghq.com/api/v1/synthetics/private-locations/pl:custom-location-0bf64e97eec8416e292447a0a902f5c6
response:
body:
string: '{"name": "Test Private Variable", "tags": ["key:value"], "description":
"datadog-sync-cli test", "modifiedAt": "2021-06-30T12:27:21.433291+00:00",
"createdBy": "noueman.khalikine@datadoghq.com", "id": "pl:test-private-variable-b66e383ccf2ec6911eb962a9c2577451",
"createdAt": "2021-06-30T12:27:21.433291+00:00", "metadata": null}'
string: '{"createdAt": "2024-02-01T21:13:10.694645+00:00", "modifiedAt": "2024-02-01T21:13:10.694645+00:00",
"description": "Random location for test", "tags": ["test:foo"], "name": "Custom
Location", "metadata": {"restricted_roles": []}, "id": "pl:custom-location-0bf64e97eec8416e292447a0a902f5c6",
"createdBy": "sherzod.karimov@datadoghq.com"}'
headers:
Content-Type:
- application/json
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate
Content-Type:
- application/json
method: GET
uri: https://api.datadoghq.com/api/v1/synthetics/private-locations/pl:custom-location-with-restricted-roles-946ecd8f86d8de1b74926a3c18e3e7fe
response:
body:
string: '{"createdAt": "2024-02-01T21:45:46.664961+00:00", "modifiedAt": "2024-02-01T21:46:11.374936+00:00",
"description": "", "tags": [], "name": "Custom location with restricted roles",
"metadata": {"restricted_roles": ["fa017a35-bfcb-11eb-a4d7-da7ad0900002"]},
"id": "pl:custom-location-with-restricted-roles-946ecd8f86d8de1b74926a3c18e3e7fe",
"createdBy": "sherzod.karimov@datadoghq.com"}'
headers:
Content-Type:
- application/json
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-04T16:32:00.781821-05:00
2024-02-01T22:13:07.232950-05:00
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"name": "Test Private Variable", "tags": ["key:value"], "description":
"datadog-sync-cli test"}'
body: '{"description": "Random location for test", "tags": ["test:foo"], "name":
"Custom Location", "metadata": {"restricted_roles": []}}'
headers:
Accept:
- '*/*'
Expand All @@ -13,12 +13,13 @@ interactions:
uri: https://api.datadoghq.eu/api/v1/synthetics/private-locations
response:
body:
string: '{"private_location": {"name": "Test Private Variable", "tags": ["key:value"],
"modifiedAt": "2023-01-04T21:32:02.185319+00:00", "createdBy": "sherzod.karimov@datadoghq.com",
"metadata": null, "config": {"site": "datadoghq.eu"}, "id": "pl:test-private-variable-73eed01c79c1fca3cd51c2423cb66c70",
"createdAt": "2023-01-04T21:32:02.185319+00:00", "description": "datadog-sync-cli
test"}, "result_encryption": {"id": "sha256$base64$HCje9BSaPgSwhmA3TL6kYknOgjCW72k8ilCn4PAuins=",
"key": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyhjTDKqgNuqzlTKKEztw\nqQmfi3Vz/BCmaSRmwZenLP/a/GYG2pKR27hHv5fQB3v08W/BC1VA2XmuCR+EJiYo\nMWfjvLw65sv+S52Vsx4z0EuP5k1qmRyeRDPPENBxAypfLMbt1F6rTxI42ionaHSJ\nBWC8emJYOjAex5shz2I/aj3P3oht8ePr5Jj6A2jkewhBUvfcXQopAy21KhAtEEQB\n7NfG/JWSo9TEqEA4QxGEEqo4rHSHgRQVxtXINzDSp/M5136wVsLsTRF0bSLXSdrf\nRCZje4OdR5Ij9HdhB4F+2KW22Fm3vJlvPCG1C2ZtEDz3xzv9+hcz/rV7WrBMua3j\nZTei5EMTSOt0hIL/DmdId4LmWTc2fYWxe2nYUuAgPw+o+jaju5E5htFbd4JRqyEu\nmMJra8f0BWH80mEDiB1DqfsbVFNYmjG5pVJR7OEV4GRNw9CmwRhcwaXpjouYFrsy\nKvRRdAhLigC+FUDtsLZkgM4T6g4VOjgUTMuRAYgouyyjniuRTn4sKE/t0zfP6/0t\nS/izsjItIat+0RzkO7BY22ga9h1/orqFwgCtwX+WYDHSzo2oMku1tup16WP3Y2jj\n2MJGpHPhDkBoCKRXq34xGxHGoing0zCqmjk1h5WTZdVrppTjJo5sxK0ZGlOXdsk2\nGgiZrQVfZjtotyWUyJnC758CAwEAAQ==\n-----END
string: '{"private_location": {"createdAt": "2024-02-01T22:13:08.151112+00:00",
"modifiedAt": "2024-02-01T22:13:08.151112+00:00", "description": "Random location
for test", "tags": ["test:foo"], "name": "Custom Location", "metadata": {"restricted_roles":
[]}, "id": "pl:custom-location-e09a2f45e85c67a66f2a30b1e0370927", "createdBy":
"frog@datadoghq.com", "config": {"site": "datadoghq.eu"}}, "result_encryption":
{"id": "sha256$base64$HCje9BSaPgSwhmA3TL6kYknOgjCW72k8ilCn4PAuins=", "key":
"-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAyhjTDKqgNuqzlTKKEztw\nqQmfi3Vz/BCmaSRmwZenLP/a/GYG2pKR27hHv5fQB3v08W/BC1VA2XmuCR+EJiYo\nMWfjvLw65sv+S52Vsx4z0EuP5k1qmRyeRDPPENBxAypfLMbt1F6rTxI42ionaHSJ\nBWC8emJYOjAex5shz2I/aj3P3oht8ePr5Jj6A2jkewhBUvfcXQopAy21KhAtEEQB\n7NfG/JWSo9TEqEA4QxGEEqo4rHSHgRQVxtXINzDSp/M5136wVsLsTRF0bSLXSdrf\nRCZje4OdR5Ij9HdhB4F+2KW22Fm3vJlvPCG1C2ZtEDz3xzv9+hcz/rV7WrBMua3j\nZTei5EMTSOt0hIL/DmdId4LmWTc2fYWxe2nYUuAgPw+o+jaju5E5htFbd4JRqyEu\nmMJra8f0BWH80mEDiB1DqfsbVFNYmjG5pVJR7OEV4GRNw9CmwRhcwaXpjouYFrsy\nKvRRdAhLigC+FUDtsLZkgM4T6g4VOjgUTMuRAYgouyyjniuRTn4sKE/t0zfP6/0t\nS/izsjItIat+0RzkO7BY22ga9h1/orqFwgCtwX+WYDHSzo2oMku1tup16WP3Y2jj\n2MJGpHPhDkBoCKRXq34xGxHGoing0zCqmjk1h5WTZdVrppTjJo5sxK0ZGlOXdsk2\nGgiZrQVfZjtotyWUyJnC758CAwEAAQ==\n-----END
PUBLIC KEY-----\n"}}'
headers: {}
status:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-01-04T16:32:02.376237-05:00
2024-02-01T22:13:08.833268-05:00
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
interactions:
- request:
body: '{"name": "Test Private Variableupdated", "tags": ["key:value"], "description":
"datadog-sync-cli test"}'
body: '{"description": "Random location for test", "tags": ["test:foo"], "name":
"Custom Locationupdated", "metadata": {"restricted_roles": []}}'
headers:
Accept:
- '*/*'
Expand All @@ -10,14 +10,13 @@ interactions:
Content-Type:
- application/json
method: PUT
uri: https://api.datadoghq.eu/api/v1/synthetics/private-locations/pl:test-private-variable-73eed01c79c1fca3cd51c2423cb66c70
uri: https://api.datadoghq.eu/api/v1/synthetics/private-locations/pl:custom-location-e09a2f45e85c67a66f2a30b1e0370927
response:
body:
string: '{"name": "Test Private Variableupdated", "tags": ["key:value"], "modifiedAt":
"2023-01-04T21:32:02.607142+00:00", "createdBy": "sherzod.karimov@datadoghq.com",
"metadata": null, "id": "pl:test-private-variable-73eed01c79c1fca3cd51c2423cb66c70",
"createdAt": "2023-01-04T21:32:02.185319+00:00", "description": "datadog-sync-cli
test"}'
string: '{"createdAt": "2024-02-01T22:13:08.151112+00:00", "modifiedAt": "2024-02-01T22:13:09.264036+00:00",
"description": "Random location for test", "tags": ["test:foo"], "name": "Custom
Locationupdated", "metadata": {"restricted_roles": []}, "id": "pl:custom-location-e09a2f45e85c67a66f2a30b1e0370927",
"createdBy": "frog@datadoghq.com"}'
headers: {}
status:
code: 200
Expand Down
Loading