diff --git a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py index 2acc3afb88fc..f117db210db6 100644 --- a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py +++ b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py @@ -13,11 +13,13 @@ from msrest import Serializer, Deserializer from msrestazure import AzureConfiguration from .version import VERSION -from .operations.objects_operations import ObjectsOperations +from .operations.signed_in_user_operations import SignedInUserOperations 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 +from .operations.objects_operations import ObjectsOperations from .operations.domains_operations import DomainsOperations from .operations.oauth2_operations import OAuth2Operations from . import models @@ -61,16 +63,20 @@ class GraphRbacManagementClient(SDKClient): :ivar config: Configuration for client. :vartype config: GraphRbacManagementClientConfiguration - :ivar objects: Objects operations - :vartype objects: azure.graphrbac.operations.ObjectsOperations + :ivar signed_in_user: SignedInUser operations + :vartype signed_in_user: azure.graphrbac.operations.SignedInUserOperations :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 :vartype service_principals: azure.graphrbac.operations.ServicePrincipalsOperations :ivar users: Users operations :vartype users: azure.graphrbac.operations.UsersOperations + :ivar objects: Objects operations + :vartype objects: azure.graphrbac.operations.ObjectsOperations :ivar domains: Domains operations :vartype domains: azure.graphrbac.operations.DomainsOperations :ivar oauth2: OAuth2 operations @@ -95,16 +101,20 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) - self.objects = ObjectsOperations( + self.signed_in_user = SignedInUserOperations( 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( self._client, self.config, self._serialize, self._deserialize) self.users = UsersOperations( self._client, self.config, self._serialize, self._deserialize) + self.objects = ObjectsOperations( + self._client, self.config, self._serialize, self._deserialize) self.domains = DomainsOperations( self._client, self.config, self._serialize, self._deserialize) self.oauth2 = OAuth2Operations( diff --git a/azure-graphrbac/azure/graphrbac/models/__init__.py b/azure-graphrbac/azure/graphrbac/models/__init__.py index 36fb5b018482..d6dccbac55df 100644 --- a/azure-graphrbac/azure/graphrbac/models/__init__.py +++ b/azure-graphrbac/azure/graphrbac/models/__init__.py @@ -18,8 +18,12 @@ from .required_resource_access_py3 import RequiredResourceAccess from .application_create_parameters_py3 import ApplicationCreateParameters from .application_update_parameters_py3 import ApplicationUpdateParameters + from .app_role_py3 import AppRole from .application_py3 import Application + from .application_list_result_py3 import ApplicationListResult + from .add_owner_parameters_py3 import AddOwnerParameters from .application_add_owner_parameters_py3 import ApplicationAddOwnerParameters + from .directory_object_list_result_py3 import DirectoryObjectListResult from .key_credentials_update_parameters_py3 import KeyCredentialsUpdateParameters from .password_credentials_update_parameters_py3 import PasswordCredentialsUpdateParameters from .aad_object_py3 import AADObject @@ -50,8 +54,12 @@ from .required_resource_access import RequiredResourceAccess from .application_create_parameters import ApplicationCreateParameters from .application_update_parameters import ApplicationUpdateParameters + from .app_role import AppRole from .application import Application + from .application_list_result import ApplicationListResult + from .add_owner_parameters import AddOwnerParameters from .application_add_owner_parameters import ApplicationAddOwnerParameters + from .directory_object_list_result import DirectoryObjectListResult from .key_credentials_update_parameters import KeyCredentialsUpdateParameters from .password_credentials_update_parameters import PasswordCredentialsUpdateParameters from .aad_object import AADObject @@ -73,12 +81,12 @@ from .get_objects_parameters import GetObjectsParameters from .domain import Domain from .permissions import Permissions -from .aad_object_paged import AADObjectPaged from .application_paged import ApplicationPaged from .directory_object_paged import DirectoryObjectPaged from .key_credential_paged import KeyCredentialPaged from .password_credential_paged import PasswordCredentialPaged from .ad_group_paged import ADGroupPaged +from .aad_object_paged import AADObjectPaged from .str_paged import StrPaged from .service_principal_paged import ServicePrincipalPaged from .user_paged import UserPaged @@ -96,8 +104,12 @@ 'RequiredResourceAccess', 'ApplicationCreateParameters', 'ApplicationUpdateParameters', + 'AppRole', 'Application', + 'ApplicationListResult', + 'AddOwnerParameters', 'ApplicationAddOwnerParameters', + 'DirectoryObjectListResult', 'KeyCredentialsUpdateParameters', 'PasswordCredentialsUpdateParameters', 'AADObject', @@ -119,12 +131,12 @@ 'GetObjectsParameters', 'Domain', 'Permissions', - 'AADObjectPaged', 'ApplicationPaged', 'DirectoryObjectPaged', 'KeyCredentialPaged', 'PasswordCredentialPaged', 'ADGroupPaged', + 'AADObjectPaged', 'StrPaged', 'ServicePrincipalPaged', 'UserPaged', diff --git a/azure-graphrbac/azure/graphrbac/models/ad_group.py b/azure-graphrbac/azure/graphrbac/models/ad_group.py index b282e8e10c03..b5eca7ec4089 100644 --- a/azure-graphrbac/azure/graphrbac/models/ad_group.py +++ b/azure-graphrbac/azure/graphrbac/models/ad_group.py @@ -32,6 +32,12 @@ class ADGroup(DirectoryObject): :type object_type: str :param display_name: The display name of the group. :type display_name: str + :param mail_enabled: Whether the group is mail-enabled. Must be false. + This is because only pure security groups can be created using the Graph + API. + :type mail_enabled: bool + :param mail_nickname: The mail alias for the group. + :type mail_nickname: str :param security_enabled: Whether the group is security-enable. :type security_enabled: bool :param mail: The primary email address of the group. @@ -50,6 +56,8 @@ class ADGroup(DirectoryObject): 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, 'object_type': {'key': 'objectType', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'mail_enabled': {'key': 'mailEnabled', 'type': 'bool'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, 'security_enabled': {'key': 'securityEnabled', 'type': 'bool'}, 'mail': {'key': 'mail', 'type': 'str'}, } @@ -57,6 +65,8 @@ class ADGroup(DirectoryObject): def __init__(self, **kwargs): super(ADGroup, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) + self.mail_enabled = kwargs.get('mail_enabled', None) + self.mail_nickname = kwargs.get('mail_nickname', None) self.security_enabled = kwargs.get('security_enabled', None) self.mail = kwargs.get('mail', None) self.object_type = 'Group' diff --git a/azure-graphrbac/azure/graphrbac/models/ad_group_py3.py b/azure-graphrbac/azure/graphrbac/models/ad_group_py3.py index 36f230513ff8..212d69cb1fc2 100644 --- a/azure-graphrbac/azure/graphrbac/models/ad_group_py3.py +++ b/azure-graphrbac/azure/graphrbac/models/ad_group_py3.py @@ -32,6 +32,12 @@ class ADGroup(DirectoryObject): :type object_type: str :param display_name: The display name of the group. :type display_name: str + :param mail_enabled: Whether the group is mail-enabled. Must be false. + This is because only pure security groups can be created using the Graph + API. + :type mail_enabled: bool + :param mail_nickname: The mail alias for the group. + :type mail_nickname: str :param security_enabled: Whether the group is security-enable. :type security_enabled: bool :param mail: The primary email address of the group. @@ -50,13 +56,17 @@ class ADGroup(DirectoryObject): 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, 'object_type': {'key': 'objectType', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, + 'mail_enabled': {'key': 'mailEnabled', 'type': 'bool'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, 'security_enabled': {'key': 'securityEnabled', 'type': 'bool'}, 'mail': {'key': 'mail', 'type': 'str'}, } - def __init__(self, *, additional_properties=None, display_name: str=None, security_enabled: bool=None, mail: str=None, **kwargs) -> None: + def __init__(self, *, additional_properties=None, display_name: str=None, mail_enabled: bool=None, mail_nickname: str=None, security_enabled: bool=None, mail: str=None, **kwargs) -> None: super(ADGroup, self).__init__(additional_properties=additional_properties, **kwargs) self.display_name = display_name + self.mail_enabled = mail_enabled + self.mail_nickname = mail_nickname self.security_enabled = security_enabled self.mail = mail self.object_type = 'Group' diff --git a/azure-graphrbac/azure/graphrbac/models/add_owner_parameters.py b/azure-graphrbac/azure/graphrbac/models/add_owner_parameters.py new file mode 100644 index 000000000000..c7dfa3a68db9 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/add_owner_parameters.py @@ -0,0 +1,43 @@ +# 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 AddOwnerParameters(Model): + """Request parameters for adding a owner to an application. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param url: Required. A owner object URL, such as + "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, + application, servicePrincipal, group) to be added. + :type url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AddOwnerParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.url = kwargs.get('url', None) diff --git a/azure-graphrbac/azure/graphrbac/models/add_owner_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/add_owner_parameters_py3.py new file mode 100644 index 000000000000..1d2f474d42bb --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/add_owner_parameters_py3.py @@ -0,0 +1,43 @@ +# 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 AddOwnerParameters(Model): + """Request parameters for adding a owner to an application. + + All required parameters must be populated in order to send to Azure. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param url: Required. A owner object URL, such as + "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner (user, + application, servicePrincipal, group) to be added. + :type url: str + """ + + _validation = { + 'url': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'url': {'key': 'url', 'type': 'str'}, + } + + def __init__(self, *, url: str, additional_properties=None, **kwargs) -> None: + super(AddOwnerParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.url = url diff --git a/azure-graphrbac/azure/graphrbac/models/app_role.py b/azure-graphrbac/azure/graphrbac/models/app_role.py new file mode 100644 index 000000000000..174984015873 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/app_role.py @@ -0,0 +1,57 @@ +# 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 AppRole(Model): + """AppRole. + + :param id: Unique role identifier inside the appRoles collection. + :type id: str + :param allowed_member_types: Specifies whether this app role definition + can be assigned to users and groups by setting to 'User', or to other + applications (that are accessing this application in daemon service + scenarios) by setting to 'Application', or to both. + :type allowed_member_types: list[str] + :param description: Permission help text that appears in the admin app + assignment and consent experiences. + :type description: str + :param display_name: Display name for the permission that appears in the + admin consent and app assignment experiences. + :type display_name: str + :param is_enabled: When creating or updating a role definition, this must + be set to true (which is the default). To delete a role, this must first + be set to false. At that point, in a subsequent call, this role may be + removed. + :type is_enabled: bool + :param value: Specifies the value of the roles claim that the application + should expect in the authentication and access tokens. + :type value: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'allowed_member_types': {'key': 'allowedMemberTypes', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(AppRole, self).__init__(**kwargs) + self.id = kwargs.get('id', None) + self.allowed_member_types = kwargs.get('allowed_member_types', None) + self.description = kwargs.get('description', None) + self.display_name = kwargs.get('display_name', None) + self.is_enabled = kwargs.get('is_enabled', None) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/app_role_py3.py b/azure-graphrbac/azure/graphrbac/models/app_role_py3.py new file mode 100644 index 000000000000..0292e877b7f5 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/app_role_py3.py @@ -0,0 +1,57 @@ +# 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 AppRole(Model): + """AppRole. + + :param id: Unique role identifier inside the appRoles collection. + :type id: str + :param allowed_member_types: Specifies whether this app role definition + can be assigned to users and groups by setting to 'User', or to other + applications (that are accessing this application in daemon service + scenarios) by setting to 'Application', or to both. + :type allowed_member_types: list[str] + :param description: Permission help text that appears in the admin app + assignment and consent experiences. + :type description: str + :param display_name: Display name for the permission that appears in the + admin consent and app assignment experiences. + :type display_name: str + :param is_enabled: When creating or updating a role definition, this must + be set to true (which is the default). To delete a role, this must first + be set to false. At that point, in a subsequent call, this role may be + removed. + :type is_enabled: bool + :param value: Specifies the value of the roles claim that the application + should expect in the authentication and access tokens. + :type value: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'allowed_member_types': {'key': 'allowedMemberTypes', 'type': '[str]'}, + 'description': {'key': 'description', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, id: str=None, allowed_member_types=None, description: str=None, display_name: str=None, is_enabled: bool=None, value: str=None, **kwargs) -> None: + super(AppRole, self).__init__(**kwargs) + self.id = id + self.allowed_member_types = allowed_member_types + self.description = description + self.display_name = display_name + self.is_enabled = is_enabled + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/application.py b/azure-graphrbac/azure/graphrbac/models/application.py index 7bff3d81f834..c6330273a1f7 100644 --- a/azure-graphrbac/azure/graphrbac/models/application.py +++ b/azure-graphrbac/azure/graphrbac/models/application.py @@ -32,6 +32,10 @@ class Application(DirectoryObject): :type object_type: str :param app_id: The application ID. :type app_id: str + :param app_roles: The collection of application roles that an application + may declare. These roles can be assigned to users, groups or service + principals. + :type app_roles: list[~azure.graphrbac.models.AppRole] :param app_permissions: The application permissions. :type app_permissions: list[str] :param available_to_other_tenants: Whether the application is be available @@ -62,6 +66,7 @@ class Application(DirectoryObject): 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, 'object_type': {'key': 'objectType', 'type': 'str'}, 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_roles': {'key': 'appRoles', 'type': '[AppRole]'}, 'app_permissions': {'key': 'appPermissions', 'type': '[str]'}, 'available_to_other_tenants': {'key': 'availableToOtherTenants', 'type': 'bool'}, 'display_name': {'key': 'displayName', 'type': 'str'}, @@ -74,6 +79,7 @@ class Application(DirectoryObject): def __init__(self, **kwargs): super(Application, self).__init__(**kwargs) self.app_id = kwargs.get('app_id', None) + self.app_roles = kwargs.get('app_roles', None) self.app_permissions = kwargs.get('app_permissions', None) self.available_to_other_tenants = kwargs.get('available_to_other_tenants', None) self.display_name = kwargs.get('display_name', None) diff --git a/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters.py b/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters.py index b40d3e6cdb75..2a3b067b4441 100644 --- a/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters.py @@ -9,11 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .add_owner_parameters import AddOwnerParameters -class ApplicationAddOwnerParameters(Model): - """Request parameters for adding a owner to an application. +class ApplicationAddOwnerParameters(AddOwnerParameters): + """ApplicationAddOwnerParameters. All required parameters must be populated in order to send to Azure. @@ -39,5 +39,3 @@ class ApplicationAddOwnerParameters(Model): def __init__(self, **kwargs): super(ApplicationAddOwnerParameters, self).__init__(**kwargs) - self.additional_properties = kwargs.get('additional_properties', None) - self.url = kwargs.get('url', None) diff --git a/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters_py3.py index 1f45c62a58ef..698a11fabe4c 100644 --- a/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters_py3.py +++ b/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters_py3.py @@ -9,11 +9,11 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from .add_owner_parameters_py3 import AddOwnerParameters -class ApplicationAddOwnerParameters(Model): - """Request parameters for adding a owner to an application. +class ApplicationAddOwnerParameters(AddOwnerParameters): + """ApplicationAddOwnerParameters. All required parameters must be populated in order to send to Azure. @@ -38,6 +38,4 @@ class ApplicationAddOwnerParameters(Model): } def __init__(self, *, url: str, additional_properties=None, **kwargs) -> None: - super(ApplicationAddOwnerParameters, self).__init__(**kwargs) - self.additional_properties = additional_properties - self.url = url + super(ApplicationAddOwnerParameters, self).__init__(additional_properties=additional_properties, url=url, **kwargs) 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..c013cceead8c --- /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, **kwargs): + super(ApplicationListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.odatanext_link = kwargs.get('odatanext_link', None) diff --git a/azure-graphrbac/azure/graphrbac/models/application_list_result_py3.py b/azure-graphrbac/azure/graphrbac/models/application_list_result_py3.py new file mode 100644 index 000000000000..b170db3d8a46 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_list_result_py3.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: str=None, **kwargs) -> None: + super(ApplicationListResult, self).__init__(**kwargs) + self.value = value + self.odatanext_link = odatanext_link diff --git a/azure-graphrbac/azure/graphrbac/models/application_py3.py b/azure-graphrbac/azure/graphrbac/models/application_py3.py index d069287e16e6..be0ea5d714c5 100644 --- a/azure-graphrbac/azure/graphrbac/models/application_py3.py +++ b/azure-graphrbac/azure/graphrbac/models/application_py3.py @@ -32,6 +32,10 @@ class Application(DirectoryObject): :type object_type: str :param app_id: The application ID. :type app_id: str + :param app_roles: The collection of application roles that an application + may declare. These roles can be assigned to users, groups or service + principals. + :type app_roles: list[~azure.graphrbac.models.AppRole] :param app_permissions: The application permissions. :type app_permissions: list[str] :param available_to_other_tenants: Whether the application is be available @@ -62,6 +66,7 @@ class Application(DirectoryObject): 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, 'object_type': {'key': 'objectType', 'type': 'str'}, 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_roles': {'key': 'appRoles', 'type': '[AppRole]'}, 'app_permissions': {'key': 'appPermissions', 'type': '[str]'}, 'available_to_other_tenants': {'key': 'availableToOtherTenants', 'type': 'bool'}, 'display_name': {'key': 'displayName', 'type': 'str'}, @@ -71,9 +76,10 @@ class Application(DirectoryObject): 'oauth2_allow_implicit_flow': {'key': 'oauth2AllowImplicitFlow', 'type': 'bool'}, } - def __init__(self, *, additional_properties=None, app_id: str=None, app_permissions=None, available_to_other_tenants: bool=None, display_name: str=None, identifier_uris=None, reply_urls=None, homepage: str=None, oauth2_allow_implicit_flow: bool=None, **kwargs) -> None: + def __init__(self, *, additional_properties=None, app_id: str=None, app_roles=None, app_permissions=None, available_to_other_tenants: bool=None, display_name: str=None, identifier_uris=None, reply_urls=None, homepage: str=None, oauth2_allow_implicit_flow: bool=None, **kwargs) -> None: super(Application, self).__init__(additional_properties=additional_properties, **kwargs) self.app_id = app_id + self.app_roles = app_roles self.app_permissions = app_permissions self.available_to_other_tenants = available_to_other_tenants self.display_name = display_name diff --git a/azure-graphrbac/azure/graphrbac/models/directory_object_list_result.py b/azure-graphrbac/azure/graphrbac/models/directory_object_list_result.py new file mode 100644 index 000000000000..6da0b717ffea --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/directory_object_list_result.py @@ -0,0 +1,28 @@ +# 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 DirectoryObjectListResult(Model): + """DirectoryObject list operation result. + + :param value: A collection of DirectoryObject. + :type value: list[~azure.graphrbac.models.DirectoryObject] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DirectoryObject]'}, + } + + def __init__(self, **kwargs): + super(DirectoryObjectListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/directory_object_list_result_py3.py b/azure-graphrbac/azure/graphrbac/models/directory_object_list_result_py3.py new file mode 100644 index 000000000000..5954b83a263a --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/directory_object_list_result_py3.py @@ -0,0 +1,28 @@ +# 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 DirectoryObjectListResult(Model): + """DirectoryObject list operation result. + + :param value: A collection of DirectoryObject. + :type value: list[~azure.graphrbac.models.DirectoryObject] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DirectoryObject]'}, + } + + def __init__(self, *, value=None, **kwargs) -> None: + super(DirectoryObjectListResult, self).__init__(**kwargs) + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/service_principal.py b/azure-graphrbac/azure/graphrbac/models/service_principal.py index 761fe161b257..d68f9140ce40 100644 --- a/azure-graphrbac/azure/graphrbac/models/service_principal.py +++ b/azure-graphrbac/azure/graphrbac/models/service_principal.py @@ -34,6 +34,10 @@ class ServicePrincipal(DirectoryObject): :type display_name: str :param app_id: The application ID. :type app_id: str + :param app_roles: The collection of application roles that an application + may declare. These roles can be assigned to users, groups or service + principals. + :type app_roles: list[~azure.graphrbac.models.AppRole] :param service_principal_names: A collection of service principal names. :type service_principal_names: list[str] """ @@ -51,6 +55,7 @@ class ServicePrincipal(DirectoryObject): 'object_type': {'key': 'objectType', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_roles': {'key': 'appRoles', 'type': '[AppRole]'}, 'service_principal_names': {'key': 'servicePrincipalNames', 'type': '[str]'}, } @@ -58,5 +63,6 @@ def __init__(self, **kwargs): super(ServicePrincipal, self).__init__(**kwargs) self.display_name = kwargs.get('display_name', None) self.app_id = kwargs.get('app_id', None) + self.app_roles = kwargs.get('app_roles', None) self.service_principal_names = kwargs.get('service_principal_names', None) self.object_type = 'ServicePrincipal' diff --git a/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py b/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py index bd0b154487ff..d9dce61da9b8 100644 --- a/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py +++ b/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py @@ -34,6 +34,10 @@ class ServicePrincipal(DirectoryObject): :type display_name: str :param app_id: The application ID. :type app_id: str + :param app_roles: The collection of application roles that an application + may declare. These roles can be assigned to users, groups or service + principals. + :type app_roles: list[~azure.graphrbac.models.AppRole] :param service_principal_names: A collection of service principal names. :type service_principal_names: list[str] """ @@ -51,12 +55,14 @@ class ServicePrincipal(DirectoryObject): 'object_type': {'key': 'objectType', 'type': 'str'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_roles': {'key': 'appRoles', 'type': '[AppRole]'}, 'service_principal_names': {'key': 'servicePrincipalNames', 'type': '[str]'}, } - def __init__(self, *, additional_properties=None, display_name: str=None, app_id: str=None, service_principal_names=None, **kwargs) -> None: + def __init__(self, *, additional_properties=None, display_name: str=None, app_id: str=None, app_roles=None, service_principal_names=None, **kwargs) -> None: super(ServicePrincipal, self).__init__(additional_properties=additional_properties, **kwargs) self.display_name = display_name self.app_id = app_id + self.app_roles = app_roles self.service_principal_names = service_principal_names self.object_type = 'ServicePrincipal' diff --git a/azure-graphrbac/azure/graphrbac/operations/__init__.py b/azure-graphrbac/azure/graphrbac/operations/__init__.py index 409d3c3c8680..8ca6c17b5fa2 100644 --- a/azure-graphrbac/azure/graphrbac/operations/__init__.py +++ b/azure-graphrbac/azure/graphrbac/operations/__init__.py @@ -9,20 +9,24 @@ # regenerated. # -------------------------------------------------------------------------- -from .objects_operations import ObjectsOperations +from .signed_in_user_operations import SignedInUserOperations 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 +from .objects_operations import ObjectsOperations from .domains_operations import DomainsOperations from .oauth2_operations import OAuth2Operations __all__ = [ - 'ObjectsOperations', + 'SignedInUserOperations', 'ApplicationsOperations', + 'DeletedApplicationsOperations', 'GroupsOperations', 'ServicePrincipalsOperations', 'UsersOperations', + 'ObjectsOperations', 'DomainsOperations', 'OAuth2Operations', ] 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..1b475b177c31 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/operations/deleted_applications_operations.py @@ -0,0 +1,199 @@ +# 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['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 [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['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]: + 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 = {} + 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 + hard_delete.metadata = {'url': '/{tenantID}/deletedApplications/{applicationObjectId}'} diff --git a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py index c5dcd2625761..bfaa1348e2b9 100644 --- a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py @@ -611,3 +611,137 @@ def internal_paging(next_link=None, raw=False): return deserialized get_member_groups.metadata = {'url': '/{tenantID}/groups/{objectId}/getMemberGroups'} + + def list_owners( + self, object_id, custom_headers=None, raw=False, **operation_config): + """Directory objects that are owners of the group. + + The owners are a set of non-admin users who are allowed to modify this + object. + + :param object_id: The object ID of the group for which to get owners. + :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: An iterator like instance of DirectoryObject + :rtype: + ~azure.graphrbac.models.DirectoryObjectPaged[~azure.graphrbac.models.DirectoryObject] + :raises: + :class:`GraphErrorException` + """ + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list_owners.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') + + else: + url = next_link + query_parameters = {} + + # 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]: + raise models.GraphErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.DirectoryObjectPaged(internal_paging, self._deserialize.dependencies) + + if raw: + header_dict = {} + client_raw_response = models.DirectoryObjectPaged(internal_paging, self._deserialize.dependencies, header_dict) + return client_raw_response + + return deserialized + list_owners.metadata = {'url': '/{tenantID}/groups/{objectId}/owners'} + + def add_owner( + self, object_id, url, additional_properties=None, custom_headers=None, raw=False, **operation_config): + """Add an owner to a group. + + :param object_id: The object ID of the application to which to add the + owner. + :type object_id: str + :param url: A owner object URL, such as + "https://graph.windows.net/0b1f9851-1bf0-433f-aec3-cb9272f093dc/directoryObjects/f260bbc4-c254-447b-94cf-293b5ec434dd", + where "0b1f9851-1bf0-433f-aec3-cb9272f093dc" is the tenantId and + "f260bbc4-c254-447b-94cf-293b5ec434dd" is the objectId of the owner + (user, application, servicePrincipal, group) to be added. + :type url: str + :param additional_properties: Unmatched properties from the message + are deserialized this collection + :type additional_properties: dict[str, object] + :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` + """ + parameters = models.AddOwnerParameters(additional_properties=additional_properties, url=url) + + # Construct URL + url = self.add_owner.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 body + body_content = self._serialize.body(parameters, 'AddOwnerParameters') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + 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 + add_owner.metadata = {'url': '/{tenantID}/groups/{objectId}/$links/owners'} diff --git a/azure-graphrbac/azure/graphrbac/operations/objects_operations.py b/azure-graphrbac/azure/graphrbac/operations/objects_operations.py index 8aa9a61d6d34..9883561b9331 100644 --- a/azure-graphrbac/azure/graphrbac/operations/objects_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/objects_operations.py @@ -37,61 +37,6 @@ def __init__(self, client, config, serializer, deserializer): self.config = config - def get_current_user( - self, custom_headers=None, raw=False, **operation_config): - """Gets the details for the currently logged-in user. - - :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: AADObject or ClientRawResponse if raw=true - :rtype: ~azure.graphrbac.models.AADObject or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`GraphErrorException` - """ - # Construct URL - url = self.get_current_user.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['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]: - raise models.GraphErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('AADObject', response) - - if raw: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response - - return deserialized - get_current_user.metadata = {'url': '/{tenantID}/me'} - def get_objects_by_object_ids( self, parameters, custom_headers=None, raw=False, **operation_config): """Gets AD group membership for the specified AD object IDs. @@ -167,3 +112,58 @@ def internal_paging(next_link=None, raw=False): return deserialized get_objects_by_object_ids.metadata = {'url': '/{tenantID}/getObjectsByObjectIds'} + + def get_current_user( + self, custom_headers=None, raw=False, **operation_config): + """Gets the details for the currently logged-in user. + + :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: AADObject or ClientRawResponse if raw=true + :rtype: ~azure.graphrbac.models.AADObject or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`GraphErrorException` + """ + # Construct URL + url = self.get_current_user.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['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]: + raise models.GraphErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('AADObject', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get_current_user.metadata = {'url': '/{tenantID}/me'} diff --git a/azure-graphrbac/azure/graphrbac/operations/signed_in_user_operations.py b/azure-graphrbac/azure/graphrbac/operations/signed_in_user_operations.py new file mode 100644 index 000000000000..20a8991c551b --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/operations/signed_in_user_operations.py @@ -0,0 +1,147 @@ +# 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 SignedInUserOperations(object): + """SignedInUserOperations 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 get( + self, custom_headers=None, raw=False, **operation_config): + """Gets the details for the currently logged-in user. + + :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: User or ClientRawResponse if raw=true + :rtype: ~azure.graphrbac.models.User 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['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]: + raise models.GraphErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('User', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/{tenantID}/me'} + + def list_owned_objects( + self, custom_headers=None, raw=False, **operation_config): + """Get the list of directory objects that are owned by the user. + + :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: DirectoryObjectListResult or ClientRawResponse if raw=true + :rtype: ~azure.graphrbac.models.DirectoryObjectListResult or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`GraphErrorException` + """ + # Construct URL + url = self.list_owned_objects.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['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]: + raise models.GraphErrorException(self._deserialize, response) + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('DirectoryObjectListResult', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + list_owned_objects.metadata = {'url': '/{tenantID}/me/ownedObjects'}