Skip to content

Commit

Permalink
Add missing doc
Browse files Browse the repository at this point in the history
  • Loading branch information
lmazuel committed Sep 13, 2016
1 parent bf8fc05 commit cf9b2f3
Show file tree
Hide file tree
Showing 14 changed files with 424 additions and 9 deletions.
4 changes: 2 additions & 2 deletions azure-mgmt-cognitiveservices/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ If you see azure==0.11.0 (or any version below 1.0), uninstall it first:
Usage
=====

For code examples, see `Commerce
<https://azure-sdk-for-python.readthedocs.org/en/latest/commerce.html>`__
For code examples, see `Cognitive Services
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-cognitiveservices.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-commerce/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Usage
=====

For code examples, see `Commerce
<https://azure-sdk-for-python.readthedocs.org/en/latest/commerce.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementcommerce.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-dns/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Usage
=====

For code examples, see `DNS
<https://azure-sdk-for-python.readthedocs.org/en/latest/dns.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-dns.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-keyvault/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Usage
=====

For code examples, see `KeyVault Resource Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementkeyvault.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-keyvault.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-logic/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Usage
=====

For code examples, see `Logic Apps Resource Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementlogic.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementapps.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-powerbiembedded/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Usage
=====

For code examples, see `PowerBI Embedded
<https://azure-sdk-for-python.readthedocs.org/en/latest/powerbiembedded.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/sample_azure-mgmt-powerbiembedded.html>`__
on readthedocs.org.


Expand Down
2 changes: 1 addition & 1 deletion azure-mgmt-web/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Usage
=====

For code examples, see `Web Apps Resource Management
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementweb.html>`__
<https://azure-sdk-for-python.readthedocs.org/en/latest/resourcemanagementapps.html>`__
on readthedocs.org.


Expand Down
8 changes: 7 additions & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,17 @@ All documentation of management libraries for Azure are on this website. This in
* :doc:`Authorization <resourcemanagementauthorization>` : Permissions, roles and more
* :doc:`Batch<resourcemanagementbatch>` : Manage Batch accounts and applications
* :doc:`Content Delivery Network<resourcemanagementcdn>` : Profiles, endpoints creation and more
* :doc:`Cognitive Services<sample_azure-mgmt-cognitiveservices>` : Create CS accounts and more
* :doc:`Commerce - Billing API<resourcemanagementcommerce>` : RateCard and Usage Billing API
* :doc:`Compute<resourcemanagementcomputenetwork>` : Create virtual machines and more
* :doc:`DevTestLabs<sample_azure-mgmt-devtestlabs>` : Create labs and more
* :doc:`App Service<resourcemanagementapps>` : Manage App plan, Web Apps, Logic Apps and more
* :doc:`DNS<sample_azure-mgmt-dns>` : Create DNS zone, record set and more
* :doc:`IoTHub<sample_azure-mgmt-iothub>` : Create IoTHub account and more
* :doc:`KeyVault<sample_azure-mgmt-keyvault>` : Create vaults and more
* :doc:`App Service<resourcemanagementapps>` : Create App plan, Web Apps, Logic Apps and more
* :doc:`Network<resourcemanagementcomputenetwork>` : Create virtual networks, network interfaces, public IPs and more
* :doc:`Notification Hubs<resourcemanagementnotificationhubs>` : Namespaces, hub creation/deletion and more
* :doc:`PowerBI Embedded<sample_azure-mgmt-powerbiembedded>` : Create account and more
* :doc:`Redis Cache<resourcemanagementredis>` : Create cache and more
* :doc:`Resource Management<resourcemanagement>`:

Expand All @@ -137,6 +142,7 @@ All documentation of management libraries for Azure are on this website. This in
* :doc:`Scheduler<resourcemanagementscheduler>` : Create job collections, create job and more
* :doc:`Server Manager<sample_azure-mgmt-servermanager>` : Create gateways, nodes and more
* :doc:`Storage<resourcemanagementstorage>` : Create storage accounts, list keys, and more
* :doc:`Traffic Manager<sample_azure-mgmt-trafficmanager>` : Create endpoints, profiles and more

Azure Runtime
^^^^^^^^^^^^^
Expand Down
53 changes: 53 additions & 0 deletions doc/sample_azure-mgmt-cognitiveservices.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Cognitive Services Management
=============================

For general information on resource management, see :doc:`Resource Management<resourcemanagement>`.

Create the management client
----------------------------

The following code creates an instance of the management client.

You will need to provide your ``subscription_id`` which can be retrieved
from `your subscription list <https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping>`__.

See :doc:`Resource Management Authentication <quickstart_authentication>`
for details on handling Azure Active Directory authentication with the Python SDK, and creating a ``Credentials`` instance.

