forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CodeGen from PR 22575 in Azure/azure-rest-api-specs
Merge 58e200d1fe0765b36378c106af0c1d1cbf012fcc into f1180941e238bc99ac71f9535ecd126bb8b77d8f
- Loading branch information
SDKAuto
committed
Feb 13, 2023
1 parent
ccc06a9
commit f195ebc
Showing
529 changed files
with
15,878 additions
and
7,764 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
{ | ||
"commit": "26e345ad8ee56ce862b9c06ba95b721d05aa837b", | ||
"repository_url": "https://github.com/Azure/azure-rest-api-specs", | ||
"autorest": "3.9.2", | ||
"use": [ | ||
"@autorest/python@6.1.9", | ||
"@autorest/python@6.4.0", | ||
"@autorest/[email protected]" | ||
], | ||
"commit": "5263f0b2ead74031fa567da2700411743da26e7f", | ||
"repository_url": "https://github.com/Azure/azure-rest-api-specs", | ||
"autorest_command": "autorest specification/monitor/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False", | ||
"autorest_command": "autorest specification/monitor/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False", | ||
"readme": "specification/monitor/resource-manager/readme.md" | ||
} |
160 changes: 160 additions & 0 deletions
160
sdk/monitor/azure-mgmt-monitor/azure/generated_samples/create_or_update_autoscale_setting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python create_or_update_autoscale_setting.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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", | ||
) | ||
|
||
response = client.autoscale_settings.create_or_update( | ||
resource_group_name="TestingMetricsScaleSet", | ||
autoscale_setting_name="MySetting", | ||
parameters={ | ||
"location": "West US", | ||
"properties": { | ||
"enabled": True, | ||
"notifications": [ | ||
{ | ||
"email": { | ||
"customEmails": ["[email protected]", "[email protected]"], | ||
"sendToSubscriptionAdministrator": True, | ||
"sendToSubscriptionCoAdministrators": True, | ||
}, | ||
"operation": "Scale", | ||
"webhooks": [{"properties": {}, "serviceUri": "http://myservice.com"}], | ||
} | ||
], | ||
"predictiveAutoscalePolicy": {"scaleMode": "Enabled"}, | ||
"profiles": [ | ||
{ | ||
"capacity": {"default": "1", "maximum": "10", "minimum": "1"}, | ||
"fixedDate": { | ||
"end": "2015-03-05T14:30:00Z", | ||
"start": "2015-03-05T14:00:00Z", | ||
"timeZone": "UTC", | ||
}, | ||
"name": "adios", | ||
"rules": [ | ||
{ | ||
"metricTrigger": { | ||
"dividePerInstance": False, | ||
"metricName": "Percentage CPU", | ||
"metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", | ||
"operator": "GreaterThan", | ||
"statistic": "Average", | ||
"threshold": 10, | ||
"timeAggregation": "Average", | ||
"timeGrain": "PT1M", | ||
"timeWindow": "PT5M", | ||
}, | ||
"scaleAction": { | ||
"cooldown": "PT5M", | ||
"direction": "Increase", | ||
"type": "ChangeCount", | ||
"value": "1", | ||
}, | ||
}, | ||
{ | ||
"metricTrigger": { | ||
"dividePerInstance": False, | ||
"metricName": "Percentage CPU", | ||
"metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", | ||
"operator": "GreaterThan", | ||
"statistic": "Average", | ||
"threshold": 15, | ||
"timeAggregation": "Average", | ||
"timeGrain": "PT2M", | ||
"timeWindow": "PT5M", | ||
}, | ||
"scaleAction": { | ||
"cooldown": "PT6M", | ||
"direction": "Decrease", | ||
"type": "ChangeCount", | ||
"value": "2", | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
"capacity": {"default": "1", "maximum": "10", "minimum": "1"}, | ||
"name": "saludos", | ||
"recurrence": { | ||
"frequency": "Week", | ||
"schedule": {"days": ["1"], "hours": [5], "minutes": [15], "timeZone": "UTC"}, | ||
}, | ||
"rules": [ | ||
{ | ||
"metricTrigger": { | ||
"dividePerInstance": False, | ||
"metricName": "Percentage CPU", | ||
"metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", | ||
"operator": "GreaterThan", | ||
"statistic": "Average", | ||
"threshold": 10, | ||
"timeAggregation": "Average", | ||
"timeGrain": "PT1M", | ||
"timeWindow": "PT5M", | ||
}, | ||
"scaleAction": { | ||
"cooldown": "PT5M", | ||
"direction": "Increase", | ||
"type": "ChangeCount", | ||
"value": "1", | ||
}, | ||
}, | ||
{ | ||
"metricTrigger": { | ||
"dividePerInstance": False, | ||
"metricName": "Percentage CPU", | ||
"metricResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", | ||
"operator": "GreaterThan", | ||
"statistic": "Average", | ||
"threshold": 15, | ||
"timeAggregation": "Average", | ||
"timeGrain": "PT2M", | ||
"timeWindow": "PT5M", | ||
}, | ||
"scaleAction": { | ||
"cooldown": "PT6M", | ||
"direction": "Decrease", | ||
"type": "ChangeCount", | ||
"value": "2", | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
"targetResourceUri": "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc", | ||
}, | ||
"tags": {"key1": "value1", "key2": "value2"}, | ||
}, | ||
) | ||
print(response) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json | ||
if __name__ == "__main__": | ||
main() |
41 changes: 41 additions & 0 deletions
41
sdk/monitor/azure-mgmt-monitor/azure/generated_samples/delete_autoscale_setting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python delete_autoscale_setting.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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", | ||
) | ||
|
||
response = client.autoscale_settings.delete( | ||
resource_group_name="TestingMetricsScaleSet", | ||
autoscale_setting_name="MySetting", | ||
) | ||
print(response) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json | ||
if __name__ == "__main__": | ||
main() |
41 changes: 41 additions & 0 deletions
41
sdk/monitor/azure-mgmt-monitor/azure/generated_samples/get_autoscale_setting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python get_autoscale_setting.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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", | ||
) | ||
|
||
response = client.autoscale_settings.get( | ||
resource_group_name="TestingMetricsScaleSet", | ||
autoscale_setting_name="MySetting", | ||
) | ||
print(response) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json | ||
if __name__ == "__main__": | ||
main() |
48 changes: 48 additions & 0 deletions
48
sdk/monitor/azure-mgmt-monitor/azure/generated_samples/get_predictive_metric.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
import isodate | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python get_predictive_metric.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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="00000000-0000-0000-0000-000000000000", | ||
) | ||
|
||
response = client.predictive_metric.get( | ||
resource_group_name="myRG", | ||
autoscale_setting_name="vmss1-Autoscale-775", | ||
timespan="2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", | ||
interval=isodate.parse_duration("PT1H"), | ||
metric_namespace="Microsoft.Compute/virtualMachineScaleSets", | ||
metric_name="PercentageCPU", | ||
aggregation="Total", | ||
) | ||
print(response) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json | ||
if __name__ == "__main__": | ||
main() |
41 changes: 41 additions & 0 deletions
41
sdk/monitor/azure-mgmt-monitor/azure/generated_samples/list_autoscale_setting.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python list_autoscale_setting.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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", | ||
) | ||
|
||
response = client.autoscale_settings.list_by_resource_group( | ||
resource_group_name="TestingMetricsScaleSet", | ||
) | ||
for item in response: | ||
print(item) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json | ||
if __name__ == "__main__": | ||
main() |
39 changes: 39 additions & 0 deletions
39
...itor/azure-mgmt-monitor/azure/generated_samples/list_autoscale_setting_by_subscription.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from azure.identity import DefaultAzureCredential | ||
from azure.mgmt.monitor import MonitorManagementClient | ||
|
||
""" | ||
# PREREQUISITES | ||
pip install azure-identity | ||
pip install azure-mgmt-monitor | ||
# USAGE | ||
python list_autoscale_setting_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 = MonitorManagementClient( | ||
credential=DefaultAzureCredential(), | ||
subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", | ||
) | ||
|
||
response = client.autoscale_settings.list_by_subscription() | ||
for item in response: | ||
print(item) | ||
|
||
|
||
# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json | ||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.