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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions azure-graphrbac/azure/graphrbac/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -64,6 +65,7 @@
'ApplicationCreateParameters',
'ApplicationUpdateParameters',
'Application',
'ApplicationListResult',
'ApplicationAddOwnerParameters',
'KeyCredentialsUpdateParameters',
'PasswordCredentialsUpdateParameters',
Expand Down
32 changes: 32 additions & 0 deletions azure-graphrbac/azure/graphrbac/models/application_list_result.py
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions azure-graphrbac/azure/graphrbac/operations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -20,6 +21,7 @@
__all__ = [
'ObjectsOperations',
'ApplicationsOperations',
'DeletedApplicationsOperations',
'GroupsOperations',
'ServicePrincipalsOperations',
'UsersOperations',
Expand Down
Original file line number Diff line number Diff line change
@@ -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<msrest:optionsforoperations>`.
:return: Application or ClientRawResponse if raw=true
:rtype: ~azure.graphrbac.models.Application or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`GraphErrorException<azure.graphrbac.models.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<msrest:optionsforoperations>`.
:return: ApplicationListResult or ClientRawResponse if raw=true
:rtype: ~azure.graphrbac.models.ApplicationListResult or
~msrest.pipeline.ClientRawResponse
:raises:
:class:`GraphErrorException<azure.graphrbac.models.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<msrest:optionsforoperations>`.
:return: None or ClientRawResponse if raw=true
:rtype: None or ~msrest.pipeline.ClientRawResponse
:raises:
:class:`GraphErrorException<azure.graphrbac.models.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}'}