diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details.py new file mode 100644 index 000000000000..c14e27cfaa95 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details.py @@ -0,0 +1,37 @@ +# 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 ApplicationClientDetails(Model): + """The application client details to track the entity creating/updating the + managed app resource. + + :param oid: The client Oid. + :type oid: str + :param puid: The client Puid + :type puid: str + :param application_id: The client application Id. + :type application_id: str + """ + + _attribute_map = { + 'oid': {'key': 'Oid', 'type': 'str'}, + 'puid': {'key': 'Puid', 'type': 'str'}, + 'application_id': {'key': 'ApplicationId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ApplicationClientDetails, self).__init__(**kwargs) + self.oid = kwargs.get('oid', None) + self.puid = kwargs.get('puid', None) + self.application_id = kwargs.get('application_id', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details_py3.py new file mode 100644 index 000000000000..17e5214005d8 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/application_client_details_py3.py @@ -0,0 +1,37 @@ +# 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 ApplicationClientDetails(Model): + """The application client details to track the entity creating/updating the + managed app resource. + + :param oid: The client Oid. + :type oid: str + :param puid: The client Puid + :type puid: str + :param application_id: The client application Id. + :type application_id: str + """ + + _attribute_map = { + 'oid': {'key': 'Oid', 'type': 'str'}, + 'puid': {'key': 'Puid', 'type': 'str'}, + 'application_id': {'key': 'ApplicationId', 'type': 'str'}, + } + + def __init__(self, *, oid: str=None, puid: str=None, application_id: str=None, **kwargs) -> None: + super(ApplicationClientDetails, self).__init__(**kwargs) + self.oid = oid + self.puid = puid + self.application_id = application_id diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies.py new file mode 100644 index 000000000000..70054f780b40 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies.py @@ -0,0 +1,41 @@ +# 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 JitAuthorizationPolicies(Model): + """The JIT authorization policies. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. The the principal id that will be granted + JIT access. + :type principal_id: str + :param role_definition_id: Required. The role definition id that will be + granted to the Principal. + :type role_definition_id: str + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'PrincipalId', 'type': 'str'}, + 'role_definition_id': {'key': 'RoleDefinitionId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JitAuthorizationPolicies, self).__init__(**kwargs) + self.principal_id = kwargs.get('principal_id', None) + self.role_definition_id = kwargs.get('role_definition_id', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies_py3.py new file mode 100644 index 000000000000..50b929882310 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_authorization_policies_py3.py @@ -0,0 +1,41 @@ +# 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 JitAuthorizationPolicies(Model): + """The JIT authorization policies. + + All required parameters must be populated in order to send to Azure. + + :param principal_id: Required. The the principal id that will be granted + JIT access. + :type principal_id: str + :param role_definition_id: Required. The role definition id that will be + granted to the Principal. + :type role_definition_id: str + """ + + _validation = { + 'principal_id': {'required': True}, + 'role_definition_id': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'PrincipalId', 'type': 'str'}, + 'role_definition_id': {'key': 'RoleDefinitionId', 'type': 'str'}, + } + + def __init__(self, *, principal_id: str, role_definition_id: str, **kwargs) -> None: + super(JitAuthorizationPolicies, self).__init__(**kwargs) + self.principal_id = principal_id + self.role_definition_id = role_definition_id diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition.py new file mode 100644 index 000000000000..74aba1e8a27b --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition.py @@ -0,0 +1,98 @@ +# 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 .resource import Resource + + +class JitRequestDefinition(Resource): + """Information about JIT request definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param application_resource_id: Required. The parent application id. + :type application_resource_id: str + :param publisher_tenant_id: The publisher tenant id. + :type publisher_tenant_id: str + :param jit_authorization_policies: Required. The JIT authorization + policies. + :type jit_authorization_policies: + list[~azure.mgmt.resource.managedapplications.models.JitAuthorizationPolicies] + :param jit_scheduling_policy: Required. The JIT request properties. + :type jit_scheduling_policy: + ~azure.mgmt.resource.managedapplications.models.JitRequestProperties + :ivar provisioning_state: The JIT request provisioning state. Possible + values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', + 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.resource.managedapplications.models.ProvisioningState + :ivar jit_request_state: The JIT request state. Possible values include: + 'NotSpecified', 'Pending', 'Approved', 'Denied', 'Failed', 'Canceled', + 'Expired', 'Timeout' + :vartype jit_request_state: str or + ~azure.mgmt.resource.managedapplications.models.JitRequestState + :param created_by: The client entity that created the JIT request. + :type created_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + :param updated_by: The client entity that last updated the JIT request. + :type updated_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'application_resource_id': {'required': True}, + 'jit_authorization_policies': {'required': True}, + 'jit_scheduling_policy': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'jit_request_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'application_resource_id': {'key': 'properties.ApplicationResourceId', 'type': 'str'}, + 'publisher_tenant_id': {'key': 'properties.PublisherTenantId', 'type': 'str'}, + 'jit_authorization_policies': {'key': 'properties.JitAuthorizationPolicies', 'type': '[JitAuthorizationPolicies]'}, + 'jit_scheduling_policy': {'key': 'properties.JitSchedulingPolicy', 'type': 'JitRequestProperties'}, + 'provisioning_state': {'key': 'properties.ProvisioningState', 'type': 'str'}, + 'jit_request_state': {'key': 'properties.JitRequestState', 'type': 'str'}, + 'created_by': {'key': 'properties.CreatedBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'properties.UpdatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__(self, **kwargs): + super(JitRequestDefinition, self).__init__(**kwargs) + self.application_resource_id = kwargs.get('application_resource_id', None) + self.publisher_tenant_id = kwargs.get('publisher_tenant_id', None) + self.jit_authorization_policies = kwargs.get('jit_authorization_policies', None) + self.jit_scheduling_policy = kwargs.get('jit_scheduling_policy', None) + self.provisioning_state = None + self.jit_request_state = None + self.created_by = kwargs.get('created_by', None) + self.updated_by = kwargs.get('updated_by', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result.py new file mode 100644 index 000000000000..5b197da1ef7d --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result.py @@ -0,0 +1,33 @@ +# 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 JitRequestDefinitionListResult(Model): + """List of managed applications. + + :param value: The array of Jit request definition. + :type value: + list[~azure.mgmt.resource.managedapplications.models.JitRequestDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JitRequestDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JitRequestDefinitionListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result_py3.py new file mode 100644 index 000000000000..d3f382a15126 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_list_result_py3.py @@ -0,0 +1,33 @@ +# 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 JitRequestDefinitionListResult(Model): + """List of managed applications. + + :param value: The array of Jit request definition. + :type value: + list[~azure.mgmt.resource.managedapplications.models.JitRequestDefinition] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[JitRequestDefinition]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, *, value=None, next_link: str=None, **kwargs) -> None: + super(JitRequestDefinitionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_py3.py new file mode 100644 index 000000000000..964120973d31 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_definition_py3.py @@ -0,0 +1,98 @@ +# 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 .resource_py3 import Resource + + +class JitRequestDefinition(Resource): + """Information about JIT request definition. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Resource ID + :vartype id: str + :ivar name: Resource name + :vartype name: str + :ivar type: Resource type + :vartype type: str + :param location: Resource location + :type location: str + :param tags: Resource tags + :type tags: dict[str, str] + :param application_resource_id: Required. The parent application id. + :type application_resource_id: str + :param publisher_tenant_id: The publisher tenant id. + :type publisher_tenant_id: str + :param jit_authorization_policies: Required. The JIT authorization + policies. + :type jit_authorization_policies: + list[~azure.mgmt.resource.managedapplications.models.JitAuthorizationPolicies] + :param jit_scheduling_policy: Required. The JIT request properties. + :type jit_scheduling_policy: + ~azure.mgmt.resource.managedapplications.models.JitRequestProperties + :ivar provisioning_state: The JIT request provisioning state. Possible + values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', + 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.resource.managedapplications.models.ProvisioningState + :ivar jit_request_state: The JIT request state. Possible values include: + 'NotSpecified', 'Pending', 'Approved', 'Denied', 'Failed', 'Canceled', + 'Expired', 'Timeout' + :vartype jit_request_state: str or + ~azure.mgmt.resource.managedapplications.models.JitRequestState + :param created_by: The client entity that created the JIT request. + :type created_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + :param updated_by: The client entity that last updated the JIT request. + :type updated_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'application_resource_id': {'required': True}, + 'jit_authorization_policies': {'required': True}, + 'jit_scheduling_policy': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'jit_request_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'application_resource_id': {'key': 'properties.ApplicationResourceId', 'type': 'str'}, + 'publisher_tenant_id': {'key': 'properties.PublisherTenantId', 'type': 'str'}, + 'jit_authorization_policies': {'key': 'properties.JitAuthorizationPolicies', 'type': '[JitAuthorizationPolicies]'}, + 'jit_scheduling_policy': {'key': 'properties.JitSchedulingPolicy', 'type': 'JitRequestProperties'}, + 'provisioning_state': {'key': 'properties.ProvisioningState', 'type': 'str'}, + 'jit_request_state': {'key': 'properties.JitRequestState', 'type': 'str'}, + 'created_by': {'key': 'properties.CreatedBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'properties.UpdatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__(self, *, application_resource_id: str, jit_authorization_policies, jit_scheduling_policy, location: str=None, tags=None, publisher_tenant_id: str=None, created_by=None, updated_by=None, **kwargs) -> None: + super(JitRequestDefinition, self).__init__(location=location, tags=tags, **kwargs) + self.application_resource_id = application_resource_id + self.publisher_tenant_id = publisher_tenant_id + self.jit_authorization_policies = jit_authorization_policies + self.jit_scheduling_policy = jit_scheduling_policy + self.provisioning_state = None + self.jit_request_state = None + self.created_by = created_by + self.updated_by = updated_by diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata.py new file mode 100644 index 000000000000..96325e36acc2 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata.py @@ -0,0 +1,40 @@ +# 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 JitRequestMetadata(Model): + """The JIT request metadata. + + :param origin_request_id: The JIT request id. + :type origin_request_id: str + :param requestor_id: The publisher tenant requestor id. + :type requestor_id: str + :param tenant_display_name: The publisher tenant name. + :type tenant_display_name: str + :param subject_display_name: The publisher subject display name. + :type subject_display_name: str + """ + + _attribute_map = { + 'origin_request_id': {'key': 'OriginRequestId', 'type': 'str'}, + 'requestor_id': {'key': 'RequestorId', 'type': 'str'}, + 'tenant_display_name': {'key': 'TenantDisplayName', 'type': 'str'}, + 'subject_display_name': {'key': 'SubjectDisplayName', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JitRequestMetadata, self).__init__(**kwargs) + self.origin_request_id = kwargs.get('origin_request_id', None) + self.requestor_id = kwargs.get('requestor_id', None) + self.tenant_display_name = kwargs.get('tenant_display_name', None) + self.subject_display_name = kwargs.get('subject_display_name', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata_py3.py new file mode 100644 index 000000000000..8601eb210e30 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_metadata_py3.py @@ -0,0 +1,40 @@ +# 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 JitRequestMetadata(Model): + """The JIT request metadata. + + :param origin_request_id: The JIT request id. + :type origin_request_id: str + :param requestor_id: The publisher tenant requestor id. + :type requestor_id: str + :param tenant_display_name: The publisher tenant name. + :type tenant_display_name: str + :param subject_display_name: The publisher subject display name. + :type subject_display_name: str + """ + + _attribute_map = { + 'origin_request_id': {'key': 'OriginRequestId', 'type': 'str'}, + 'requestor_id': {'key': 'RequestorId', 'type': 'str'}, + 'tenant_display_name': {'key': 'TenantDisplayName', 'type': 'str'}, + 'subject_display_name': {'key': 'SubjectDisplayName', 'type': 'str'}, + } + + def __init__(self, *, origin_request_id: str=None, requestor_id: str=None, tenant_display_name: str=None, subject_display_name: str=None, **kwargs) -> None: + super(JitRequestMetadata, self).__init__(**kwargs) + self.origin_request_id = origin_request_id + self.requestor_id = requestor_id + self.tenant_display_name = tenant_display_name + self.subject_display_name = subject_display_name diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties.py new file mode 100644 index 000000000000..8483ed7c38de --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties.py @@ -0,0 +1,80 @@ +# 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 JitRequestProperties(Model): + """Information about JIT request properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param application_resource_id: Required. The parent application id. + :type application_resource_id: str + :param publisher_tenant_id: The publisher tenant id. + :type publisher_tenant_id: str + :param jit_authorization_policies: Required. The JIT authorization + policies. + :type jit_authorization_policies: + list[~azure.mgmt.resource.managedapplications.models.JitAuthorizationPolicies] + :param jit_scheduling_policy: Required. The JIT request properties. + :type jit_scheduling_policy: + ~azure.mgmt.resource.managedapplications.models.JitRequestProperties + :ivar provisioning_state: The JIT request provisioning state. Possible + values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', + 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.resource.managedapplications.models.ProvisioningState + :ivar jit_request_state: The JIT request state. Possible values include: + 'NotSpecified', 'Pending', 'Approved', 'Denied', 'Failed', 'Canceled', + 'Expired', 'Timeout' + :vartype jit_request_state: str or + ~azure.mgmt.resource.managedapplications.models.JitRequestState + :param created_by: The client entity that created the JIT request. + :type created_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + :param updated_by: The client entity that last updated the JIT request. + :type updated_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + """ + + _validation = { + 'application_resource_id': {'required': True}, + 'jit_authorization_policies': {'required': True}, + 'jit_scheduling_policy': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'jit_request_state': {'readonly': True}, + } + + _attribute_map = { + 'application_resource_id': {'key': 'ApplicationResourceId', 'type': 'str'}, + 'publisher_tenant_id': {'key': 'PublisherTenantId', 'type': 'str'}, + 'jit_authorization_policies': {'key': 'JitAuthorizationPolicies', 'type': '[JitAuthorizationPolicies]'}, + 'jit_scheduling_policy': {'key': 'JitSchedulingPolicy', 'type': 'JitRequestProperties'}, + 'provisioning_state': {'key': 'ProvisioningState', 'type': 'str'}, + 'jit_request_state': {'key': 'JitRequestState', 'type': 'str'}, + 'created_by': {'key': 'CreatedBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'UpdatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__(self, **kwargs): + super(JitRequestProperties, self).__init__(**kwargs) + self.application_resource_id = kwargs.get('application_resource_id', None) + self.publisher_tenant_id = kwargs.get('publisher_tenant_id', None) + self.jit_authorization_policies = kwargs.get('jit_authorization_policies', None) + self.jit_scheduling_policy = kwargs.get('jit_scheduling_policy', None) + self.provisioning_state = None + self.jit_request_state = None + self.created_by = kwargs.get('created_by', None) + self.updated_by = kwargs.get('updated_by', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties_py3.py new file mode 100644 index 000000000000..108c0d69c3df --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_request_properties_py3.py @@ -0,0 +1,80 @@ +# 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 JitRequestProperties(Model): + """Information about JIT request properties. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :param application_resource_id: Required. The parent application id. + :type application_resource_id: str + :param publisher_tenant_id: The publisher tenant id. + :type publisher_tenant_id: str + :param jit_authorization_policies: Required. The JIT authorization + policies. + :type jit_authorization_policies: + list[~azure.mgmt.resource.managedapplications.models.JitAuthorizationPolicies] + :param jit_scheduling_policy: Required. The JIT request properties. + :type jit_scheduling_policy: + ~azure.mgmt.resource.managedapplications.models.JitRequestProperties + :ivar provisioning_state: The JIT request provisioning state. Possible + values include: 'Accepted', 'Running', 'Ready', 'Creating', 'Created', + 'Deleting', 'Deleted', 'Canceled', 'Failed', 'Succeeded', 'Updating' + :vartype provisioning_state: str or + ~azure.mgmt.resource.managedapplications.models.ProvisioningState + :ivar jit_request_state: The JIT request state. Possible values include: + 'NotSpecified', 'Pending', 'Approved', 'Denied', 'Failed', 'Canceled', + 'Expired', 'Timeout' + :vartype jit_request_state: str or + ~azure.mgmt.resource.managedapplications.models.JitRequestState + :param created_by: The client entity that created the JIT request. + :type created_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + :param updated_by: The client entity that last updated the JIT request. + :type updated_by: + ~azure.mgmt.resource.managedapplications.models.ApplicationClientDetails + """ + + _validation = { + 'application_resource_id': {'required': True}, + 'jit_authorization_policies': {'required': True}, + 'jit_scheduling_policy': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'jit_request_state': {'readonly': True}, + } + + _attribute_map = { + 'application_resource_id': {'key': 'ApplicationResourceId', 'type': 'str'}, + 'publisher_tenant_id': {'key': 'PublisherTenantId', 'type': 'str'}, + 'jit_authorization_policies': {'key': 'JitAuthorizationPolicies', 'type': '[JitAuthorizationPolicies]'}, + 'jit_scheduling_policy': {'key': 'JitSchedulingPolicy', 'type': 'JitRequestProperties'}, + 'provisioning_state': {'key': 'ProvisioningState', 'type': 'str'}, + 'jit_request_state': {'key': 'JitRequestState', 'type': 'str'}, + 'created_by': {'key': 'CreatedBy', 'type': 'ApplicationClientDetails'}, + 'updated_by': {'key': 'UpdatedBy', 'type': 'ApplicationClientDetails'}, + } + + def __init__(self, *, application_resource_id: str, jit_authorization_policies, jit_scheduling_policy, publisher_tenant_id: str=None, created_by=None, updated_by=None, **kwargs) -> None: + super(JitRequestProperties, self).__init__(**kwargs) + self.application_resource_id = application_resource_id + self.publisher_tenant_id = publisher_tenant_id + self.jit_authorization_policies = jit_authorization_policies + self.jit_scheduling_policy = jit_scheduling_policy + self.provisioning_state = None + self.jit_request_state = None + self.created_by = created_by + self.updated_by = updated_by diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy.py new file mode 100644 index 000000000000..e21b6d582de6 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy.py @@ -0,0 +1,46 @@ +# 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 JitSchedulingPolicy(Model): + """The JIT scheduling policies. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of JIT schedule. Possible values include: + 'NotSpecified', 'Once', 'Recurring' + :type type: str or + ~azure.mgmt.resource.managedapplications.models.JitSchedulingType + :param duration: Required. The required duration of the JIT request. + :type duration: timedelta + :param start_time: Required. The start time of the request. + :type start_time: datetime + """ + + _validation = { + 'type': {'required': True}, + 'duration': {'required': True}, + 'start_time': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'Type', 'type': 'str'}, + 'duration': {'key': 'Duration', 'type': 'duration'}, + 'start_time': {'key': 'StartTime', 'type': 'iso-8601'}, + } + + def __init__(self, **kwargs): + super(JitSchedulingPolicy, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.duration = kwargs.get('duration', None) + self.start_time = kwargs.get('start_time', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy_py3.py new file mode 100644 index 000000000000..5de4ec1e3f21 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_scheduling_policy_py3.py @@ -0,0 +1,46 @@ +# 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 JitSchedulingPolicy(Model): + """The JIT scheduling policies. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of JIT schedule. Possible values include: + 'NotSpecified', 'Once', 'Recurring' + :type type: str or + ~azure.mgmt.resource.managedapplications.models.JitSchedulingType + :param duration: Required. The required duration of the JIT request. + :type duration: timedelta + :param start_time: Required. The start time of the request. + :type start_time: datetime + """ + + _validation = { + 'type': {'required': True}, + 'duration': {'required': True}, + 'start_time': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'Type', 'type': 'str'}, + 'duration': {'key': 'Duration', 'type': 'duration'}, + 'start_time': {'key': 'StartTime', 'type': 'iso-8601'}, + } + + def __init__(self, *, type, duration, start_time, **kwargs) -> None: + super(JitSchedulingPolicy, self).__init__(**kwargs) + self.type = type + self.duration = duration + self.start_time = start_time diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition.py new file mode 100644 index 000000000000..66de69d50ca4 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition.py @@ -0,0 +1,44 @@ +# 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 JitUpdateAccessDefinition(Model): + """The JIT update access definition. + + :param approver: The approver name. + :type approver: str + :param metadata: + :type metadata: object + :param status: The JIT status. Possible values include: 'NotSpecified', + 'Elevate', 'Remove' + :type status: str or + ~azure.mgmt.resource.managedapplications.models.JITStatusUpdate + :param sub_status: The JIT sub-status. Possible values include: + 'NotSpecified', 'Approved', 'Denied', 'Failed', 'Expired', 'Timeout' + :type sub_status: str or + ~azure.mgmt.resource.managedapplications.models.JITSubStatus + """ + + _attribute_map = { + 'approver': {'key': 'Approver', 'type': 'str'}, + 'metadata': {'key': 'Metadata', 'type': 'object'}, + 'status': {'key': 'Status', 'type': 'str'}, + 'sub_status': {'key': 'SubStatus', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(JitUpdateAccessDefinition, self).__init__(**kwargs) + self.approver = kwargs.get('approver', None) + self.metadata = kwargs.get('metadata', None) + self.status = kwargs.get('status', None) + self.sub_status = kwargs.get('sub_status', None) diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition_py3.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition_py3.py new file mode 100644 index 000000000000..0e064ebf37d2 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/models/jit_update_access_definition_py3.py @@ -0,0 +1,44 @@ +# 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 JitUpdateAccessDefinition(Model): + """The JIT update access definition. + + :param approver: The approver name. + :type approver: str + :param metadata: + :type metadata: object + :param status: The JIT status. Possible values include: 'NotSpecified', + 'Elevate', 'Remove' + :type status: str or + ~azure.mgmt.resource.managedapplications.models.JITStatusUpdate + :param sub_status: The JIT sub-status. Possible values include: + 'NotSpecified', 'Approved', 'Denied', 'Failed', 'Expired', 'Timeout' + :type sub_status: str or + ~azure.mgmt.resource.managedapplications.models.JITSubStatus + """ + + _attribute_map = { + 'approver': {'key': 'Approver', 'type': 'str'}, + 'metadata': {'key': 'Metadata', 'type': 'object'}, + 'status': {'key': 'Status', 'type': 'str'}, + 'sub_status': {'key': 'SubStatus', 'type': 'str'}, + } + + def __init__(self, *, approver: str=None, metadata=None, status=None, sub_status=None, **kwargs) -> None: + super(JitUpdateAccessDefinition, self).__init__(**kwargs) + self.approver = approver + self.metadata = metadata + self.status = status + self.sub_status = sub_status diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/jit_requests_operations.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/jit_requests_operations.py new file mode 100644 index 000000000000..4559b2bc6c76 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/jit_requests_operations.py @@ -0,0 +1,334 @@ +# 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 JitRequestsOperations(object): + """JitRequestsOperations 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: The API version to use for this operation. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + def get_by_name( + self, resource_group_name, jit_request_name, custom_headers=None, raw=False, **operation_config): + """Gets the JIT request. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_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: JitRequestDefinition or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.managedapplications.models.JitRequestDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get_by_name.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'jitRequestName': self._serialize.url("jit_request_name", jit_request_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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JitRequestDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_by_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} + + def create_or_update( + self, resource_group_name, jit_request_name, custom_headers=None, raw=False, **operation_config): + """Creates or updates the JIT request. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_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: JitRequestDefinition or ClientRawResponse if raw=true + :rtype: + ~azure.mgmt.resource.managedapplications.models.JitRequestDefinition + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'jitRequestName': self._serialize.url("jit_request_name", jit_request_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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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('JitRequestDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} + + def delete( + self, resource_group_name, jit_request_name, custom_headers=None, raw=False, **operation_config): + """Deletes the JIT request. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param jit_request_name: The name of the JIT request. + :type jit_request_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 = self.delete.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'jitRequestName': self._serialize.url("jit_request_name", jit_request_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 = {} + 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, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}'} + + def list_by_subscription( + self, custom_headers=None, raw=False, **operation_config): + """Retrieves all JIT requests within the subscription. + + :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: JitRequestDefinitionListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.resource.managedapplications.models.JitRequestDefinitionListResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_subscription.metadata['url'] + path_format_arguments = { + '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JitRequestDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Solutions/jitRequests'} + + def list_by_resource_group( + self, resource_group_name, custom_headers=None, raw=False, **operation_config): + """Retrieves all JIT requests within the subscription. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_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: JitRequestDefinitionListResult or ClientRawResponse if + raw=true + :rtype: + ~azure.mgmt.resource.managedapplications.models.JitRequestDefinitionListResult + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.list_by_resource_group.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 404]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('JitRequestDefinitionListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests'} diff --git a/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/update_access_operations.py b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/update_access_operations.py new file mode 100644 index 000000000000..8824449f5233 --- /dev/null +++ b/azure-mgmt-resource/azure/mgmt/resource/managedapplications/operations/update_access_operations.py @@ -0,0 +1,133 @@ +# 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 msrest.polling import LROPoller, NoPolling +from msrestazure.polling.arm_polling import ARMPolling + +from .. import models + + +class UpdateAccessOperations(object): + """UpdateAccessOperations 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: The API version to use for this operation. Constant value: "2019-03-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-03-01" + + self.config = config + + + def _post_initial( + self, resource_group_name, application_name, custom_headers=None, raw=False, **operation_config): + # Construct URL + url = self.post.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=64, min_length=3), + '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['Accept'] = 'application/json' + 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, header_parameters) + response = self._client.send(request, 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('JitUpdateAccessDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def post( + self, resource_group_name, application_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Update Access on application. + + :param resource_group_name: The name of the resource group. The name + is case insensitive. + :type resource_group_name: str + :param application_name: The name of the managed application. + :type application_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns + JitUpdateAccessDefinition or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.resource.managedapplications.models.JitUpdateAccessDefinition] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.resource.managedapplications.models.JitUpdateAccessDefinition]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._post_initial( + resource_group_name=resource_group_name, + application_name=application_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('JitUpdateAccessDefinition', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + post.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/updateAccess'}