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
25 changes: 3 additions & 22 deletions azure-mgmt-automation/azure/mgmt/automation/automation_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,16 @@ class AutomationClientConfiguration(AzureConfiguration):
identify Microsoft Azure subscription. The subscription ID forms part of
the URI for every service call.
:type subscription_id: str
:param resource_group_name: The resource group name.
:type resource_group_name: str
:param client_request_id: Identifies this specific client request.
:type client_request_id: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, resource_group_name, automation_account_name, client_request_id=None, base_url=None):
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if resource_group_name is None:
raise ValueError("Parameter 'resource_group_name' must not be None.")
if automation_account_name is None:
raise ValueError("Parameter 'automation_account_name' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

Expand All @@ -94,9 +84,6 @@ def __init__(

self.credentials = credentials
self.subscription_id = subscription_id
self.resource_group_name = resource_group_name
self.client_request_id = client_request_id
self.automation_account_name = automation_account_name


class AutomationClient(object):
Expand Down Expand Up @@ -185,19 +172,13 @@ class AutomationClient(object):
identify Microsoft Azure subscription. The subscription ID forms part of
the URI for every service call.
:type subscription_id: str
:param resource_group_name: The resource group name.
:type resource_group_name: str
:param client_request_id: Identifies this specific client request.
:type client_request_id: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, resource_group_name, automation_account_name, client_request_id=None, base_url=None):
self, credentials, subscription_id, base_url=None):

self.config = AutomationClientConfiguration(credentials, subscription_id, resource_group_name, automation_account_name, client_request_id, base_url)
self.config = AutomationClientConfiguration(credentials, subscription_id, base_url)
self._client = ServiceClient(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def get(
self, automation_account_name, module_name, activity_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, module_name, activity_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve the activity in the module identified by module name and
activity name.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param module_name: The name of module.
Expand All @@ -61,7 +63,7 @@ def get(
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'moduleName': self._serialize.url("module_name", module_name, 'str'),
'activityName': self._serialize.url("activity_name", activity_name, 'str'),
Expand Down Expand Up @@ -103,9 +105,11 @@ def get(
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}'}

def list_by_module(
self, automation_account_name, module_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, module_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve a list of activities in the module identified by module name.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param module_name: The name of module.
Expand All @@ -127,7 +131,7 @@ def internal_paging(next_link=None, raw=False):
# Construct URL
url = self.list_by_module.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'moduleName': self._serialize.url("module_name", module_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def get(
self, automation_account_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve the automation agent registration information.

:param resource_group_name: The resource group name.
:type resource_group_name: str
: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
Expand All @@ -56,7 +58,7 @@ def get(
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", 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')
}
Expand Down Expand Up @@ -96,9 +98,11 @@ def get(
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation'}

def regenerate_key(
self, automation_account_name, parameters, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, parameters, custom_headers=None, raw=False, **operation_config):
"""Regenerate a primary or secondary agent registration key.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param parameters: The name of the agent registration key to be
Expand All @@ -119,7 +123,7 @@ def regenerate_key(
# Construct URL
url = self.regenerate_key.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", 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')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ def __init__(self, client, config, serializer, deserializer):
self.config = config

def delete(
self, automation_account_name, certificate_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, certificate_name, custom_headers=None, raw=False, **operation_config):
"""Delete the certificate.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param certificate_name: The name of certificate.
Expand All @@ -57,7 +59,7 @@ def delete(
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down Expand Up @@ -91,9 +93,11 @@ def delete(
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'}

def get(
self, automation_account_name, certificate_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, certificate_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve the certificate identified by certificate name.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param certificate_name: The name of certificate.
Expand All @@ -112,7 +116,7 @@ def get(
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down Expand Up @@ -153,9 +157,11 @@ def get(
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'}

def create_or_update(
self, automation_account_name, certificate_name, parameters, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, certificate_name, parameters, custom_headers=None, raw=False, **operation_config):
"""Create a certificate.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the create or
Expand All @@ -179,7 +185,7 @@ def create_or_update(
# Construct URL
url = self.create_or_update.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down Expand Up @@ -226,9 +232,11 @@ def create_or_update(
create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'}

def update(
self, automation_account_name, certificate_name, name=None, description=None, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, certificate_name, name=None, description=None, custom_headers=None, raw=False, **operation_config):
"""Update a certificate.

:param resource_group_name: The resource group name.
:type resource_group_name: str
:param automation_account_name: The automation account name.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the update
Expand All @@ -254,7 +262,7 @@ def update(
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'resourceGroupName': self._serialize.url("self.config.resource_group_name", self.config.resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[-\w\._]+$'),
'automationAccountName': self._serialize.url("automation_account_name", automation_account_name, 'str'),
'certificateName': self._serialize.url("certificate_name", certificate_name, 'str'),
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
Expand Down Expand Up @@ -299,9 +307,11 @@ def update(
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}'}

def list_by_automation_account(
self, automation_account_name, custom_headers=None, raw=False, **operation_config):
self, resource_group_name, automation_account_name, custom_headers=None, raw=False, **operation_config):
"""Retrieve a list of certificates.

:param resource_group_name: The resource group name.
:type resource_group_name: str
: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
Expand All @@ -321,7 +331,7 @@ def internal_paging(next_link=None, raw=False):
# 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\._]+$'),
'resourceGroupName': self._serialize.url("resource_group_name", 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')
}
Expand Down
Loading