diff --git a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py index fdc4d8adabb4..48bfde81a761 100644 --- a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py +++ b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py @@ -15,6 +15,7 @@ from .version import VERSION from .operations.objects_operations import ObjectsOperations from .operations.applications_operations import ApplicationsOperations +from .operations.deleted_applications_operations import DeletedApplicationsOperations from .operations.groups_operations import GroupsOperations from .operations.service_principals_operations import ServicePrincipalsOperations from .operations.users_operations import UsersOperations @@ -65,6 +66,8 @@ class GraphRbacManagementClient(object): :vartype objects: azure.graphrbac.operations.ObjectsOperations :ivar applications: Applications operations :vartype applications: azure.graphrbac.operations.ApplicationsOperations + :ivar deleted_applications: DeletedApplications operations + :vartype deleted_applications: azure.graphrbac.operations.DeletedApplicationsOperations :ivar groups: Groups operations :vartype groups: azure.graphrbac.operations.GroupsOperations :ivar service_principals: ServicePrincipals operations @@ -99,6 +102,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.applications = ApplicationsOperations( self._client, self.config, self._serialize, self._deserialize) + self.deleted_applications = DeletedApplicationsOperations( + self._client, self.config, self._serialize, self._deserialize) self.groups = GroupsOperations( self._client, self.config, self._serialize, self._deserialize) self.service_principals = ServicePrincipalsOperations( diff --git a/azure-graphrbac/azure/graphrbac/models/__init__.py b/azure-graphrbac/azure/graphrbac/models/__init__.py index 4e94d926f47c..5e5228daa4d6 100644 --- a/azure-graphrbac/azure/graphrbac/models/__init__.py +++ b/azure-graphrbac/azure/graphrbac/models/__init__.py @@ -18,6 +18,7 @@ from .application_create_parameters import ApplicationCreateParameters from .application_update_parameters import ApplicationUpdateParameters from .application import Application +from .application_list_result import ApplicationListResult from .application_add_owner_parameters import ApplicationAddOwnerParameters from .key_credentials_update_parameters import KeyCredentialsUpdateParameters from .password_credentials_update_parameters import PasswordCredentialsUpdateParameters @@ -64,6 +65,7 @@ 'ApplicationCreateParameters', 'ApplicationUpdateParameters', 'Application', + 'ApplicationListResult', 'ApplicationAddOwnerParameters', 'KeyCredentialsUpdateParameters', 'PasswordCredentialsUpdateParameters', diff --git a/azure-graphrbac/azure/graphrbac/models/application_list_result.py b/azure-graphrbac/azure/graphrbac/models/application_list_result.py new file mode 100644 index 000000000000..1fb31755f012 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_list_result.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 ApplicationListResult(Model): + """Application list operation result. + + :param value: A collection of applications. + :type value: list[~azure.graphrbac.models.Application] + :param odatanext_link: The URL to get the next set of results. + :type odatanext_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Application]'}, + 'odatanext_link': {'key': 'odata\\.nextLink', 'type': 'str'}, + } + + def __init__(self, value=None, odatanext_link=None): + super(ApplicationListResult, self).__init__() + self.value = value + self.odatanext_link = odatanext_link diff --git a/azure-graphrbac/azure/graphrbac/operations/__init__.py b/azure-graphrbac/azure/graphrbac/operations/__init__.py index 409d3c3c8680..86d64858d326 100644 --- a/azure-graphrbac/azure/graphrbac/operations/__init__.py +++ b/azure-graphrbac/azure/graphrbac/operations/__init__.py @@ -11,6 +11,7 @@ from .objects_operations import ObjectsOperations from .applications_operations import ApplicationsOperations +from .deleted_applications_operations import DeletedApplicationsOperations from .groups_operations import GroupsOperations from .service_principals_operations import ServicePrincipalsOperations from .users_operations import UsersOperations @@ -20,6 +21,7 @@ __all__ = [ 'ObjectsOperations', 'ApplicationsOperations', + 'DeletedApplicationsOperations', 'GroupsOperations', 'ServicePrincipalsOperations', 'UsersOperations', diff --git a/azure-graphrbac/azure/graphrbac/operations/deleted_applications_operations.py b/azure-graphrbac/azure/graphrbac/operations/deleted_applications_operations.py new file mode 100644 index 000000000000..bb59f547a94d --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/operations/deleted_applications_operations.py @@ -0,0 +1,200 @@ +# 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 DeletedApplicationsOperations(object): + """DeletedApplicationsOperations operations. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: Client API version. Constant value: "1.6". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "1.6" + + self.config = config + + def restore( + self, object_id, custom_headers=None, raw=False, **operation_config): + """Restores the deleted application in the directory. + + :param object_id: Application object ID. + :type object_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: Application or ClientRawResponse if raw=true + :rtype: ~azure.graphrbac.models.Application or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`GraphErrorException` + """ + # Construct URL + url = self.restore.metadata['url'] + path_format_arguments = { + 'objectId': self._serialize.url("object_id", object_id, 'str'), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_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.post(url, query_parameters) + response = self._client.send(request, header_parameters, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.GraphErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('Application', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + restore.metadata = {'url': '/{tenantID}/deletedApplications/{objectId}/restore'} + + def get( + self, custom_headers=None, raw=False, **operation_config): + """Gets a list of deleted applications in the directory. + + :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: ApplicationListResult or ClientRawResponse if raw=true + :rtype: ~azure.graphrbac.models.ApplicationListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`GraphErrorException` + """ + # Construct URL + url = self.get.metadata['url'] + path_format_arguments = { + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_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.GraphErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{tenantID}/deletedApplications'} + + def hard_delete( + self, application_object_id, custom_headers=None, raw=False, **operation_config): + """Hard-delete an application. + + :param application_object_id: Application object ID. + :type application_object_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: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`GraphErrorException` + """ + # Construct URL + url = self.hard_delete.metadata['url'] + path_format_arguments = { + 'applicationObjectId': self._serialize.url("application_object_id", application_object_id, 'str'), + 'tenantID': self._serialize.url("self.config.tenant_id", self.config.tenant_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 [204]: + raise models.GraphErrorException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + hard_delete.metadata = {'url': '/{tenantID}/deletedApplications/{applicationObjectId}'}