Skip to content

Commit

Permalink
[AutoPR] graphrbac/data-plane (#3570)
Browse files Browse the repository at this point in the history
* [AutoPR graphrbac/data-plane] [GraphRBAC] Add delete owner (#3560)

* Generated from 46cf67ff714c2a733555738f1a78662d8d865d1c

Add delete owner

* Test remove owner

* ChangeLog and version
  • Loading branch information
AutorestCI authored and lmazuel committed Oct 11, 2018
1 parent f8c6958 commit 555a4e1
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 79 deletions.
7 changes: 7 additions & 0 deletions azure-graphrbac/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
Release History
===============

0.51.0 (2018-10-11)
+++++++++++++++++++

**Features**

- Add delete group/application owner

0.50.0 (2018-10-10)
+++++++++++++++++++

Expand Down
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}'}
3 changes: 1 addition & 2 deletions azure-graphrbac/azure/graphrbac/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
# regenerated.
# --------------------------------------------------------------------------

VERSION = "0.50.0"

VERSION = "0.51.0"
Loading

0 comments on commit 555a4e1

Please sign in to comment.