Skip to content

Commit d4041cb

Browse files
authored
[rdbms] update samples (Azure#30644)
* samples * update
1 parent e5545b8 commit d4041cb

File tree

286 files changed

+8506
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+8506
-91
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python advisors_get.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.advisors.get(
33+
resource_group_name="testResourceGroupName",
34+
server_name="testServerName",
35+
advisor_name="Index",
36+
)
37+
print(response)
38+
39+
40+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsGet.json
41+
if __name__ == "__main__":
42+
main()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python advisors_list_by_server.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.advisors.list_by_server(
33+
resource_group_name="testResourceGroupName",
34+
server_name="testServerName",
35+
)
36+
for item in response:
37+
print(item)
38+
39+
40+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/AdvisorsListByServer.json
41+
if __name__ == "__main__":
42+
main()
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python check_name_availability.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.check_name_availability.execute(
33+
name_availability_request={"name": "name1", "type": "Microsoft.DBforMariaDB"},
34+
)
35+
print(response)
36+
37+
38+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/CheckNameAvailability.json
39+
if __name__ == "__main__":
40+
main()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python configuration_create_or_update.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.configurations.begin_create_or_update(
33+
resource_group_name="TestGroup",
34+
server_name="testserver",
35+
configuration_name="event_scheduler",
36+
parameters={"properties": {"source": "user-override", "value": "off"}},
37+
).result()
38+
print(response)
39+
40+
41+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationCreateOrUpdate.json
42+
if __name__ == "__main__":
43+
main()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python configuration_get.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.configurations.get(
33+
resource_group_name="TestGroup",
34+
server_name="testserver",
35+
configuration_name="event_scheduler",
36+
)
37+
print(response)
38+
39+
40+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationGet.json
41+
if __name__ == "__main__":
42+
main()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python configuration_list_by_server.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.configurations.list_by_server(
33+
resource_group_name="testrg",
34+
server_name="mariadbtestsvc1",
35+
)
36+
for item in response:
37+
print(item)
38+
39+
40+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationListByServer.json
41+
if __name__ == "__main__":
42+
main()
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python configurations_update_by_server.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.server_parameters.begin_list_update_configurations(
33+
resource_group_name="testrg",
34+
server_name="mariadbtestsvc1",
35+
value=[
36+
{"name": "event_scheduler", "properties": {"value": "OFF"}},
37+
{"name": "div_precision_increment", "properties": {"value": "4"}},
38+
],
39+
).result()
40+
print(response)
41+
42+
43+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/ConfigurationsUpdateByServer.json
44+
if __name__ == "__main__":
45+
main()
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python database_create.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
response = client.databases.begin_create_or_update(
33+
resource_group_name="TestGroup",
34+
server_name="testserver",
35+
database_name="db1",
36+
parameters={"properties": {"charset": "utf8", "collation": "utf8_general_ci"}},
37+
).result()
38+
print(response)
39+
40+
41+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseCreate.json
42+
if __name__ == "__main__":
43+
main()
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from azure.identity import DefaultAzureCredential
10+
from azure.mgmt.rdbms.mariadb import MariaDBManagementClient
11+
12+
"""
13+
# PREREQUISITES
14+
pip install azure-identity
15+
pip install azure-mgmt-rdbms
16+
# USAGE
17+
python database_delete.py
18+
19+
Before run the sample, please set the values of the client ID, tenant ID and client secret
20+
of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID,
21+
AZURE_CLIENT_SECRET. For more info about how to get the value, please see:
22+
https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal
23+
"""
24+
25+
26+
def main():
27+
client = MariaDBManagementClient(
28+
credential=DefaultAzureCredential(),
29+
subscription_id="ffffffff-ffff-ffff-ffff-ffffffffffff",
30+
)
31+
32+
client.databases.begin_delete(
33+
resource_group_name="TestGroup",
34+
server_name="testserver",
35+
database_name="db1",
36+
).result()
37+
38+
39+
# x-ms-original-file: specification/mariadb/resource-manager/Microsoft.DBforMariaDB/stable/2018-06-01/examples/DatabaseDelete.json
40+
if __name__ == "__main__":
41+
main()

0 commit comments

Comments
 (0)