-
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.
Add parse_key_vault_certificate_id method and tests (#14518)
- Loading branch information
Showing
9 changed files
with
490 additions
and
41 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
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
29 changes: 29 additions & 0 deletions
29
sdk/keyvault/azure-keyvault-certificates/azure/keyvault/certificates/_parse_id.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,29 @@ | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
|
||
from ._shared import parse_key_vault_id, KeyVaultResourceId | ||
|
||
|
||
def parse_key_vault_certificate_id(source_id): | ||
# type: (str) -> KeyVaultResourceId | ||
"""Parses a certificate's full ID into a class with parsed contents as attributes. | ||
:param str source_id: the full original identifier of a certificate | ||
:returns: Returns a parsed certificate ID as a :class:`KeyVaultResourceId` | ||
:rtype: ~azure.keyvault.certificates.KeyVaultResourceId | ||
:raises: ValueError | ||
Example: | ||
.. literalinclude:: ../tests/test_parse_id.py | ||
:start-after: [START parse_key_vault_certificate_id] | ||
:end-before: [END parse_key_vault_certificate_id] | ||
:language: python | ||
:caption: Parse a certificate's ID | ||
:dedent: 8 | ||
""" | ||
parsed_id = parse_key_vault_id(source_id) | ||
|
||
return KeyVaultResourceId( | ||
name=parsed_id.name, source_id=parsed_id.source_id, vault_url=parsed_id.vault_url, version=parsed_id.version | ||
) |
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
Oops, something went wrong.