[Automation] Collect examples from azure-sdk-for-python#azure-mgmt-apicenter_1.0.0

Co-authored-by: azure-sdk <azuresdk@microsoft.com>
This commit is contained in:
Azure-Fluent 2024-02-23 20:02:10 +08:00 коммит произвёл GitHub
Родитель 87255b60a7
Коммит ad94983c34
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
70 изменённых файлов: 1257 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_definitions_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_definitions.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
definition_name="openapi",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,37 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_definitions_export_specification.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_definitions.begin_export_specification(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
definition_name="openapi",
).result()
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_ExportSpecification.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,37 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_definitions_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_definitions.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
definition_name="openapi",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,37 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_definitions_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_definitions.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
definition_name="openapi",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,37 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_definitions_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_definitions.list(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiDefinitions_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_versions_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.api_versions.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_versions_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_versions.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_versions_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_versions.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
version_name="2023-01-01",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python api_versions_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.api_versions.list(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/ApiVersions_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python apis_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.apis.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python apis_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.apis.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python apis_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.apis.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python apis_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.apis.list(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Apis_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python deployments_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.deployments.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
deployment_name="production",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python deployments_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployments.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
deployment_name="production",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python deployments_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployments.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
deployment_name="production",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,36 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python deployments_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.deployments.list(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
api_name="echo-api",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Deployments_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python environments_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.environments.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
environment_name="public",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python environments_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.environments.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
environment_name="public",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python environments_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.environments.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
environment_name="public",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,35 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python environments_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.environments.list(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Environments_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,33 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python metadata_schemas_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.metadata_schemas.delete(
resource_group_name="contoso-resources",
service_name="contoso",
metadata_schema_name="author",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python metadata_schemas_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.metadata_schemas.get(
resource_group_name="contoso-resources",
service_name="contoso",
metadata_schema_name="lastName",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python metadata_schemas_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.metadata_schemas.head(
resource_group_name="contoso-resources",
service_name="contoso",
metadata_schema_name="author",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python metadata_schemas_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.metadata_schemas.list(
resource_group_name="contoso-resources",
service_name="contoso",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/MetadataSchemas_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,31 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python operations_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="SUBSCRIPTION_ID",
)
response = client.operations.list()
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Operations_List.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,44 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python services_create_or_update.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.services.create_or_update(
resource_group_name="contoso-resources",
service_name="contoso",
resource={
"identity": {
"type": "SystemAssigned, UserAssigned",
"userAssignedIdentities": {
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/contoso-resources/providers/Microsoft.ManagedIdentity/userAssignedIdentities/contoso-identity": {}
},
},
"location": "East US",
"properties": {},
"tags": {},
},
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_CreateOrUpdate.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,32 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python services_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.services.delete(
resource_group_name="contoso-resources",
service_name="contoso",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,33 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python services_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.services.get(
resource_group_name="contoso-resources",
service_name="contoso",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,33 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python services_list_by_resource_group.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.services.list_by_resource_group(
resource_group_name="contoso-resources",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListByResourceGroup.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,31 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python services_list_by_subscription.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.services.list_by_subscription()
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Services_ListBySubscription.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,33 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python workspaces_delete.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
client.workspaces.delete(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Delete.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python workspaces_get.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.workspaces.get(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Get.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python workspaces_head.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.workspaces.head(
resource_group_name="contoso-resources",
service_name="contoso",
workspace_name="default",
)
print(response)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_Head.json
if __name__ == "__main__":
main()

Просмотреть файл

@ -0,0 +1 @@
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-apicenter_1.0.0/sdk/apicenter/azure-mgmt-apicenter/README.md"}

Просмотреть файл

@ -0,0 +1,34 @@
from azure.identity import DefaultAzureCredential
from azure.mgmt.apicenter import ApiCenterMgmtClient
"""
# PREREQUISITES
pip install azure-identity
pip install azure-mgmt-apicenter
# USAGE
python workspaces_list.py
Before run the sample, please set the values of the client ID, tenant ID and client secret
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
"""
def main():
client = ApiCenterMgmtClient(
credential=DefaultAzureCredential(),
subscription_id="00000000-0000-0000-0000-000000000000",
)
response = client.workspaces.list(
resource_group_name="contoso-resources",
service_name="contoso",
)
for item in response:
print(item)
# x-ms-original-file: specification/apicenter/resource-manager/Microsoft.ApiCenter/stable/2024-03-01/examples/Workspaces_List.json
if __name__ == "__main__":
main()