Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .operations.operations import Operations
from .operations.statistics_operations import StatisticsOperations
from .operations.usages_operations import UsagesOperations
from .operations.keys_operations import KeysOperations
from .operations.certificate_operations import CertificateOperations
from .operations.connection_operations import ConnectionOperations
from .operations.connection_type_operations import ConnectionTypeOperations
Expand Down Expand Up @@ -113,6 +114,8 @@ class AutomationClient(object):
:vartype statistics: azure.mgmt.automation.operations.StatisticsOperations
:ivar usages: Usages operations
:vartype usages: azure.mgmt.automation.operations.UsagesOperations
:ivar keys: Keys operations
:vartype keys: azure.mgmt.automation.operations.KeysOperations
:ivar certificate: Certificate operations
:vartype certificate: azure.mgmt.automation.operations.CertificateOperations
:ivar connection: Connection operations
Expand Down Expand Up @@ -212,6 +215,8 @@ def __init__(
self._client, self.config, self._serialize, self._deserialize)
self.usages = UsagesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.keys = KeysOperations(
self._client, self.config, self._serialize, self._deserialize)
self.certificate = CertificateOperations(
self._client, self.config, self._serialize, self._deserialize)
self.connection = ConnectionOperations(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# --------------------------------------------------------------------------

from .error_response import ErrorResponse, ErrorResponseException
from .key import Key
from .usage_counter_name import UsageCounterName
from .usage import Usage
from .statistics import Statistics
Expand Down Expand Up @@ -128,6 +129,7 @@
from .operation_paged import OperationPaged
from .statistics_paged import StatisticsPaged
from .usage_paged import UsagePaged
from .key_paged import KeyPaged
from .certificate_paged import CertificatePaged
from .connection_paged import ConnectionPaged
from .connection_type_paged import ConnectionTypePaged
Expand All @@ -151,6 +153,8 @@
from .source_control_sync_job_paged import SourceControlSyncJobPaged
from .job_collection_item_paged import JobCollectionItemPaged
from .automation_client_enums import (
AutomationKeyName,
AutomationKeyPermissions,
RunbookTypeEnum,
RunbookState,
RunbookProvisioningState,
Expand All @@ -176,6 +180,7 @@

__all__ = [
'ErrorResponse', 'ErrorResponseException',
'Key',
'UsageCounterName',
'Usage',
'Statistics',
Expand Down Expand Up @@ -294,6 +299,7 @@
'OperationPaged',
'StatisticsPaged',
'UsagePaged',
'KeyPaged',
'CertificatePaged',
'ConnectionPaged',
'ConnectionTypePaged',
Expand All @@ -316,6 +322,8 @@
'SourceControlPaged',
'SourceControlSyncJobPaged',
'JobCollectionItemPaged',
'AutomationKeyName',
'AutomationKeyPermissions',
'RunbookTypeEnum',
'RunbookState',
'RunbookProvisioningState',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
from enum import Enum


class AutomationKeyName(Enum):

primary = "primary"
secondary = "secondary"


class AutomationKeyPermissions(Enum):

full = "Full"


class RunbookTypeEnum(Enum):

script = "Script"
Expand Down
39 changes: 39 additions & 0 deletions azure-mgmt-automation/azure/mgmt/automation/models/key.py
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 msrest.serialization import Model


class Key(Model):
"""Automation key which is used to register a DSC Node.

:param key_name: Automation key name. Possible values include: 'primary',
'secondary'
:type key_name: str or ~azure.mgmt.automation.models.AutomationKeyName
:param permissions: Automation key permissions. Possible values include:
'Full'
:type permissions: str or
~azure.mgmt.automation.models.AutomationKeyPermissions
:param value: Value of the Automation Key used for registration.
:type value: str
"""

_attribute_map = {
'key_name': {'key': 'keyName', 'type': 'str'},
'permissions': {'key': 'permissions', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}

def __init__(self, key_name=None, permissions=None, value=None):
super(Key, self).__init__()
self.key_name = key_name
self.permissions = permissions
self.value = value
27 changes: 27 additions & 0 deletions azure-mgmt-automation/azure/mgmt/automation/models/key_paged.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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 msrest.paging import Paged


class KeyPaged(Paged):
"""
A paging container for iterating over a list of :class:`Key <azure.mgmt.automation.models.Key>` object
"""

_attribute_map = {
'next_link': {'key': 'nextLink', 'type': 'str'},
'current_page': {'key': 'value', 'type': '[Key]'}
}

def __init__(self, *args, **kwargs):

super(KeyPaged, self).__init__(*args, **kwargs)
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .operations import Operations
from .statistics_operations import StatisticsOperations
from .usages_operations import UsagesOperations
from .keys_operations import KeysOperations
from .certificate_operations import CertificateOperations
from .connection_operations import ConnectionOperations
from .connection_type_operations import ConnectionTypeOperations
Expand Down Expand Up @@ -51,6 +52,7 @@
'Operations',
'StatisticsOperations',
'UsagesOperations',
'KeysOperations',
'CertificateOperations',
'ConnectionOperations',
'ConnectionTypeOperations',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# 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 uuid
from msrest.pipeline import ClientRawResponse

from .. import models


class KeysOperations(object):
"""KeysOperations operations.

:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client Api Version. Constant value: "2015-10-31".
"""

models = models

def __init__(self, client, config, serializer, deserializer):

self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2015-10-31"

self.config = config

def list_by_automation_account(
self, automation_account_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve the automation keys for an account.

:param automation_account_name: The automation account name.
:type automation_account_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: An iterator like instance of Key
:rtype:
~azure.mgmt.automation.models.KeyPaged[~azure.mgmt.automation.models.Key]
:raises:
:class:`ErrorResponseException<azure.mgmt.automation.models.ErrorResponseException>`
"""
def internal_paging(next_link=None, raw=False):

if not next_link:
# Construct URL
url = self.list_by_automation_account.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)

# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')

else:
url = next_link
query_parameters = {}

# Construct headers
header_parameters = {}
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

# Construct and send request
request = self._client.post(url, query_parameters)
response = self._client.send(
request, header_parameters, stream=False, **operation_config)

if response.status_code not in [200]:
raise models.ErrorResponseException(self._deserialize, response)

return response

# Deserialize response
deserialized = models.KeyPaged(internal_paging, self._deserialize.dependencies)

if raw:
header_dict = {}
client_raw_response = models.KeyPaged(internal_paging, self._deserialize.dependencies, header_dict)
return client_raw_response

return deserialized
list_by_automation_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys'}