Skip to content

Commit

Permalink
CodeGen from PR 22575 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 9aca9d6587115bdaface0df34435309541c71c8b into 4802c0f73151b90bd207df82cb0207d70db7b445
  • Loading branch information
SDKAuto committed Feb 13, 2023
1 parent e94435e commit a35bb09
Show file tree
Hide file tree
Showing 529 changed files with 15,878 additions and 7,764 deletions.
8 changes: 4 additions & 4 deletions sdk/monitor/azure-mgmt-monitor/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "7928b9351dd27fa4b582743eb1a359be96699cb5",
"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"
}
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()
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()
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()
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()
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()
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()
Loading

0 comments on commit a35bb09

Please sign in to comment.