Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR graphrbac/data-plane] [GraphRBAC] Add delete owner #3560

Merged
merged 2 commits into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,59 @@ def add_owner(
return client_raw_response
add_owner.metadata = {'url': '/{tenantID}/applications/{applicationObjectId}/$links/owners'}

def remove_owner(
self, application_object_id, owner_object_id, custom_headers=None, raw=False, **operation_config):
"""Remove a member from owners.

:param application_object_id: The object ID of the application from
which to remove the owner.
:type application_object_id: str
:param owner_object_id: Owner object id
:type owner_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.remove_owner.metadata['url']
path_format_arguments = {
'applicationObjectId': self._serialize.url("application_object_id", application_object_id, 'str'),
'ownerObjectId': self._serialize.url("owner_object_id", owner_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 = {}
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 [204]:
raise models.GraphErrorException(self._deserialize, response)

if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
remove_owner.metadata = {'url': '/{tenantID}/applications/{applicationObjectId}/$links/owners/{ownerObjectId}'}

def list_key_credentials(
self, application_object_id, custom_headers=None, raw=False, **operation_config):
"""Get the keyCredentials associated with an application.
Expand Down
53 changes: 53 additions & 0 deletions azure-graphrbac/azure/graphrbac/operations/groups_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,3 +745,56 @@ def add_owner(
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
add_owner.metadata = {'url': '/{tenantID}/groups/{objectId}/$links/owners'}

def remove_owner(
self, object_id, owner_object_id, custom_headers=None, raw=False, **operation_config):
"""Remove a member from owners.

:param object_id: The object ID of the group from which to remove the
owner.
:type object_id: str
:param owner_object_id: Owner object id
:type owner_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.remove_owner.metadata['url']
path_format_arguments = {
'objectId': self._serialize.url("object_id", object_id, 'str'),
'ownerObjectId': self._serialize.url("owner_object_id", owner_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 = {}
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 [204]:
raise models.GraphErrorException(self._deserialize, response)

if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
remove_owner.metadata = {'url': '/{tenantID}/groups/{objectId}/$links/owners/{ownerObjectId}'}
Loading