[Automation] Collect examples from azure-sdk-for-python#azure-mgmt-containerinstance_10.2.0b1
This commit is contained in:
Родитель
53f39c29f1
Коммит
a65fcc1c70
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python cached_images_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.location.list_cached_images(
|
||||
location="westcentralus",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CachedImagesList.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python capabilities_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.location.list_capabilities(
|
||||
location="westus",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/CapabilitiesList.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_attach.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.containers.attach(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_name="container1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerAttach.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,36 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_exec.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.containers.execute_command(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_name="container1",
|
||||
container_exec_request={"command": "/bin/bash", "terminalSize": {"cols": 12, "rows": 12}},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerExec.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,59 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_create_confidential.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"location": "westeurope",
|
||||
"properties": {
|
||||
"confidentialComputeProperties": {
|
||||
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
|
||||
},
|
||||
"containers": [
|
||||
{
|
||||
"name": "accdemo",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "confiimage",
|
||||
"ports": [{"port": 8000}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
"securityContext": {"capabilities": {"add": ["CAP_NET_ADMIN"]}, "privileged": False},
|
||||
},
|
||||
}
|
||||
],
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 8000, "protocol": "TCP"}], "type": "Public"},
|
||||
"osType": "Linux",
|
||||
"sku": "Confidential",
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateConfidential.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,47 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_create_or_update_standby_pool.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"location": "west us",
|
||||
"properties": {
|
||||
"containerGroupProfile": {
|
||||
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.ContainerInstance/containerGroupProfiles/democgp",
|
||||
"revision": 1,
|
||||
},
|
||||
"containers": [{"name": "demo1", "properties": {"configMap": {"keyValuePairs": {"Newkey": "value"}}}}],
|
||||
"standbyPoolProfile": {
|
||||
"id": "/subscriptions/subid/resourceGroups/demo/providers/Microsoft.StandbyPool/standbyContainerGroupPools/demopool"
|
||||
},
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupCreateOrUpdateStandbyPool.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,66 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_encryption_properties.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"identity": {
|
||||
"type": "UserAssigned",
|
||||
"userAssignedIdentities": {
|
||||
"/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity": {}
|
||||
},
|
||||
},
|
||||
"location": "eastus2",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"encryptionProperties": {
|
||||
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
|
||||
"keyName": "test-key",
|
||||
"keyVersion": "<key version>",
|
||||
"vaultBaseUrl": "https://testkeyvault.vault.azure.net",
|
||||
},
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"},
|
||||
"osType": "Linux",
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupEncryptionProperties.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,74 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_extensions.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"location": "eastus2",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "kube-proxy",
|
||||
"properties": {
|
||||
"extensionType": "kube-proxy",
|
||||
"protectedSettings": {"kubeConfig": "<kubeconfig encoded string>"},
|
||||
"settings": {"clusterCidr": "10.240.0.0/16", "kubeVersion": "v1.9.10"},
|
||||
"version": "1.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "vk-realtime-metrics",
|
||||
"properties": {"extensionType": "realtime-metrics", "version": "1.0"},
|
||||
},
|
||||
],
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Private"},
|
||||
"osType": "Linux",
|
||||
"subnetIds": [
|
||||
{
|
||||
"id": "/subscriptions/00000000-0000-0000-0000-00000000/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-rg-vnet/subnets/test-subnet"
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupExtensions.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,60 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profile_create_or_update_create_confidential.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
container_group_profile={
|
||||
"location": "westeurope",
|
||||
"properties": {
|
||||
"confidentialComputeProperties": {
|
||||
"ccePolicy": "eyJhbGxvd19hbGwiOiB0cnVlLCAiY29udGFpbmVycyI6IHsibGVuZ3RoIjogMCwgImVsZW1lbnRzIjogbnVsbH19"
|
||||
},
|
||||
"containers": [
|
||||
{
|
||||
"name": "accdemo",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "confiimage",
|
||||
"ports": [{"port": 8000}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
"securityContext": {"capabilities": {"add": ["CAP_NET_ADMIN"]}, "privileged": False},
|
||||
},
|
||||
}
|
||||
],
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 8000, "protocol": "TCP"}], "type": "Public"},
|
||||
"osType": "Linux",
|
||||
"sku": "Confidential",
|
||||
},
|
||||
"zones": ["1"],
|
||||
},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_CreateConfidential.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,61 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profile_create_or_update_encryption_properties.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
container_group_profile={
|
||||
"location": "eastus2",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"encryptionProperties": {
|
||||
"identity": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/test-rg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/container-group-identity",
|
||||
"keyName": "test-key",
|
||||
"keyVersion": "<key version>",
|
||||
"vaultBaseUrl": "https://testkeyvault.vault.azure.net",
|
||||
},
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"},
|
||||
"osType": "Linux",
|
||||
},
|
||||
"zones": ["1"],
|
||||
},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_EncryptionProperties.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,70 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profile_create_or_update_extensions.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
container_group_profile={
|
||||
"location": "eastus2",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1.5}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"extensions": [
|
||||
{
|
||||
"name": "kube-proxy",
|
||||
"properties": {
|
||||
"extensionType": "kube-proxy",
|
||||
"protectedSettings": {"kubeConfig": "<kubeconfig encoded string>"},
|
||||
"settings": {"clusterCidr": "10.240.0.0/16", "kubeVersion": "v1.9.10"},
|
||||
"version": "1.0",
|
||||
},
|
||||
},
|
||||
{
|
||||
"name": "vk-realtime-metrics",
|
||||
"properties": {"extensionType": "realtime-metrics", "version": "1.0"},
|
||||
},
|
||||
],
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Private"},
|
||||
"osType": "Linux",
|
||||
},
|
||||
"zones": ["1"],
|
||||
},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileCreateOrUpdate_Extensions.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profile_get_by_revision_number.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profile.get_by_revision_number(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
revision_number="1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileGetByRevisionNumber.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profile_list_all_revisions.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profile.list_all_revisions(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfileListAllRevisions.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,84 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
container_group_profile={
|
||||
"location": "west us",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}},
|
||||
"volumeMounts": [
|
||||
{"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False},
|
||||
{"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False},
|
||||
{"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True},
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
"diagnostics": {
|
||||
"logAnalytics": {
|
||||
"logType": "ContainerInsights",
|
||||
"metadata": {"pod-uuid": "test-metadata-value"},
|
||||
"workspaceId": "workspaceid",
|
||||
"workspaceKey": "workspaceKey",
|
||||
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
|
||||
}
|
||||
},
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {"ports": [{"port": 80, "protocol": "TCP"}], "type": "Public"},
|
||||
"osType": "Linux",
|
||||
"volumes": [
|
||||
{
|
||||
"azureFile": {
|
||||
"shareName": "shareName",
|
||||
"storageAccountKey": "accountKey",
|
||||
"storageAccountName": "accountName",
|
||||
},
|
||||
"name": "volume1",
|
||||
},
|
||||
{"emptyDir": {}, "name": "volume2"},
|
||||
{
|
||||
"name": "volume3",
|
||||
"secret": {"secretKey1": "SecretValue1InBase64", "secretKey2": "SecretValue2InBase64"},
|
||||
},
|
||||
],
|
||||
},
|
||||
"zones": ["1"],
|
||||
},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesCreateOrUpdate.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,33 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
client.container_group_profiles.delete(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesDelete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.get(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGet.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_get_priority.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.get(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesGetPriority.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,32 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.list()
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesList.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.list_by_resource_group(
|
||||
resource_group_name="demo",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_profiles_patch.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.patch(
|
||||
resource_group_name="demoResource",
|
||||
container_group_profile_name="demo1",
|
||||
properties={"tags": {"tag1key": "tag1Value", "tag2key": "tag2Value"}},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupProfilesPatch.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_group_usage.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.location.list_usage(
|
||||
location="westcentralus",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupUsage.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,104 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"identity": {
|
||||
"type": "SystemAssigned, UserAssigned",
|
||||
"userAssignedIdentities": {
|
||||
"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-name": {}
|
||||
},
|
||||
},
|
||||
"location": "west us",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "demo1",
|
||||
"properties": {
|
||||
"command": [],
|
||||
"environmentVariables": [],
|
||||
"image": "nginx",
|
||||
"ports": [{"port": 80}],
|
||||
"resources": {"requests": {"cpu": 1, "gpu": {"count": 1, "sku": "K80"}, "memoryInGB": 1.5}},
|
||||
"volumeMounts": [
|
||||
{"mountPath": "/mnt/volume1", "name": "volume1", "readOnly": False},
|
||||
{"mountPath": "/mnt/volume2", "name": "volume2", "readOnly": False},
|
||||
{"mountPath": "/mnt/volume3", "name": "volume3", "readOnly": True},
|
||||
],
|
||||
},
|
||||
}
|
||||
],
|
||||
"diagnostics": {
|
||||
"logAnalytics": {
|
||||
"logType": "ContainerInsights",
|
||||
"metadata": {"test-key": "test-metadata-value"},
|
||||
"workspaceId": "workspaceid",
|
||||
"workspaceKey": "workspaceKey",
|
||||
"workspaceResourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg/providers/microsoft.operationalinsights/workspaces/workspace",
|
||||
}
|
||||
},
|
||||
"dnsConfig": {
|
||||
"nameServers": ["1.1.1.1"],
|
||||
"options": "ndots:2",
|
||||
"searchDomains": "cluster.local svc.cluster.local",
|
||||
},
|
||||
"imageRegistryCredentials": [],
|
||||
"ipAddress": {
|
||||
"autoGeneratedDomainNameLabelScope": "Unsecure",
|
||||
"dnsNameLabel": "dnsnamelabel1",
|
||||
"ports": [{"port": 80, "protocol": "TCP"}],
|
||||
"type": "Public",
|
||||
},
|
||||
"osType": "Linux",
|
||||
"subnetIds": [
|
||||
{
|
||||
"id": "[resourceId('Microsoft.Network/virtualNetworks/subnets', parameters('vnetName'), parameters('subnetName'))]"
|
||||
}
|
||||
],
|
||||
"volumes": [
|
||||
{
|
||||
"azureFile": {
|
||||
"shareName": "shareName",
|
||||
"storageAccountKey": "accountKey",
|
||||
"storageAccountName": "accountName",
|
||||
},
|
||||
"name": "volume1",
|
||||
},
|
||||
{"emptyDir": {}, "name": "volume2"},
|
||||
{
|
||||
"name": "volume3",
|
||||
"secret": {"secretKey1": "SecretValue1InBase64", "secretKey2": "SecretValue2InBase64"},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreateOrUpdate.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,53 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_create_priority.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_group={
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "test-container-001",
|
||||
"properties": {
|
||||
"command": ["/bin/sh", "-c", "sleep 10"],
|
||||
"image": "alpine:latest",
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"osType": "Linux",
|
||||
"priority": "Spot",
|
||||
"restartPolicy": "Never",
|
||||
"sku": "Standard",
|
||||
},
|
||||
},
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsCreatePriority.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.begin_delete(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
).result()
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsDelete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_get_priority.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.get(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGetPriority.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_get_failed.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.get(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Failed.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_get_succeeded.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.get(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsGet_Succeeded.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,32 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.list()
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsList.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_groups.list_by_resource_group(
|
||||
resource_group_name="demo",
|
||||
)
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsListByResourceGroup.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,53 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_profile_create_or_update_create_priority.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.container_group_profiles.create_or_update(
|
||||
resource_group_name="demo",
|
||||
container_group_profile_name="demo1",
|
||||
container_group_profile={
|
||||
"location": "eastus",
|
||||
"properties": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "test-container-001",
|
||||
"properties": {
|
||||
"command": ["/bin/sh", "-c", "sleep 10"],
|
||||
"image": "alpine:latest",
|
||||
"resources": {"requests": {"cpu": 1, "memoryInGB": 1}},
|
||||
},
|
||||
}
|
||||
],
|
||||
"osType": "Linux",
|
||||
"priority": "Spot",
|
||||
"restartPolicy": "Never",
|
||||
"sku": "Standard",
|
||||
},
|
||||
},
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsProfileCreateOrUpdate_CreatePriority.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,33 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_restart.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
client.container_groups.begin_restart(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsRestart.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,33 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_start.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
client.container_groups.begin_start(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStart.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,33 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_groups_stop.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
client.container_groups.stop(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerGroupsStop.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,35 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python container_list_logs.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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
response = client.containers.list_logs(
|
||||
resource_group_name="demo",
|
||||
container_group_name="demo1",
|
||||
container_name="container1",
|
||||
)
|
||||
print(response)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/ContainerListLogs.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,32 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# 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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="SUBSCRIPTION_ID",
|
||||
)
|
||||
|
||||
response = client.operations.list()
|
||||
for item in response:
|
||||
print(item)
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/OperationsList.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1 @@
|
|||
{"sdkUrl": "https://github.com/Azure/azure-sdk-for-python/blob/azure-mgmt-containerinstance_10.2.0b1/sdk/containerinstance/azure-mgmt-containerinstance/README.md"}
|
|
@ -0,0 +1,34 @@
|
|||
from azure.identity import DefaultAzureCredential
|
||||
|
||||
from azure.mgmt.containerinstance import ContainerInstanceManagementClient
|
||||
|
||||
"""
|
||||
# PREREQUISITES
|
||||
pip install azure-identity
|
||||
pip install azure-mgmt-containerinstance
|
||||
# USAGE
|
||||
python subnet_service_association_link_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 = ContainerInstanceManagementClient(
|
||||
credential=DefaultAzureCredential(),
|
||||
subscription_id="00000000-0000-0000-0000-000000000000",
|
||||
)
|
||||
|
||||
client.subnet_service_association_link.begin_delete(
|
||||
resource_group_name="demo",
|
||||
virtual_network_name="demo2",
|
||||
subnet_name="demo3",
|
||||
).result()
|
||||
|
||||
|
||||
# x-ms-original-file: specification/containerinstance/resource-manager/Microsoft.ContainerInstance/preview/2024-05-01-preview/examples/SubnetServiceAssociationLinkDelete.json
|
||||
if __name__ == "__main__":
|
||||
main()
|
Загрузка…
Ссылка в новой задаче