-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,573 additions
and
0 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
36 changes: 36 additions & 0 deletions
36
sdk/keyvault/azure-keyvault-administration/tests/blob_container_preparer.py
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,36 @@ | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
from datetime import datetime, timedelta | ||
|
||
from azure.storage.blob import BlobServiceClient, generate_account_sas, ResourceTypes, AccountSasPermissions | ||
from devtools_testutils import AzureMgmtPreparer | ||
|
||
|
||
class BlobContainerPreparer(AzureMgmtPreparer): | ||
def __init__(self, **kwargs): | ||
super(BlobContainerPreparer, self).__init__("container", 24, random_name_enabled=True, **kwargs) | ||
|
||
def create_resource(self, name, **kwargs): | ||
if self.is_live: | ||
storage_account = kwargs.pop("storage_account") | ||
storage_account_key = kwargs.pop("storage_account_key") | ||
sas_token = generate_account_sas( | ||
account_name=storage_account.name, | ||
account_key=storage_account_key, | ||
resource_types=ResourceTypes(container=True, object=True), | ||
permission=AccountSasPermissions( | ||
create=True, list=True, write=True, read=True, add=True, delete=True, delete_previous_version=True | ||
), | ||
expiry=datetime.utcnow() + timedelta(minutes=5), | ||
) | ||
blob_client = BlobServiceClient(storage_account.primary_endpoints.blob, sas_token) | ||
container = blob_client.create_container(name) | ||
container_uri = storage_account.primary_endpoints.blob + container.container_name | ||
self.test_class_instance.scrubber.register_name_pair(sas_token, "redacted") | ||
self.test_class_instance.scrubber.register_name_pair(container_uri, "https://storage/container") | ||
else: | ||
sas_token = "fake-sas" | ||
container_uri = "https://storage/container" | ||
return {"container_uri": container_uri, "sas_token": sas_token} |
286 changes: 286 additions & 0 deletions
286
...ault-administration/tests/recordings/test_backup_client.test_full_backup_and_restore.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,286 @@ | ||
interactions: | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '0' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: POST | ||
uri: https://managedhsm/backup?api-version=7.2-preview | ||
response: | ||
body: | ||
string: '' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '0' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
www-authenticate: | ||
- Bearer authorization="https://login.windows-ppe.net/f686d426-8d16-42db-81b7-ab578e110ccd", | ||
resource="https://managedhsm-int.azure-int.net" | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-server-latency: | ||
- '2' | ||
status: | ||
code: 401 | ||
message: Unauthorized | ||
- request: | ||
body: '{"storageResourceUri": "https://storname.blob.core.windows.net/containerlpibiggddqawmbw", | ||
"token": "redacted"}' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '235' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: POST | ||
uri: https://managedhsm/backup?api-version=7.2-preview | ||
response: | ||
body: | ||
string: '{"status":"InProgress","statusDetails":null,"error":{"code":null,"message":null,"innererror":null},"startTime":1599693259,"endTime":null,"jobId":"0c6890ada4cf411987b1c8fff2e8d20f","azureStorageBlobContainerUri":null}' | ||
headers: | ||
azure-asyncoperation: | ||
- https://managedhsm/backup/0c6890ada4cf411987b1c8fff2e8d20f/pending | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '216' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Sep 2020 23:14:19 GMT | ||
server: | ||
- Kestrel | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-keyvault-network-info: | ||
- addr=24.17.201.78 | ||
x-ms-keyvault-region: | ||
- EASTUS | ||
x-ms-server-latency: | ||
- '962' | ||
status: | ||
code: 202 | ||
message: '' | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://managedhsm/backup/0c6890ada4cf411987b1c8fff2e8d20f/pending | ||
response: | ||
body: | ||
string: '{"azureStorageBlobContainerUri":"https://storname.blob.core.windows.net/containerlpibiggddqawmbw/mhsm-chriss-eu2-2020090923141950","endTime":1599693269,"error":null,"jobId":"0c6890ada4cf411987b1c8fff2e8d20f","startTime":1599693259,"status":"Succeeded","statusDetails":null}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '289' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Sep 2020 23:14:29 GMT | ||
server: | ||
- Kestrel | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-build-version: | ||
- 1.0.20200909-2-c73be597-develop | ||
x-ms-keyvault-network-info: | ||
- addr=24.17.201.78 | ||
x-ms-keyvault-region: | ||
- EASTUS | ||
x-ms-server-latency: | ||
- '599' | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: '{"folderToRestore": "mhsm-chriss-eu2-2020090923141950", "sasTokenParameters": | ||
{"storageResourceUri": "https://storname.blob.core.windows.net/containerlpibiggddqawmbw", | ||
"token": "redacted"}}' | ||
headers: | ||
Accept: | ||
- application/json | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
Content-Length: | ||
- '314' | ||
Content-Type: | ||
- application/json | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: PUT | ||
uri: https://managedhsm/restore?api-version=7.2-preview | ||
response: | ||
body: | ||
string: '{"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f45c5ed12efc498990690cc92ed43684","startTime":1599693271,"status":"InProgress","statusDetails":null}' | ||
headers: | ||
azure-asyncoperation: | ||
- https://managedhsm/restore/f45c5ed12efc498990690cc92ed43684/pending | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '180' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Sep 2020 23:14:30 GMT | ||
server: | ||
- Kestrel | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-keyvault-network-info: | ||
- addr=24.17.201.78 | ||
x-ms-keyvault-region: | ||
- EASTUS | ||
x-ms-server-latency: | ||
- '812' | ||
status: | ||
code: 202 | ||
message: '' | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://managedhsm/restore/f45c5ed12efc498990690cc92ed43684/pending | ||
response: | ||
body: | ||
string: '{"endTime":null,"error":{"code":null,"innererror":null,"message":null},"jobId":"f45c5ed12efc498990690cc92ed43684","startTime":1599693271,"status":"InProgress","statusDetails":null}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '180' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Sep 2020 23:14:42 GMT | ||
server: | ||
- Kestrel | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-build-version: | ||
- 1.0.20200909-2-c73be597-develop | ||
x-ms-keyvault-network-info: | ||
- addr=24.17.201.78 | ||
x-ms-keyvault-region: | ||
- EASTUS | ||
x-ms-server-latency: | ||
- '534' | ||
status: | ||
code: 200 | ||
message: OK | ||
- request: | ||
body: null | ||
headers: | ||
Accept: | ||
- '*/*' | ||
Accept-Encoding: | ||
- gzip, deflate | ||
Connection: | ||
- keep-alive | ||
User-Agent: | ||
- azsdk-python-keyvault-administration/4.0.0b2 Python/3.5.4 (Windows-10-10.0.19041-SP0) | ||
method: GET | ||
uri: https://managedhsm/restore/f45c5ed12efc498990690cc92ed43684/pending | ||
response: | ||
body: | ||
string: '{"endTime":1599693288,"error":null,"jobId":"f45c5ed12efc498990690cc92ed43684","startTime":1599693271,"status":"Succeeded","statusDetails":null}' | ||
headers: | ||
cache-control: | ||
- no-cache | ||
content-length: | ||
- '143' | ||
content-security-policy: | ||
- default-src 'self' | ||
content-type: | ||
- application/json; charset=utf-8 | ||
date: | ||
- Wed, 09 Sep 2020 23:14:50 GMT | ||
server: | ||
- Kestrel | ||
strict-transport-security: | ||
- max-age=31536000; includeSubDomains | ||
x-content-type-options: | ||
- nosniff | ||
x-frame-options: | ||
- SAMEORIGIN | ||
x-ms-build-version: | ||
- 1.0.20200909-2-c73be597-develop | ||
x-ms-keyvault-network-info: | ||
- addr=24.17.201.78 | ||
x-ms-keyvault-region: | ||
- EASTUS | ||
x-ms-server-latency: | ||
- '656' | ||
status: | ||
code: 200 | ||
message: OK | ||
version: 1 |
Oops, something went wrong.