diff --git a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py index ee2419bff489..4a18da92a74f 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/automation_client.py +++ b/azure-mgmt-automation/azure/mgmt/automation/automation_client.py @@ -45,6 +45,8 @@ from .operations.software_update_configurations_operations import SoftwareUpdateConfigurationsOperations from .operations.software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations from .operations.software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations +from .operations.source_control_operations import SourceControlOperations +from .operations.source_control_sync_job_operations import SourceControlSyncJobOperations from . import models @@ -165,6 +167,10 @@ class AutomationClient(object): :vartype software_update_configuration_runs: azure.mgmt.automation.operations.SoftwareUpdateConfigurationRunsOperations :ivar software_update_configuration_machine_runs: SoftwareUpdateConfigurationMachineRuns operations :vartype software_update_configuration_machine_runs: azure.mgmt.automation.operations.SoftwareUpdateConfigurationMachineRunsOperations + :ivar source_control: SourceControl operations + :vartype source_control: azure.mgmt.automation.operations.SourceControlOperations + :ivar source_control_sync_job: SourceControlSyncJob operations + :vartype source_control_sync_job: azure.mgmt.automation.operations.SourceControlSyncJobOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -256,3 +262,7 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.software_update_configuration_machine_runs = SoftwareUpdateConfigurationMachineRunsOperations( self._client, self.config, self._serialize, self._deserialize) + self.source_control = SourceControlOperations( + self._client, self.config, self._serialize, self._deserialize) + self.source_control_sync_job = SourceControlSyncJobOperations( + self._client, self.config, self._serialize, self._deserialize) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py index b91b358a83e8..8f07551154df 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/__init__.py @@ -26,9 +26,9 @@ from .content_source import ContentSource from .dsc_configuration_parameter import DscConfigurationParameter from .dsc_configuration import DscConfiguration +from .resource import Resource from .sku import Sku from .automation_account import AutomationAccount -from .resource import Resource from .operation_display import OperationDisplay from .operation import Operation from .automation_account_create_or_update_parameters import AutomationAccountCreateOrUpdateParameters @@ -112,6 +112,12 @@ from .job_navigation import JobNavigation from .software_update_configuration_machine_run import SoftwareUpdateConfigurationMachineRun from .software_update_configuration_machine_run_list_result import SoftwareUpdateConfigurationMachineRunListResult +from .source_control import SourceControl +from .source_control_update_parameters import SourceControlUpdateParameters +from .source_control_create_or_update_parameters import SourceControlCreateOrUpdateParameters +from .source_control_sync_job import SourceControlSyncJob +from .source_control_sync_job_by_id_errors import SourceControlSyncJobByIdErrors +from .source_control_sync_job_by_id import SourceControlSyncJobById from .automation_account_paged import AutomationAccountPaged from .operation_paged import OperationPaged from .statistics_paged import StatisticsPaged @@ -136,6 +142,8 @@ from .schedule_paged import SchedulePaged from .variable_paged import VariablePaged from .webhook_paged import WebhookPaged +from .source_control_paged import SourceControlPaged +from .source_control_sync_job_paged import SourceControlSyncJobPaged from .automation_client_enums import ( RunbookTypeEnum, RunbookState, @@ -155,6 +163,8 @@ LinuxUpdateClasses, WindowsUpdateClasses, OperatingSystemType, + SourceType, + ProvisioningState, ) __all__ = [ @@ -175,9 +185,9 @@ 'ContentSource', 'DscConfigurationParameter', 'DscConfiguration', + 'Resource', 'Sku', 'AutomationAccount', - 'Resource', 'OperationDisplay', 'Operation', 'AutomationAccountCreateOrUpdateParameters', @@ -261,6 +271,12 @@ 'JobNavigation', 'SoftwareUpdateConfigurationMachineRun', 'SoftwareUpdateConfigurationMachineRunListResult', + 'SourceControl', + 'SourceControlUpdateParameters', + 'SourceControlCreateOrUpdateParameters', + 'SourceControlSyncJob', + 'SourceControlSyncJobByIdErrors', + 'SourceControlSyncJobById', 'AutomationAccountPaged', 'OperationPaged', 'StatisticsPaged', @@ -285,6 +301,8 @@ 'SchedulePaged', 'VariablePaged', 'WebhookPaged', + 'SourceControlPaged', + 'SourceControlSyncJobPaged', 'RunbookTypeEnum', 'RunbookState', 'RunbookProvisioningState', @@ -303,4 +321,6 @@ 'LinuxUpdateClasses', 'WindowsUpdateClasses', 'OperatingSystemType', + 'SourceType', + 'ProvisioningState', ] diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py index d9616df42ca0..f6f43670331a 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/automation_client_enums.py @@ -215,3 +215,17 @@ class OperatingSystemType(Enum): windows = "Windows" linux = "Linux" + + +class SourceType(Enum): + + vso_git = "VsoGit" + vso_tfvc = "VsoTfvc" + git_hub = "GitHub" + + +class ProvisioningState(Enum): + + completed = "Completed" + failed = "Failed" + running = "Running" diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/certificate.py b/azure-mgmt-automation/azure/mgmt/automation/models/certificate.py index 39fbb98a84aa..dc40adb15e3f 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/certificate.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/certificate.py @@ -22,6 +22,8 @@ class Certificate(Model): :vartype id: str :ivar name: Gets the name of the certificate. :vartype name: str + :ivar type: Resource type + :vartype type: str :ivar thumbprint: Gets the thumbprint of the certificate. :vartype thumbprint: str :ivar expiry_time: Gets the expiry time of the certificate. @@ -39,6 +41,7 @@ class Certificate(Model): _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, + 'type': {'readonly': True}, 'thumbprint': {'readonly': True}, 'expiry_time': {'readonly': True}, 'is_exportable': {'readonly': True}, @@ -49,6 +52,7 @@ class Certificate(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'}, 'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'}, 'is_exportable': {'key': 'properties.isExportable', 'type': 'bool'}, @@ -61,6 +65,7 @@ def __init__(self, description=None): super(Certificate, self).__init__() self.id = None self.name = None + self.type = None self.thumbprint = None self.expiry_time = None self.is_exportable = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/certificate_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/certificate_update_parameters.py index 91c91a5c4968..4916b2e48c98 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/certificate_update_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/certificate_update_parameters.py @@ -21,16 +21,12 @@ class CertificateUpdateParameters(Model): :type description: str """ - _validation = { - 'name': {'required': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, name, description=None): + def __init__(self, name=None, description=None): super(CertificateUpdateParameters, self).__init__() self.name = name self.description = description diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/connection.py b/azure-mgmt-automation/azure/mgmt/automation/models/connection.py index 2ea09a1610a7..92c39c3ca915 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/connection.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/connection.py @@ -22,6 +22,8 @@ class Connection(Model): :vartype id: str :ivar name: Gets the name of the connection. :vartype name: str + :ivar type: Resource type + :vartype type: str :param connection_type: Gets or sets the connectionType of the connection. :type connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty @@ -39,6 +41,7 @@ class Connection(Model): _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, + 'type': {'readonly': True}, 'field_definition_values': {'readonly': True}, 'creation_time': {'readonly': True}, 'last_modified_time': {'readonly': True}, @@ -47,6 +50,7 @@ class Connection(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'connection_type': {'key': 'properties.connectionType', 'type': 'ConnectionTypeAssociationProperty'}, 'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, @@ -58,6 +62,7 @@ def __init__(self, connection_type=None, description=None): super(Connection, self).__init__() self.id = None self.name = None + self.type = None self.connection_type = connection_type self.field_definition_values = None self.creation_time = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/connection_type.py b/azure-mgmt-automation/azure/mgmt/automation/models/connection_type.py index ac1f0ab8c99a..e6bd11bf294a 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/connection_type.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/connection_type.py @@ -22,6 +22,8 @@ class ConnectionType(Model): :vartype id: str :ivar name: Gets the name of the connection type. :vartype name: str + :ivar type: Resource type + :vartype type: str :param is_global: Gets or sets a Boolean value to indicate if the connection type is global. :type is_global: bool @@ -40,6 +42,7 @@ class ConnectionType(Model): _validation = { 'id': {'readonly': True}, 'name': {'readonly': True}, + 'type': {'readonly': True}, 'field_definitions': {'readonly': True}, 'creation_time': {'readonly': True}, } @@ -47,6 +50,7 @@ class ConnectionType(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'is_global': {'key': 'properties.isGlobal', 'type': 'bool'}, 'field_definitions': {'key': 'properties.fieldDefinitions', 'type': '{FieldDefinition}'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, @@ -58,6 +62,7 @@ def __init__(self, is_global=None, last_modified_time=None, description=None): super(ConnectionType, self).__init__() self.id = None self.name = None + self.type = None self.is_global = is_global self.field_definitions = None self.creation_time = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/credential.py b/azure-mgmt-automation/azure/mgmt/automation/models/credential.py index c5ae1e8e14aa..402bfee28925 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/credential.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/credential.py @@ -20,8 +20,10 @@ class Credential(Model): :ivar id: Gets the id of the resource. :vartype id: str - :param name: Gets the name of the credential. - :type name: str + :ivar name: Gets the name of the credential. + :vartype name: str + :ivar type: Resource type + :vartype type: str :ivar user_name: Gets the user name of the credential. :vartype user_name: str :ivar creation_time: Gets the creation time. @@ -34,6 +36,8 @@ class Credential(Model): _validation = { 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'user_name': {'readonly': True}, 'creation_time': {'readonly': True}, 'last_modified_time': {'readonly': True}, @@ -42,16 +46,18 @@ class Credential(Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'user_name': {'key': 'properties.userName', 'type': 'str'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, name=None, description=None): + def __init__(self, description=None): super(Credential, self).__init__() self.id = None - self.name = name + self.name = None + self.type = None self.user_name = None self.creation_time = None self.last_modified_time = None diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/credential_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/credential_update_parameters.py index 674dd933651d..453536e10c41 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/credential_update_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/credential_update_parameters.py @@ -25,10 +25,6 @@ class CredentialUpdateParameters(Model): :type description: str """ - _validation = { - 'name': {'required': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'user_name': {'key': 'properties.userName', 'type': 'str'}, @@ -36,7 +32,7 @@ class CredentialUpdateParameters(Model): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, name, user_name=None, password=None, description=None): + def __init__(self, name=None, user_name=None, password=None, description=None): super(CredentialUpdateParameters, self).__init__() self.name = name self.user_name = user_name diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/job_schedule.py b/azure-mgmt-automation/azure/mgmt/automation/models/job_schedule.py index c934680ea80a..bfd4ef86b8f7 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/job_schedule.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/job_schedule.py @@ -15,8 +15,15 @@ class JobSchedule(Model): """Definition of the job schedule. - :param id: Gets or sets the id of the resource. - :type id: str + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Gets the id of the resource. + :vartype id: str + :ivar name: Gets the name of the variable. + :vartype name: str + :ivar type: Resource type + :vartype type: str :param job_schedule_id: Gets or sets the id of job schedule. :type job_schedule_id: str :param schedule: Gets or sets the schedule. @@ -30,8 +37,16 @@ class JobSchedule(Model): :type parameters: dict[str, str] """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'job_schedule_id': {'key': 'properties.jobScheduleId', 'type': 'str'}, 'schedule': {'key': 'properties.schedule', 'type': 'ScheduleAssociationProperty'}, 'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'}, @@ -39,9 +54,11 @@ class JobSchedule(Model): 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, } - def __init__(self, id=None, job_schedule_id=None, schedule=None, runbook=None, run_on=None, parameters=None): + def __init__(self, job_schedule_id=None, schedule=None, runbook=None, run_on=None, parameters=None): super(JobSchedule, self).__init__() - self.id = id + self.id = None + self.name = None + self.type = None self.job_schedule_id = job_schedule_id self.schedule = schedule self.runbook = runbook diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/schedule.py b/azure-mgmt-automation/azure/mgmt/automation/models/schedule.py index 3f6844979b78..d166fe024b75 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/schedule.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/schedule.py @@ -18,10 +18,12 @@ class Schedule(Model): Variables are only populated by the server, and will be ignored when sending a request. - :param id: Gets or sets the id of the resource. - :type id: str - :param name: Gets or sets the name of the schedule. - :type name: str + :ivar id: Gets the id of the resource. + :vartype id: str + :ivar name: Gets name of the schedule. + :vartype name: str + :ivar type: Resource type + :vartype type: str :param start_time: Gets or sets the start time of the schedule. :type start_time: datetime :ivar start_time_offset_minutes: Gets the start time's offset in minutes. @@ -57,12 +59,16 @@ class Schedule(Model): """ _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, 'start_time_offset_minutes': {'readonly': True}, } _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, 'start_time_offset_minutes': {'key': 'properties.startTimeOffsetMinutes', 'type': 'float'}, 'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'}, @@ -79,10 +85,11 @@ class Schedule(Model): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, id=None, name=None, start_time=None, expiry_time=None, expiry_time_offset_minutes=None, is_enabled=False, next_run=None, next_run_offset_minutes=None, interval=None, frequency=None, time_zone=None, advanced_schedule=None, creation_time=None, last_modified_time=None, description=None): + def __init__(self, start_time=None, expiry_time=None, expiry_time_offset_minutes=None, is_enabled=False, next_run=None, next_run_offset_minutes=None, interval=None, frequency=None, time_zone=None, advanced_schedule=None, creation_time=None, last_modified_time=None, description=None): super(Schedule, self).__init__() - self.id = id - self.name = name + self.id = None + self.name = None + self.type = None self.start_time = start_time self.start_time_offset_minutes = None self.expiry_time = expiry_time diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/schedule_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/schedule_update_parameters.py index 84ca43d8062f..8d86a5ced2f8 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/schedule_update_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/schedule_update_parameters.py @@ -24,17 +24,13 @@ class ScheduleUpdateParameters(Model): :type is_enabled: bool """ - _validation = { - 'name': {'required': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, 'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'}, } - def __init__(self, name, description=None, is_enabled=None): + def __init__(self, name=None, description=None, is_enabled=None): super(ScheduleUpdateParameters, self).__init__() self.name = name self.description = description diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control.py new file mode 100644 index 000000000000..0d634777c7e4 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control.py @@ -0,0 +1,85 @@ +# 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 SourceControl(Model): + """Definition of the source control. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar id: Resource Id. + :vartype id: str + :ivar type: Resource type. + :vartype type: str + :param repo_url: Gets or sets the repo url of the source control. + :type repo_url: str + :param branch: Gets or sets the repo branch of the source control. Include + branch as empty string for VsoTfvc. + :type branch: str + :param folder_path: Gets or sets the folder path of the source control. + :type folder_path: str + :param auto_sync: Gets or sets auto async of the source control. Default + is false. + :type auto_sync: bool + :param publish_runbook: Gets or sets the auto publish of the source + control. Default is true. + :type publish_runbook: bool + :param source_type: The source type. Must be one of VsoGit, VsoTfvc, + GitHub. Possible values include: 'VsoGit', 'VsoTfvc', 'GitHub' + :type source_type: str or ~azure.mgmt.automation.models.SourceType + :param description: Gets or sets the description. + :type description: str + :param creation_time: Gets or sets the creation time. + :type creation_time: datetime + :param last_modified_time: Gets or sets the last modified time. + :type last_modified_time: datetime + """ + + _validation = { + 'name': {'readonly': True}, + 'id': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'repo_url': {'key': 'properties.repoUrl', 'type': 'str'}, + 'branch': {'key': 'properties.branch', 'type': 'str'}, + 'folder_path': {'key': 'properties.folderPath', 'type': 'str'}, + 'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'}, + 'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'}, + 'source_type': {'key': 'properties.sourceType', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, + } + + def __init__(self, repo_url=None, branch=None, folder_path=None, auto_sync=None, publish_runbook=None, source_type=None, description=None, creation_time=None, last_modified_time=None): + super(SourceControl, self).__init__() + self.name = None + self.id = None + self.type = None + self.repo_url = repo_url + self.branch = branch + self.folder_path = folder_path + self.auto_sync = auto_sync + self.publish_runbook = publish_runbook + self.source_type = source_type + self.description = description + self.creation_time = creation_time + self.last_modified_time = last_modified_time diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_create_or_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_create_or_update_parameters.py new file mode 100644 index 000000000000..cb2611af827a --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_create_or_update_parameters.py @@ -0,0 +1,72 @@ +# 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 SourceControlCreateOrUpdateParameters(Model): + """The parameters supplied to the create or update source control operation. + + :param repo_url: Gets or sets the repo url of the source control. + :type repo_url: str + :param branch: Gets or sets the repo branch of the source control. Include + branch as empty string for VsoTfvc. + :type branch: str + :param folder_path: Gets or sets the folder path of the source control. + Path must be relative. + :type folder_path: str + :param auto_sync: Gets or sets auto async of the source control. Default + is false. + :type auto_sync: bool + :param publish_runbook: Gets or sets the auto publish of the source + control. Default is true. + :type publish_runbook: bool + :param source_type: The source type. Must be one of VsoGit, VsoTfvc, + GitHub, case sensitive. Possible values include: 'VsoGit', 'VsoTfvc', + 'GitHub' + :type source_type: str or ~azure.mgmt.automation.models.SourceType + :param security_token: Gets or sets the authorization token for the repo + of the source control. + :type security_token: str + :param description: Gets or sets the user description of the source + control. + :type description: str + """ + + _validation = { + 'repo_url': {'max_length': 2000}, + 'branch': {'max_length': 255}, + 'folder_path': {'max_length': 255}, + 'security_token': {'max_length': 1024}, + 'description': {'max_length': 512}, + } + + _attribute_map = { + 'repo_url': {'key': 'properties.repoUrl', 'type': 'str'}, + 'branch': {'key': 'properties.branch', 'type': 'str'}, + 'folder_path': {'key': 'properties.folderPath', 'type': 'str'}, + 'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'}, + 'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'}, + 'source_type': {'key': 'properties.sourceType', 'type': 'str'}, + 'security_token': {'key': 'properties.securityToken', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, repo_url=None, branch=None, folder_path=None, auto_sync=None, publish_runbook=None, source_type=None, security_token=None, description=None): + super(SourceControlCreateOrUpdateParameters, self).__init__() + self.repo_url = repo_url + self.branch = branch + self.folder_path = folder_path + self.auto_sync = auto_sync + self.publish_runbook = publish_runbook + self.source_type = source_type + self.security_token = security_token + self.description = description diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_paged.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_paged.py new file mode 100644 index 000000000000..bf214640dd4e --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_paged.py @@ -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 SourceControlPaged(Paged): + """ + A paging container for iterating over a list of :class:`SourceControl ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SourceControl]'} + } + + def __init__(self, *args, **kwargs): + + super(SourceControlPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job.py new file mode 100644 index 000000000000..315cd69dcfa2 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job.py @@ -0,0 +1,74 @@ +# 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 SourceControlSyncJob(Model): + """Definition of the source control sync job. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar id: Resource id. + :vartype id: str + :param source_control_sync_job_id: Gets the source control sync job id. + :type source_control_sync_job_id: str + :ivar creation_time: Gets the creation time of the job. + :vartype creation_time: datetime + :param provisioning_state: Gets the provisioning state of the job. + Possible values include: 'Completed', 'Failed', 'Running' + :type provisioning_state: str or + ~azure.mgmt.automation.models.ProvisioningState + :ivar start_time: Gets the start time of the job. + :vartype start_time: datetime + :ivar end_time: Gets the end time of the job. + :vartype end_time: datetime + :param started_by: Gets the user who started the sync job. + :type started_by: str + """ + + _validation = { + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'id': {'readonly': True}, + 'creation_time': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, + 'started_by': {'key': 'properties.startedBy', 'type': 'str'}, + } + + def __init__(self, source_control_sync_job_id=None, provisioning_state=None, started_by=None): + super(SourceControlSyncJob, self).__init__() + self.name = None + self.type = None + self.id = None + self.source_control_sync_job_id = source_control_sync_job_id + self.creation_time = None + self.provisioning_state = provisioning_state + self.start_time = None + self.end_time = None + self.started_by = started_by diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id.py new file mode 100644 index 000000000000..f9b3e3c61ab2 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id.py @@ -0,0 +1,67 @@ +# 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 SourceControlSyncJobById(Model): + """Definition of the source control sync job. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param id: Gets the id of the job. + :type id: str + :param source_control_sync_job_id: Gets the source control sync job id. + :type source_control_sync_job_id: str + :ivar creation_time: Gets the creation time of the job. + :vartype creation_time: datetime + :param provisioning_state: Gets the provisioning state of the job. + Possible values include: 'Completed', 'Failed', 'Running' + :type provisioning_state: str or + ~azure.mgmt.automation.models.ProvisioningState + :ivar start_time: Gets the start time of the job. + :vartype start_time: datetime + :ivar end_time: Gets the end time of the job. + :vartype end_time: datetime + :param started_by: Gets the user who started the sync job. + :type started_by: str + :param errors: Error details of the source control sync job. + :type errors: ~azure.mgmt.automation.models.SourceControlSyncJobByIdErrors + """ + + _validation = { + 'creation_time': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'}, + 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'}, + 'started_by': {'key': 'properties.startedBy', 'type': 'str'}, + 'errors': {'key': 'properties.errors', 'type': 'SourceControlSyncJobByIdErrors'}, + } + + def __init__(self, id=None, source_control_sync_job_id=None, provisioning_state=None, started_by=None, errors=None): + super(SourceControlSyncJobById, self).__init__() + self.id = id + self.source_control_sync_job_id = source_control_sync_job_id + self.creation_time = None + self.provisioning_state = provisioning_state + self.start_time = None + self.end_time = None + self.started_by = started_by + self.errors = errors diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id_errors.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id_errors.py new file mode 100644 index 000000000000..ea2f7161d272 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_by_id_errors.py @@ -0,0 +1,32 @@ +# 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 SourceControlSyncJobByIdErrors(Model): + """Error details of the source control sync job. + + :param code: Gets the error code for the job. + :type code: str + :param message: Gets the error message for the job. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__(self, code=None, message=None): + super(SourceControlSyncJobByIdErrors, self).__init__() + self.code = code + self.message = message diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_paged.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_paged.py new file mode 100644 index 000000000000..db7622ff89a7 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_sync_job_paged.py @@ -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 SourceControlSyncJobPaged(Paged): + """ + A paging container for iterating over a list of :class:`SourceControlSyncJob ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[SourceControlSyncJob]'} + } + + def __init__(self, *args, **kwargs): + + super(SourceControlSyncJobPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/source_control_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_update_parameters.py new file mode 100644 index 000000000000..7cacc8d88618 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/models/source_control_update_parameters.py @@ -0,0 +1,53 @@ +# 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 SourceControlUpdateParameters(Model): + """The parameters supplied to the update source control operation. + + :param branch: Gets or sets the repo branch of the source control. + :type branch: str + :param folder_path: Gets or sets the folder path of the source control. + Path must be relative. + :type folder_path: str + :param auto_sync: Gets or sets auto async of the source control. Default + is false. + :type auto_sync: bool + :param publish_runbook: Gets or sets the auto publish of the source + control. Default is true. + :type publish_runbook: bool + :param security_token: Gets or sets the authorization token for the repo + of the source control. + :type security_token: str + :param description: Gets or sets the user description of the source + control. + :type description: str + """ + + _attribute_map = { + 'branch': {'key': 'properties.branch', 'type': 'str'}, + 'folder_path': {'key': 'properties.folderPath', 'type': 'str'}, + 'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'}, + 'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'}, + 'security_token': {'key': 'properties.securityToken', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + } + + def __init__(self, branch=None, folder_path=None, auto_sync=None, publish_runbook=None, security_token=None, description=None): + super(SourceControlUpdateParameters, self).__init__() + self.branch = branch + self.folder_path = folder_path + self.auto_sync = auto_sync + self.publish_runbook = publish_runbook + self.security_token = security_token + self.description = description diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/variable.py b/azure-mgmt-automation/azure/mgmt/automation/models/variable.py index 47aaa6561ed3..30ed2bbc49f6 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/variable.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/variable.py @@ -15,10 +15,15 @@ class Variable(Model): """Definition of the varible. - :param id: Gets or sets the id of the resource. - :type id: str - :param name: Gets or sets the name of the variable. - :type name: str + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar id: Gets the id of the resource. + :vartype id: str + :ivar name: Gets the name of the variable. + :vartype name: str + :ivar type: Resource type + :vartype type: str :param value: Gets or sets the value of the variable. :type value: str :param is_encrypted: Gets or sets the encrypted flag of the variable. @@ -31,9 +36,16 @@ class Variable(Model): :type description: str """ + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, 'value': {'key': 'properties.value', 'type': 'str'}, 'is_encrypted': {'key': 'properties.isEncrypted', 'type': 'bool'}, 'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'}, @@ -41,10 +53,11 @@ class Variable(Model): 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, id=None, name=None, value=None, is_encrypted=None, creation_time=None, last_modified_time=None, description=None): + def __init__(self, value=None, is_encrypted=None, creation_time=None, last_modified_time=None, description=None): super(Variable, self).__init__() - self.id = id - self.name = name + self.id = None + self.name = None + self.type = None self.value = value self.is_encrypted = is_encrypted self.creation_time = creation_time diff --git a/azure-mgmt-automation/azure/mgmt/automation/models/variable_update_parameters.py b/azure-mgmt-automation/azure/mgmt/automation/models/variable_update_parameters.py index 01382a03e625..50aba8250f6d 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/models/variable_update_parameters.py +++ b/azure-mgmt-automation/azure/mgmt/automation/models/variable_update_parameters.py @@ -23,17 +23,13 @@ class VariableUpdateParameters(Model): :type description: str """ - _validation = { - 'name': {'required': True}, - } - _attribute_map = { 'name': {'key': 'name', 'type': 'str'}, 'value': {'key': 'properties.value', 'type': 'str'}, 'description': {'key': 'properties.description', 'type': 'str'}, } - def __init__(self, name, value=None, description=None): + def __init__(self, name=None, value=None, description=None): super(VariableUpdateParameters, self).__init__() self.name = name self.value = value diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py index eda867cb2054..915e99f7c5ba 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/__init__.py @@ -41,6 +41,8 @@ from .software_update_configurations_operations import SoftwareUpdateConfigurationsOperations from .software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations from .software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations +from .source_control_operations import SourceControlOperations +from .source_control_sync_job_operations import SourceControlSyncJobOperations __all__ = [ 'AutomationAccountOperations', @@ -75,4 +77,6 @@ 'SoftwareUpdateConfigurationsOperations', 'SoftwareUpdateConfigurationRunsOperations', 'SoftwareUpdateConfigurationMachineRunsOperations', + 'SourceControlOperations', + 'SourceControlSyncJobOperations', ] diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/certificate_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/certificate_operations.py index 7d68fdb58ef3..df2eefbdd5d8 100644 --- a/azure-mgmt-automation/azure/mgmt/automation/operations/certificate_operations.py +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/certificate_operations.py @@ -223,7 +223,7 @@ def create_or_update( return deserialized def update( - self, automation_account_name, certificate_name, name, description=None, custom_headers=None, raw=False, **operation_config): + self, automation_account_name, certificate_name, name=None, description=None, custom_headers=None, raw=False, **operation_config): """Update a certificate. :param automation_account_name: The automation account name. diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_operations.py new file mode 100644 index 000000000000..4f3d5773c036 --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_operations.py @@ -0,0 +1,362 @@ +# 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 SourceControlOperations(object): + """SourceControlOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-15-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-15-preview" + + self.config = config + + def create_or_update( + self, automation_account_name, source_control_name, parameters, custom_headers=None, raw=False, **operation_config): + """Create a source control. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param parameters: The parameters supplied to the create or update + source control operation. + :type parameters: + ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters + :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`. + :return: SourceControl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.SourceControl or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_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') + + # 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 body + body_content = self._serialize.body(parameters, 'SourceControlCreateOrUpdateParameters') + + # Construct and send request + request = self._client.put(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200, 201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SourceControl', response) + if response.status_code == 201: + deserialized = self._deserialize('SourceControl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def update( + self, automation_account_name, source_control_name, parameters, custom_headers=None, raw=False, **operation_config): + """Update a source control. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param parameters: The parameters supplied to the update source + control operation. + :type parameters: + ~azure.mgmt.automation.models.SourceControlUpdateParameters + :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`. + :return: SourceControl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.SourceControl or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_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') + + # 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 body + body_content = self._serialize.body(parameters, 'SourceControlUpdateParameters') + + # Construct and send request + request = self._client.patch(url, query_parameters) + response = self._client.send( + request, header_parameters, body_content, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SourceControl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def delete( + self, automation_account_name, source_control_name, custom_headers=None, raw=False, **operation_config): + """Delete the source control. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The name of source control. + :type source_control_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`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_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') + + # 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.delete(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) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + + def get( + self, automation_account_name, source_control_name, custom_headers=None, raw=False, **operation_config): + """Retrieve the source control identified by source control name. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The name of source control. + :type source_control_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`. + :return: SourceControl or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.SourceControl or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_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') + + # 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.get(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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SourceControl', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_automation_account( + self, automation_account_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieve a list of source controls. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param filter: The filter to apply on the operation. + :type filter: 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`. + :return: An iterator like instance of SourceControl + :rtype: + ~azure.mgmt.automation.models.SourceControlPaged[~azure.mgmt.automation.models.SourceControl] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls' + 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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.get(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.SourceControlPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SourceControlPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized diff --git a/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_operations.py b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_operations.py new file mode 100644 index 000000000000..3c6e62d68c2d --- /dev/null +++ b/azure-mgmt-automation/azure/mgmt/automation/operations/source_control_sync_job_operations.py @@ -0,0 +1,239 @@ +# 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 SourceControlSyncJobOperations(object): + """SourceControlSyncJobOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An objec model deserializer. + :ivar api_version: Client Api Version. Constant value: "2017-05-15-preview". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2017-05-15-preview" + + self.config = config + + def create( + self, automation_account_name, source_control_name, source_control_sync_job_id, custom_headers=None, raw=False, **operation_config): + """Creates the sync job for a source control. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. + :type source_control_sync_job_id: 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`. + :return: SourceControlSyncJob or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJob or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_name, 'str'), + 'sourceControlSyncJobId': self._serialize.url("source_control_sync_job_id", source_control_sync_job_id, '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') + + # 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.put(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [201]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 201: + deserialized = self._deserialize('SourceControlSyncJob', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def get( + self, automation_account_name, source_control_name, source_control_sync_job_id, custom_headers=None, raw=False, **operation_config): + """Retrieve the source control sync job identified by job id. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param source_control_sync_job_id: The source control sync job id. + :type source_control_sync_job_id: 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`. + :return: SourceControlSyncJobById or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_name, 'str'), + 'sourceControlSyncJobId': self._serialize.url("source_control_sync_job_id", source_control_sync_job_id, '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') + + # 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.get(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) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('SourceControlSyncJobById', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def list_by_automation_account( + self, automation_account_name, source_control_name, filter=None, custom_headers=None, raw=False, **operation_config): + """Retrieve a list of source control sync jobs. + + :param automation_account_name: The automation account name. + :type automation_account_name: str + :param source_control_name: The source control name. + :type source_control_name: str + :param filter: The filter to apply on the operation. + :type filter: 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`. + :return: An iterator like instance of SourceControlSyncJob + :rtype: + ~azure.mgmt.automation.models.SourceControlSyncJobPaged[~azure.mgmt.automation.models.SourceControlSyncJob] + :raises: + :class:`ErrorResponseException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs' + 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'), + 'sourceControlName': self._serialize.url("source_control_name", source_control_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 = {} + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + 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.get(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.SourceControlSyncJobPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.SourceControlSyncJobPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized