-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[metricsadvisor] support key rotation for MetricsAdvisorKeyCredential (…
…#16276) * allow rotation of the api/sub keys for MetricsAdvisorKeyCredential * fix tests * fix tests * update changelog
- Loading branch information
1 parent
9043478
commit 95b40c2
Showing
6 changed files
with
471 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
112 changes: 112 additions & 0 deletions
112
...-metricsadvisor/tests/recordings/test_credential.test_credential_rotate_api_key_only.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- ff207a4a-c67b-4009-b4de-3f32d0e144ed | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:44 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '202' | ||
x-request-id: | ||
- ff207a4a-c67b-4009-b4de-3f32d0e144ed | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"code":"Unauthorized","message":"Access denied due to invalid API | ||
key or wrong API endpoint. Make sure to provide a valid key and use a correct | ||
regional API endpoint."}' | ||
headers: | ||
apim-request-id: | ||
- 722f2e0a-c248-4a9b-8e14-0575b51d0010 | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:44 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
transfer-encoding: | ||
- chunked | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '86' | ||
status: | ||
code: 400 | ||
message: Bad Request | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- 2107621b-7bb9-403a-b461-a199eb738921 | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:45 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '230' | ||
x-request-id: | ||
- 2107621b-7bb9-403a-b461-a199eb738921 | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
102 changes: 102 additions & 0 deletions
102
...-ai-metricsadvisor/tests/recordings/test_credential.test_credential_rotate_both_keys.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- bd25f508-276f-4a03-9c4f-9c01ca86cb09 | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:45 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '105' | ||
x-request-id: | ||
- bd25f508-276f-4a03-9c4f-9c01ca86cb09 | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"error":{"code":"401","message":"Access denied due to invalid subscription | ||
key or wrong API endpoint. Make sure to provide a valid key for an active | ||
subscription and use a correct regional API endpoint for your resource."}}' | ||
headers: | ||
content-length: | ||
- '224' | ||
date: | ||
- Thu, 21 Jan 2021 00:19:45 GMT | ||
status: | ||
code: 401 | ||
message: PermissionDenied | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- 0e520a36-d235-4784-b83c-c7fc43a1a47c | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:46 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '106' | ||
x-request-id: | ||
- 0e520a36-d235-4784-b83c-c7fc43a1a47c | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
102 changes: 102 additions & 0 deletions
102
...-metricsadvisor/tests/recordings/test_credential.test_credential_rotate_sub_key_only.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- 1b8c4f41-01bc-49dc-a6fb-a52a9d5b5e38 | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:46 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '100' | ||
x-request-id: | ||
- 1b8c4f41-01bc-49dc-a6fb-a52a9d5b5e38 | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"error":{"code":"401","message":"Access denied due to invalid subscription | ||
key or wrong API endpoint. Make sure to provide a valid key for an active | ||
subscription and use a correct regional API endpoint for your resource."}}' | ||
headers: | ||
content-length: | ||
- '224' | ||
date: | ||
- Thu, 21 Jan 2021 00:19:46 GMT | ||
status: | ||
code: 401 | ||
message: PermissionDenied | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-ai-metricsadvisor/1.0.0b3 Python/3.9.0 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://js-metrics-advisor.cognitiveservices.azure.com/metricsadvisor/v1.0/feedback/metric/feedback_id | ||
response: | ||
body: | ||
string: '{"feedbackId":"feedback_id","createdTime":"2020-10-21T20:53:05.91Z","userPrincipal":"[email protected]","metricId":"metric_id","dimensionFilter":{"dimension":{"dimension_name":"Mumbai","category":"Shoes | ||
Handbags & Sunglasses"}},"feedbackType":"Anomaly","startTime":"2020-10-01T00:00:00Z","endTime":"2020-10-01T00:00:00Z","value":{"anomalyValue":"NotAnomaly"},"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","anomalyDetectionConfigurationSnapshot":{"anomalyDetectionConfigurationId":"e17f32d4-3ddf-4dc7-84ee-b4130c7e1777","name":"detection-config","description":"","metricId":"metric_id","wholeMetricConfiguration":{"smartDetectionCondition":{"sensitivity":100.0,"anomalyDetectorDirection":"Both","suppressCondition":{"minNumber":1,"minRatio":100.0}}},"dimensionGroupOverrideConfigurations":[],"seriesOverrideConfigurations":[]}}' | ||
headers: | ||
apim-request-id: | ||
- 5bbd22d2-10b9-4d29-ac53-47bb62ff2588 | ||
content-length: | ||
- '927' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Thu, 21 Jan 2021 00:19:46 GMT | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains; preload | ||
x-content-type-options: | ||
- nosniff | ||
x-envoy-upstream-service-time: | ||
- '116' | ||
x-request-id: | ||
- 5bbd22d2-10b9-4d29-ac53-47bb62ff2588 | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
Oops, something went wrong.