.. code:: python
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient
from azure.common.credentials import UserPassCredentials
# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'
# See above for details on creating different types of AAD credentials
credentials = UserPassCredentials(
'user@domain.com', # Your user
'my_password', # Your password
)
cognitiveservices_client = CognitiveServicesManagementClient(
credentials,
subscription_id
)
Registration
------------

Some operations in the ARM APIs require a one-time registration of the
provider with your subscription.

Use the following code to do the registration. You can use the same
credentials you created in the previous section.

.. code:: python
from azure.mgmt.resource.resources import ResourceManagementClient
resource_client = ResourceManagementClient(
credentials,
subscription_id
)
resource_client.providers.register('Microsoft.CognitiveServices')
91 changes: 91 additions & 0 deletions doc/sample_azure-mgmt-dns.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
DNS Management
==============

For general information on resource management, see :doc:`Resource Management<resourcemanagement>`.

Create the management client
----------------------------

The following code creates an instance of the management client.

You will need to provide your ``subscription_id`` which can be retrieved
from `your subscription list <https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping>`__.

See :doc:`Resource Management Authentication <quickstart_authentication>`
for details on handling Azure Active Directory authentication with the Python SDK, and creating a ``Credentials`` instance.

.. code:: python
from azure.mgmt.dns import DnsManagementClient
from azure.common.credentials import UserPassCredentials
# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'
# See above for details on creating different types of AAD credentials
credentials = UserPassCredentials(
'user@domain.com', # Your user
'my_password', # Your password
)
dns_client = DnsManagementClient(
credentials,
subscription_id
)
Registration
------------

Some operations in the ARM APIs require a one-time registration of the
provider with your subscription.

Use the following code to do the registration. You can use the same
credentials you created in the previous section.

.. code:: python
from azure.mgmt.resource.resources import ResourceManagementClient
resource_client = ResourceManagementClient(
credentials,
subscription_id
)
resource_client.providers.register('Microsoft.Network')
Create DNS zone
---------------

.. code:: python
# The only valid value is 'global', otherwise you will get a:
# The subscription is not registered for the resource type 'dnszones' in the location 'westus'.
zone = dns_client.zones.create_or_update(
'MyResourceGroup',
'pydns.com',
{
'location': 'global'
}
)
Create a Record Set
-------------------

.. code:: python
record_set = dns_client.record_sets.create_or_update(
'MyResourceGroup',
'pydns.com',
'MyRecordSet',
'A',
{
"ttl": 300,
"arecords": [
{
"ipv4_address": "1.2.3.4"
},
{
"ipv4_address": "1.2.3.5"
}
]
}
)
85 changes: 85 additions & 0 deletions doc/sample_azure-mgmt-iothub.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
IoTHub Management
=================

For general information on resource management, see :doc:`Resource Management<resourcemanagement>`.

Create the management client
----------------------------

The following code creates an instance of the management client.

You will need to provide your ``subscription_id`` which can be retrieved
from `your subscription list <https://manage.windowsazure.com/#Workspaces/AdminTasks/SubscriptionMapping>`__.

See :doc:`Resource Management Authentication <quickstart_authentication>`
for details on handling Azure Active Directory authentication with the Python SDK, and creating a ``Credentials`` instance.

.. code:: python
from azure.mgmt.iothub import IotHubClient
from azure.common.credentials import UserPassCredentials
# Replace this with your subscription id
subscription_id = '33333333-3333-3333-3333-333333333333'
# See above for details on creating different types of AAD credentials
credentials = UserPassCredentials(
'user@domain.com', # Your user
'my_password', # Your password
)
iothub_client = IotHubClient(
credentials,
subscription_id
)
Registration
------------

Some operations in the ARM APIs require a one-time registration of the
provider with your subscription.

Use the following code to do the registration. You can use the same
credentials you created in the previous section.

.. code:: python
from azure.mgmt.resource.resources import ResourceManagementClient
resource_client = ResourceManagementClient(
credentials,
subscription_id
)
resource_client.providers.register('Microsoft.Devices')
Create an IoTHub
---------------

.. code:: python
async_iot_hub = iothub_client.iot_hub_resource.create_or_update(
'MyResourceGroup',
'MyIoTHubAccount',
{
'location': 'westus',
'subscriptionid': subscription_id,
'resourcegroup': 'MyResourceGroup',
'sku': {
'name': 'S1',
'capacity': 2
},
'properties': {
'enable_file_upload_notifications': False,
'operations_monitoring_properties': {
'events': {
"C2DCommands": "Error",
"DeviceTelemetry": "Error",
"DeviceIdentityOperations": "Error",
"Connections": "Information"
}
},
"features": "None",
}
}
)
iothub = async_iot_hub.result() # Blocking wait for creation
Loading

0 comments on commit cf9b2f3

Please sign in to comment.