diff --git a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py index fdc4d8adabb4..f117db210db6 100644 --- a/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py +++ b/azure-graphrbac/azure/graphrbac/graph_rbac_management_client.py @@ -9,15 +9,17 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.service_client import ServiceClient +from msrest.service_client import SDKClient 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 @@ -55,22 +57,26 @@ def __init__( self.tenant_id = tenant_id -class GraphRbacManagementClient(object): +class GraphRbacManagementClient(SDKClient): """The Graph RBAC Management Client :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 @@ -88,23 +94,27 @@ def __init__( self, credentials, tenant_id, base_url=None): self.config = GraphRbacManagementClientConfiguration(credentials, tenant_id, base_url) - self._client = ServiceClient(self.config.credentials, self.config) + super(GraphRbacManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self.api_version = '1.6' 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 4e94d926f47c..d6dccbac55df 100644 --- a/azure-graphrbac/azure/graphrbac/models/__init__.py +++ b/azure-graphrbac/azure/graphrbac/models/__init__.py @@ -9,43 +9,84 @@ # regenerated. # -------------------------------------------------------------------------- -from .graph_error import GraphError, GraphErrorException -from .directory_object import DirectoryObject -from .key_credential import KeyCredential -from .password_credential import PasswordCredential -from .resource_access import ResourceAccess -from .required_resource_access import RequiredResourceAccess -from .application_create_parameters import ApplicationCreateParameters -from .application_update_parameters import ApplicationUpdateParameters -from .application import Application -from .application_add_owner_parameters import ApplicationAddOwnerParameters -from .key_credentials_update_parameters import KeyCredentialsUpdateParameters -from .password_credentials_update_parameters import PasswordCredentialsUpdateParameters -from .aad_object import AADObject -from .group_add_member_parameters import GroupAddMemberParameters -from .group_create_parameters import GroupCreateParameters -from .ad_group import ADGroup -from .group_get_member_groups_parameters import GroupGetMemberGroupsParameters -from .check_group_membership_parameters import CheckGroupMembershipParameters -from .check_group_membership_result import CheckGroupMembershipResult -from .service_principal_create_parameters import ServicePrincipalCreateParameters -from .service_principal import ServicePrincipal -from .password_profile import PasswordProfile -from .user_base import UserBase -from .user_create_parameters import UserCreateParameters -from .user_update_parameters import UserUpdateParameters -from .sign_in_name import SignInName -from .user import User -from .user_get_member_groups_parameters import UserGetMemberGroupsParameters -from .get_objects_parameters import GetObjectsParameters -from .domain import Domain -from .permissions import Permissions -from .aad_object_paged import AADObjectPaged +try: + from .graph_error_py3 import GraphError, GraphErrorException + from .directory_object_py3 import DirectoryObject + from .key_credential_py3 import KeyCredential + from .password_credential_py3 import PasswordCredential + from .resource_access_py3 import ResourceAccess + 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 + from .group_add_member_parameters_py3 import GroupAddMemberParameters + from .group_create_parameters_py3 import GroupCreateParameters + from .ad_group_py3 import ADGroup + from .group_get_member_groups_parameters_py3 import GroupGetMemberGroupsParameters + from .check_group_membership_parameters_py3 import CheckGroupMembershipParameters + from .check_group_membership_result_py3 import CheckGroupMembershipResult + from .service_principal_create_parameters_py3 import ServicePrincipalCreateParameters + from .service_principal_py3 import ServicePrincipal + from .password_profile_py3 import PasswordProfile + from .user_base_py3 import UserBase + from .user_create_parameters_py3 import UserCreateParameters + from .user_update_parameters_py3 import UserUpdateParameters + from .sign_in_name_py3 import SignInName + from .user_py3 import User + from .user_get_member_groups_parameters_py3 import UserGetMemberGroupsParameters + from .get_objects_parameters_py3 import GetObjectsParameters + from .domain_py3 import Domain + from .permissions_py3 import Permissions +except (SyntaxError, ImportError): + from .graph_error import GraphError, GraphErrorException + from .directory_object import DirectoryObject + from .key_credential import KeyCredential + from .password_credential import PasswordCredential + from .resource_access import ResourceAccess + 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 + from .group_add_member_parameters import GroupAddMemberParameters + from .group_create_parameters import GroupCreateParameters + from .ad_group import ADGroup + from .group_get_member_groups_parameters import GroupGetMemberGroupsParameters + from .check_group_membership_parameters import CheckGroupMembershipParameters + from .check_group_membership_result import CheckGroupMembershipResult + from .service_principal_create_parameters import ServicePrincipalCreateParameters + from .service_principal import ServicePrincipal + from .password_profile import PasswordProfile + from .user_base import UserBase + from .user_create_parameters import UserCreateParameters + from .user_update_parameters import UserUpdateParameters + from .sign_in_name import SignInName + from .user import User + from .user_get_member_groups_parameters import UserGetMemberGroupsParameters + from .get_objects_parameters import GetObjectsParameters + from .domain import Domain + from .permissions import Permissions 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 @@ -63,8 +104,12 @@ 'RequiredResourceAccess', 'ApplicationCreateParameters', 'ApplicationUpdateParameters', + 'AppRole', 'Application', + 'ApplicationListResult', + 'AddOwnerParameters', 'ApplicationAddOwnerParameters', + 'DirectoryObjectListResult', 'KeyCredentialsUpdateParameters', 'PasswordCredentialsUpdateParameters', 'AADObject', @@ -86,12 +131,12 @@ 'GetObjectsParameters', 'Domain', 'Permissions', - 'AADObjectPaged', 'ApplicationPaged', 'DirectoryObjectPaged', 'KeyCredentialPaged', 'PasswordCredentialPaged', 'ADGroupPaged', + 'AADObjectPaged', 'StrPaged', 'ServicePrincipalPaged', 'UserPaged', diff --git a/azure-graphrbac/azure/graphrbac/models/aad_object.py b/azure-graphrbac/azure/graphrbac/models/aad_object.py index 88c08b0c6f15..373601b2bf80 100644 --- a/azure-graphrbac/azure/graphrbac/models/aad_object.py +++ b/azure-graphrbac/azure/graphrbac/models/aad_object.py @@ -97,20 +97,20 @@ class AADObject(Model): 'homepage': {'key': 'homepage', 'type': 'str'}, } - def __init__(self, additional_properties=None, object_id=None, object_type=None, display_name=None, user_principal_name=None, mail=None, mail_enabled=None, security_enabled=None, sign_in_name=None, service_principal_names=None, user_type=None): - super(AADObject, self).__init__() - self.additional_properties = additional_properties - self.object_id = object_id - self.object_type = object_type - self.display_name = display_name - self.user_principal_name = user_principal_name - self.mail = mail - self.mail_enabled = mail_enabled + def __init__(self, **kwargs): + super(AADObject, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.object_id = kwargs.get('object_id', None) + self.object_type = kwargs.get('object_type', None) + self.display_name = kwargs.get('display_name', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + self.mail = kwargs.get('mail', None) + self.mail_enabled = kwargs.get('mail_enabled', None) self.mail_nickname = None - self.security_enabled = security_enabled - self.sign_in_name = sign_in_name - self.service_principal_names = service_principal_names - self.user_type = user_type + self.security_enabled = kwargs.get('security_enabled', None) + self.sign_in_name = kwargs.get('sign_in_name', None) + self.service_principal_names = kwargs.get('service_principal_names', None) + self.user_type = kwargs.get('user_type', None) self.usage_location = None self.app_id = None self.app_permissions = None diff --git a/azure-graphrbac/azure/graphrbac/models/aad_object_py3.py b/azure-graphrbac/azure/graphrbac/models/aad_object_py3.py new file mode 100644 index 000000000000..d758e0057745 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/aad_object_py3.py @@ -0,0 +1,120 @@ +# 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 AADObject(Model): + """The properties of an Active Directory object. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param object_id: The ID of the object. + :type object_id: str + :param object_type: The type of AAD object. + :type object_type: str + :param display_name: The display name of the object. + :type display_name: str + :param user_principal_name: The principal name of the object. + :type user_principal_name: str + :param mail: The primary email address of the object. + :type mail: str + :param mail_enabled: Whether the AAD object is mail-enabled. + :type mail_enabled: bool + :ivar mail_nickname: The mail alias for the user. + :vartype mail_nickname: str + :param security_enabled: Whether the AAD object is security-enabled. + :type security_enabled: bool + :param sign_in_name: The sign-in name of the object. + :type sign_in_name: str + :param service_principal_names: A collection of service principal names + associated with the object. + :type service_principal_names: list[str] + :param user_type: The user type of the object. + :type user_type: str + :ivar usage_location: A two letter country code (ISO standard 3166). + Required for users that will be assigned licenses due to legal requirement + to check for availability of services in countries. Examples include: + "US", "JP", and "GB". + :vartype usage_location: str + :ivar app_id: The application ID. + :vartype app_id: str + :ivar app_permissions: The application permissions. + :vartype app_permissions: list[str] + :ivar available_to_other_tenants: Whether the application is be available + to other tenants. + :vartype available_to_other_tenants: bool + :ivar identifier_uris: A collection of URIs for the application. + :vartype identifier_uris: list[str] + :ivar reply_urls: A collection of reply URLs for the application. + :vartype reply_urls: list[str] + :ivar homepage: The home page of the application. + :vartype homepage: str + """ + + _validation = { + 'mail_nickname': {'readonly': True}, + 'usage_location': {'readonly': True}, + 'app_id': {'readonly': True}, + 'app_permissions': {'readonly': True}, + 'available_to_other_tenants': {'readonly': True}, + 'identifier_uris': {'readonly': True}, + 'reply_urls': {'readonly': True}, + 'homepage': {'readonly': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'object_type': {'key': 'objectType', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + 'mail': {'key': 'mail', 'type': 'str'}, + 'mail_enabled': {'key': 'mailEnabled', 'type': 'bool'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, + 'security_enabled': {'key': 'securityEnabled', 'type': 'bool'}, + 'sign_in_name': {'key': 'signInName', 'type': 'str'}, + 'service_principal_names': {'key': 'servicePrincipalNames', 'type': '[str]'}, + 'user_type': {'key': 'userType', 'type': 'str'}, + 'usage_location': {'key': 'usageLocation', 'type': 'str'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_permissions': {'key': 'appPermissions', 'type': '[str]'}, + 'available_to_other_tenants': {'key': 'availableToOtherTenants', 'type': 'bool'}, + 'identifier_uris': {'key': 'identifierUris', 'type': '[str]'}, + 'reply_urls': {'key': 'replyUrls', 'type': '[str]'}, + 'homepage': {'key': 'homepage', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, object_id: str=None, object_type: str=None, display_name: str=None, user_principal_name: str=None, mail: str=None, mail_enabled: bool=None, security_enabled: bool=None, sign_in_name: str=None, service_principal_names=None, user_type: str=None, **kwargs) -> None: + super(AADObject, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.object_id = object_id + self.object_type = object_type + self.display_name = display_name + self.user_principal_name = user_principal_name + self.mail = mail + self.mail_enabled = mail_enabled + self.mail_nickname = None + self.security_enabled = security_enabled + self.sign_in_name = sign_in_name + self.service_principal_names = service_principal_names + self.user_type = user_type + self.usage_location = None + self.app_id = None + self.app_permissions = None + self.available_to_other_tenants = None + self.identifier_uris = None + self.reply_urls = None + self.homepage = None diff --git a/azure-graphrbac/azure/graphrbac/models/ad_group.py b/azure-graphrbac/azure/graphrbac/models/ad_group.py index 57f69c6002c9..b5eca7ec4089 100644 --- a/azure-graphrbac/azure/graphrbac/models/ad_group.py +++ b/azure-graphrbac/azure/graphrbac/models/ad_group.py @@ -18,6 +18,8 @@ class ADGroup(DirectoryObject): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -26,10 +28,16 @@ class ADGroup(DirectoryObject): :ivar deletion_timestamp: The time at which the directory object was deleted. :vartype deletion_timestamp: datetime - :param object_type: Constant filled by server. + :param object_type: Required. Constant filled by server. :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. @@ -48,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=None, security_enabled=None, mail=None): - super(ADGroup, self).__init__(additional_properties=additional_properties) - self.display_name = display_name - self.security_enabled = security_enabled - self.mail = mail + 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 new file mode 100644 index 000000000000..212d69cb1fc2 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/ad_group_py3.py @@ -0,0 +1,72 @@ +# 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 .directory_object_py3 import DirectoryObject + + +class ADGroup(DirectoryObject): + """Active Directory group information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar object_id: The object ID. + :vartype object_id: str + :ivar deletion_timestamp: The time at which the directory object was + deleted. + :vartype deletion_timestamp: datetime + :param object_type: Required. Constant filled by server. + :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. + :type mail: str + """ + + _validation = { + 'object_id': {'readonly': True}, + 'deletion_timestamp': {'readonly': True}, + 'object_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + '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, 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 d19afa746795..c6330273a1f7 100644 --- a/azure-graphrbac/azure/graphrbac/models/application.py +++ b/azure-graphrbac/azure/graphrbac/models/application.py @@ -18,6 +18,8 @@ class Application(DirectoryObject): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -26,10 +28,14 @@ class Application(DirectoryObject): :ivar deletion_timestamp: The time at which the directory object was deleted. :vartype deletion_timestamp: datetime - :param object_type: Constant filled by server. + :param object_type: Required. Constant filled by server. :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 @@ -60,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'}, @@ -69,14 +76,15 @@ class Application(DirectoryObject): 'oauth2_allow_implicit_flow': {'key': 'oauth2AllowImplicitFlow', 'type': 'bool'}, } - def __init__(self, additional_properties=None, app_id=None, app_permissions=None, available_to_other_tenants=None, display_name=None, identifier_uris=None, reply_urls=None, homepage=None, oauth2_allow_implicit_flow=None): - super(Application, self).__init__(additional_properties=additional_properties) - self.app_id = app_id - self.app_permissions = app_permissions - self.available_to_other_tenants = available_to_other_tenants - self.display_name = display_name - self.identifier_uris = identifier_uris - self.reply_urls = reply_urls - self.homepage = homepage - self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow + 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) + self.identifier_uris = kwargs.get('identifier_uris', None) + self.reply_urls = kwargs.get('reply_urls', None) + self.homepage = kwargs.get('homepage', None) + self.oauth2_allow_implicit_flow = kwargs.get('oauth2_allow_implicit_flow', None) self.object_type = 'Application' 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 ea47f287e952..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,16 +9,18 @@ # 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. :param additional_properties: Unmatched properties from the message are deserialized this collection :type additional_properties: dict[str, object] - :param url: A owner object URL, such as + :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, @@ -35,7 +37,5 @@ class ApplicationAddOwnerParameters(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, url, additional_properties=None): - super(ApplicationAddOwnerParameters, self).__init__() - self.additional_properties = additional_properties - self.url = url + def __init__(self, **kwargs): + super(ApplicationAddOwnerParameters, self).__init__(**kwargs) 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 new file mode 100644 index 000000000000..698a11fabe4c --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_add_owner_parameters_py3.py @@ -0,0 +1,41 @@ +# 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 .add_owner_parameters_py3 import AddOwnerParameters + + +class ApplicationAddOwnerParameters(AddOwnerParameters): + """ApplicationAddOwnerParameters. + + 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(ApplicationAddOwnerParameters, self).__init__(additional_properties=additional_properties, url=url, **kwargs) diff --git a/azure-graphrbac/azure/graphrbac/models/application_create_parameters.py b/azure-graphrbac/azure/graphrbac/models/application_create_parameters.py index 6c397fb92ff6..e3482bf86341 100644 --- a/azure-graphrbac/azure/graphrbac/models/application_create_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/application_create_parameters.py @@ -15,17 +15,20 @@ class ApplicationCreateParameters(Model): """Request parameters for creating a new 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 available_to_other_tenants: Whether the application is available to - other tenants. + :param available_to_other_tenants: Required. Whether the application is + available to other tenants. :type available_to_other_tenants: bool - :param display_name: The display name of the application. + :param display_name: Required. The display name of the application. :type display_name: str :param homepage: The home page of the application. :type homepage: str - :param identifier_uris: A collection of URIs for the application. + :param identifier_uris: Required. A collection of URIs for the + application. :type identifier_uris: list[str] :param reply_urls: A collection of reply URLs for the application. :type reply_urls: list[str] @@ -64,15 +67,15 @@ class ApplicationCreateParameters(Model): 'required_resource_access': {'key': 'requiredResourceAccess', 'type': '[RequiredResourceAccess]'}, } - def __init__(self, available_to_other_tenants, display_name, identifier_uris, additional_properties=None, homepage=None, reply_urls=None, key_credentials=None, password_credentials=None, oauth2_allow_implicit_flow=None, required_resource_access=None): - super(ApplicationCreateParameters, self).__init__() - self.additional_properties = additional_properties - self.available_to_other_tenants = available_to_other_tenants - self.display_name = display_name - self.homepage = homepage - self.identifier_uris = identifier_uris - self.reply_urls = reply_urls - self.key_credentials = key_credentials - self.password_credentials = password_credentials - self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow - self.required_resource_access = required_resource_access + def __init__(self, **kwargs): + super(ApplicationCreateParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.available_to_other_tenants = kwargs.get('available_to_other_tenants', None) + self.display_name = kwargs.get('display_name', None) + self.homepage = kwargs.get('homepage', None) + self.identifier_uris = kwargs.get('identifier_uris', None) + self.reply_urls = kwargs.get('reply_urls', None) + self.key_credentials = kwargs.get('key_credentials', None) + self.password_credentials = kwargs.get('password_credentials', None) + self.oauth2_allow_implicit_flow = kwargs.get('oauth2_allow_implicit_flow', None) + self.required_resource_access = kwargs.get('required_resource_access', None) diff --git a/azure-graphrbac/azure/graphrbac/models/application_create_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/application_create_parameters_py3.py new file mode 100644 index 000000000000..87082c205078 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_create_parameters_py3.py @@ -0,0 +1,81 @@ +# 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 ApplicationCreateParameters(Model): + """Request parameters for creating a new 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 available_to_other_tenants: Required. Whether the application is + available to other tenants. + :type available_to_other_tenants: bool + :param display_name: Required. The display name of the application. + :type display_name: str + :param homepage: The home page of the application. + :type homepage: str + :param identifier_uris: Required. A collection of URIs for the + application. + :type identifier_uris: list[str] + :param reply_urls: A collection of reply URLs for the application. + :type reply_urls: list[str] + :param key_credentials: The list of KeyCredential objects. + :type key_credentials: list[~azure.graphrbac.models.KeyCredential] + :param password_credentials: The list of PasswordCredential objects. + :type password_credentials: + list[~azure.graphrbac.models.PasswordCredential] + :param oauth2_allow_implicit_flow: Whether to allow implicit grant flow + for OAuth2 + :type oauth2_allow_implicit_flow: bool + :param required_resource_access: Specifies resources that this application + requires access to and the set of OAuth permission scopes and application + roles that it needs under each of those resources. This pre-configuration + of required resource access drives the consent experience. + :type required_resource_access: + list[~azure.graphrbac.models.RequiredResourceAccess] + """ + + _validation = { + 'available_to_other_tenants': {'required': True}, + 'display_name': {'required': True}, + 'identifier_uris': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'available_to_other_tenants': {'key': 'availableToOtherTenants', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'homepage': {'key': 'homepage', 'type': 'str'}, + 'identifier_uris': {'key': 'identifierUris', 'type': '[str]'}, + 'reply_urls': {'key': 'replyUrls', 'type': '[str]'}, + 'key_credentials': {'key': 'keyCredentials', 'type': '[KeyCredential]'}, + 'password_credentials': {'key': 'passwordCredentials', 'type': '[PasswordCredential]'}, + 'oauth2_allow_implicit_flow': {'key': 'oauth2AllowImplicitFlow', 'type': 'bool'}, + 'required_resource_access': {'key': 'requiredResourceAccess', 'type': '[RequiredResourceAccess]'}, + } + + def __init__(self, *, available_to_other_tenants: bool, display_name: str, identifier_uris, additional_properties=None, homepage: str=None, reply_urls=None, key_credentials=None, password_credentials=None, oauth2_allow_implicit_flow: bool=None, required_resource_access=None, **kwargs) -> None: + super(ApplicationCreateParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.available_to_other_tenants = available_to_other_tenants + self.display_name = display_name + self.homepage = homepage + self.identifier_uris = identifier_uris + self.reply_urls = reply_urls + self.key_credentials = key_credentials + self.password_credentials = password_credentials + self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow + self.required_resource_access = required_resource_access 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 new file mode 100644 index 000000000000..be0ea5d714c5 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_py3.py @@ -0,0 +1,90 @@ +# 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 .directory_object_py3 import DirectoryObject + + +class Application(DirectoryObject): + """Active Directory application information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar object_id: The object ID. + :vartype object_id: str + :ivar deletion_timestamp: The time at which the directory object was + deleted. + :vartype deletion_timestamp: datetime + :param object_type: Required. Constant filled by server. + :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 + to other tenants. + :type available_to_other_tenants: bool + :param display_name: The display name of the application. + :type display_name: str + :param identifier_uris: A collection of URIs for the application. + :type identifier_uris: list[str] + :param reply_urls: A collection of reply URLs for the application. + :type reply_urls: list[str] + :param homepage: The home page of the application. + :type homepage: str + :param oauth2_allow_implicit_flow: Whether to allow implicit grant flow + for OAuth2 + :type oauth2_allow_implicit_flow: bool + """ + + _validation = { + 'object_id': {'readonly': True}, + 'deletion_timestamp': {'readonly': True}, + 'object_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + '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'}, + 'identifier_uris': {'key': 'identifierUris', 'type': '[str]'}, + 'reply_urls': {'key': 'replyUrls', 'type': '[str]'}, + 'homepage': {'key': 'homepage', 'type': 'str'}, + 'oauth2_allow_implicit_flow': {'key': 'oauth2AllowImplicitFlow', 'type': 'bool'}, + } + + 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 + self.identifier_uris = identifier_uris + self.reply_urls = reply_urls + self.homepage = homepage + self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow + self.object_type = 'Application' diff --git a/azure-graphrbac/azure/graphrbac/models/application_update_parameters.py b/azure-graphrbac/azure/graphrbac/models/application_update_parameters.py index a2ce3086fa1e..f1ebe6a01eca 100644 --- a/azure-graphrbac/azure/graphrbac/models/application_update_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/application_update_parameters.py @@ -58,15 +58,15 @@ class ApplicationUpdateParameters(Model): 'required_resource_access': {'key': 'requiredResourceAccess', 'type': '[RequiredResourceAccess]'}, } - def __init__(self, additional_properties=None, available_to_other_tenants=None, display_name=None, homepage=None, identifier_uris=None, reply_urls=None, key_credentials=None, password_credentials=None, oauth2_allow_implicit_flow=None, required_resource_access=None): - super(ApplicationUpdateParameters, self).__init__() - self.additional_properties = additional_properties - self.available_to_other_tenants = available_to_other_tenants - self.display_name = display_name - self.homepage = homepage - self.identifier_uris = identifier_uris - self.reply_urls = reply_urls - self.key_credentials = key_credentials - self.password_credentials = password_credentials - self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow - self.required_resource_access = required_resource_access + def __init__(self, **kwargs): + super(ApplicationUpdateParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.available_to_other_tenants = kwargs.get('available_to_other_tenants', None) + self.display_name = kwargs.get('display_name', None) + self.homepage = kwargs.get('homepage', None) + self.identifier_uris = kwargs.get('identifier_uris', None) + self.reply_urls = kwargs.get('reply_urls', None) + self.key_credentials = kwargs.get('key_credentials', None) + self.password_credentials = kwargs.get('password_credentials', None) + self.oauth2_allow_implicit_flow = kwargs.get('oauth2_allow_implicit_flow', None) + self.required_resource_access = kwargs.get('required_resource_access', None) diff --git a/azure-graphrbac/azure/graphrbac/models/application_update_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/application_update_parameters_py3.py new file mode 100644 index 000000000000..d0c1be0e15bf --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/application_update_parameters_py3.py @@ -0,0 +1,72 @@ +# 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 ApplicationUpdateParameters(Model): + """Request parameters for updating an existing application. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param available_to_other_tenants: Whether the application is available to + other tenants + :type available_to_other_tenants: bool + :param display_name: The display name of the application. + :type display_name: str + :param homepage: The home page of the application. + :type homepage: str + :param identifier_uris: A collection of URIs for the application. + :type identifier_uris: list[str] + :param reply_urls: A collection of reply URLs for the application. + :type reply_urls: list[str] + :param key_credentials: The list of KeyCredential objects. + :type key_credentials: list[~azure.graphrbac.models.KeyCredential] + :param password_credentials: The list of PasswordCredential objects. + :type password_credentials: + list[~azure.graphrbac.models.PasswordCredential] + :param oauth2_allow_implicit_flow: Whether to allow implicit grant flow + for OAuth2 + :type oauth2_allow_implicit_flow: bool + :param required_resource_access: Specifies resources that this application + requires access to and the set of OAuth permission scopes and application + roles that it needs under each of those resources. This pre-configuration + of required resource access drives the consent experience. + :type required_resource_access: + list[~azure.graphrbac.models.RequiredResourceAccess] + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'available_to_other_tenants': {'key': 'availableToOtherTenants', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'homepage': {'key': 'homepage', 'type': 'str'}, + 'identifier_uris': {'key': 'identifierUris', 'type': '[str]'}, + 'reply_urls': {'key': 'replyUrls', 'type': '[str]'}, + 'key_credentials': {'key': 'keyCredentials', 'type': '[KeyCredential]'}, + 'password_credentials': {'key': 'passwordCredentials', 'type': '[PasswordCredential]'}, + 'oauth2_allow_implicit_flow': {'key': 'oauth2AllowImplicitFlow', 'type': 'bool'}, + 'required_resource_access': {'key': 'requiredResourceAccess', 'type': '[RequiredResourceAccess]'}, + } + + def __init__(self, *, additional_properties=None, available_to_other_tenants: bool=None, display_name: str=None, homepage: str=None, identifier_uris=None, reply_urls=None, key_credentials=None, password_credentials=None, oauth2_allow_implicit_flow: bool=None, required_resource_access=None, **kwargs) -> None: + super(ApplicationUpdateParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.available_to_other_tenants = available_to_other_tenants + self.display_name = display_name + self.homepage = homepage + self.identifier_uris = identifier_uris + self.reply_urls = reply_urls + self.key_credentials = key_credentials + self.password_credentials = password_credentials + self.oauth2_allow_implicit_flow = oauth2_allow_implicit_flow + self.required_resource_access = required_resource_access diff --git a/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters.py b/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters.py index 4d5355f238c5..c4c682e15fb5 100644 --- a/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters.py @@ -15,13 +15,15 @@ class CheckGroupMembershipParameters(Model): """Request parameters for IsMemberOf API call. + 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 group_id: The object ID of the group to check. + :param group_id: Required. The object ID of the group to check. :type group_id: str - :param member_id: The object ID of the contact, group, user, or service - principal to check for membership in the specified group. + :param member_id: Required. The object ID of the contact, group, user, or + service principal to check for membership in the specified group. :type member_id: str """ @@ -36,8 +38,8 @@ class CheckGroupMembershipParameters(Model): 'member_id': {'key': 'memberId', 'type': 'str'}, } - def __init__(self, group_id, member_id, additional_properties=None): - super(CheckGroupMembershipParameters, self).__init__() - self.additional_properties = additional_properties - self.group_id = group_id - self.member_id = member_id + def __init__(self, **kwargs): + super(CheckGroupMembershipParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.group_id = kwargs.get('group_id', None) + self.member_id = kwargs.get('member_id', None) diff --git a/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters_py3.py new file mode 100644 index 000000000000..2731038c356d --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/check_group_membership_parameters_py3.py @@ -0,0 +1,45 @@ +# 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 CheckGroupMembershipParameters(Model): + """Request parameters for IsMemberOf API call. + + 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 group_id: Required. The object ID of the group to check. + :type group_id: str + :param member_id: Required. The object ID of the contact, group, user, or + service principal to check for membership in the specified group. + :type member_id: str + """ + + _validation = { + 'group_id': {'required': True}, + 'member_id': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'group_id': {'key': 'groupId', 'type': 'str'}, + 'member_id': {'key': 'memberId', 'type': 'str'}, + } + + def __init__(self, *, group_id: str, member_id: str, additional_properties=None, **kwargs) -> None: + super(CheckGroupMembershipParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.group_id = group_id + self.member_id = member_id diff --git a/azure-graphrbac/azure/graphrbac/models/check_group_membership_result.py b/azure-graphrbac/azure/graphrbac/models/check_group_membership_result.py index a27c56b5f520..b986abefdef0 100644 --- a/azure-graphrbac/azure/graphrbac/models/check_group_membership_result.py +++ b/azure-graphrbac/azure/graphrbac/models/check_group_membership_result.py @@ -29,7 +29,7 @@ class CheckGroupMembershipResult(Model): 'value': {'key': 'value', 'type': 'bool'}, } - def __init__(self, additional_properties=None, value=None): - super(CheckGroupMembershipResult, self).__init__() - self.additional_properties = additional_properties - self.value = value + def __init__(self, **kwargs): + super(CheckGroupMembershipResult, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/check_group_membership_result_py3.py b/azure-graphrbac/azure/graphrbac/models/check_group_membership_result_py3.py new file mode 100644 index 000000000000..dce500881ae1 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/check_group_membership_result_py3.py @@ -0,0 +1,35 @@ +# 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 CheckGroupMembershipResult(Model): + """Server response for IsMemberOf API call. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param value: True if the specified user, group, contact, or service + principal has either direct or transitive membership in the specified + group; otherwise, false. + :type value: bool + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'value': {'key': 'value', 'type': 'bool'}, + } + + def __init__(self, *, additional_properties=None, value: bool=None, **kwargs) -> None: + super(CheckGroupMembershipResult, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/directory_object.py b/azure-graphrbac/azure/graphrbac/models/directory_object.py index 9683fe507471..f8c52d0ddf3a 100644 --- a/azure-graphrbac/azure/graphrbac/models/directory_object.py +++ b/azure-graphrbac/azure/graphrbac/models/directory_object.py @@ -21,6 +21,8 @@ class DirectoryObject(Model): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -29,7 +31,7 @@ class DirectoryObject(Model): :ivar deletion_timestamp: The time at which the directory object was deleted. :vartype deletion_timestamp: datetime - :param object_type: Constant filled by server. + :param object_type: Required. Constant filled by server. :type object_type: str """ @@ -50,9 +52,9 @@ class DirectoryObject(Model): 'object_type': {'Application': 'Application', 'Group': 'ADGroup', 'ServicePrincipal': 'ServicePrincipal', 'User': 'User'} } - def __init__(self, additional_properties=None): - super(DirectoryObject, self).__init__() - self.additional_properties = additional_properties + def __init__(self, **kwargs): + super(DirectoryObject, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) self.object_id = None self.deletion_timestamp = None self.object_type = None 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/directory_object_py3.py b/azure-graphrbac/azure/graphrbac/models/directory_object_py3.py new file mode 100644 index 000000000000..181d66cc50d5 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/directory_object_py3.py @@ -0,0 +1,60 @@ +# 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 DirectoryObject(Model): + """Represents an Azure Active Directory object. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: Application, ADGroup, ServicePrincipal, User + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar object_id: The object ID. + :vartype object_id: str + :ivar deletion_timestamp: The time at which the directory object was + deleted. + :vartype deletion_timestamp: datetime + :param object_type: Required. Constant filled by server. + :type object_type: str + """ + + _validation = { + 'object_id': {'readonly': True}, + 'deletion_timestamp': {'readonly': True}, + 'object_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, + 'object_type': {'key': 'objectType', 'type': 'str'}, + } + + _subtype_map = { + 'object_type': {'Application': 'Application', 'Group': 'ADGroup', 'ServicePrincipal': 'ServicePrincipal', 'User': 'User'} + } + + def __init__(self, *, additional_properties=None, **kwargs) -> None: + super(DirectoryObject, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.object_id = None + self.deletion_timestamp = None + self.object_type = None diff --git a/azure-graphrbac/azure/graphrbac/models/domain.py b/azure-graphrbac/azure/graphrbac/models/domain.py index 9bb56c43d843..bc602c6fefd3 100644 --- a/azure-graphrbac/azure/graphrbac/models/domain.py +++ b/azure-graphrbac/azure/graphrbac/models/domain.py @@ -18,6 +18,8 @@ class Domain(Model): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -27,7 +29,7 @@ class Domain(Model): :vartype is_default: bool :ivar is_verified: if this domain's ownership is verified. :vartype is_verified: bool - :param name: the domain name. + :param name: Required. the domain name. :type name: str """ @@ -46,10 +48,10 @@ class Domain(Model): 'name': {'key': 'name', 'type': 'str'}, } - def __init__(self, name, additional_properties=None): - super(Domain, self).__init__() - self.additional_properties = additional_properties + def __init__(self, **kwargs): + super(Domain, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) self.authentication_type = None self.is_default = None self.is_verified = None - self.name = name + self.name = kwargs.get('name', None) diff --git a/azure-graphrbac/azure/graphrbac/models/domain_py3.py b/azure-graphrbac/azure/graphrbac/models/domain_py3.py new file mode 100644 index 000000000000..69bb7aef0387 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/domain_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 Domain(Model): + """Active Directory Domain information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar authentication_type: the type of the authentication into the domain. + :vartype authentication_type: str + :ivar is_default: if this is the default domain in the tenant. + :vartype is_default: bool + :ivar is_verified: if this domain's ownership is verified. + :vartype is_verified: bool + :param name: Required. the domain name. + :type name: str + """ + + _validation = { + 'authentication_type': {'readonly': True}, + 'is_default': {'readonly': True}, + 'is_verified': {'readonly': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'authentication_type': {'key': 'authenticationType', 'type': 'str'}, + 'is_default': {'key': 'isDefault', 'type': 'bool'}, + 'is_verified': {'key': 'isVerified', 'type': 'bool'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__(self, *, name: str, additional_properties=None, **kwargs) -> None: + super(Domain, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.authentication_type = None + self.is_default = None + self.is_verified = None + self.name = name diff --git a/azure-graphrbac/azure/graphrbac/models/get_objects_parameters.py b/azure-graphrbac/azure/graphrbac/models/get_objects_parameters.py index eb0fb5333f13..cfc3b3c93c40 100644 --- a/azure-graphrbac/azure/graphrbac/models/get_objects_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/get_objects_parameters.py @@ -15,6 +15,8 @@ class GetObjectsParameters(Model): """Request parameters for the GetObjectsByObjectIds API. + 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] @@ -22,8 +24,8 @@ class GetObjectsParameters(Model): :type object_ids: list[str] :param types: The requested object types. :type types: list[str] - :param include_directory_object_references: If true, also searches for - object IDs in the partner tenant. + :param include_directory_object_references: Required. If true, also + searches for object IDs in the partner tenant. :type include_directory_object_references: bool """ @@ -38,9 +40,9 @@ class GetObjectsParameters(Model): 'include_directory_object_references': {'key': 'includeDirectoryObjectReferences', 'type': 'bool'}, } - def __init__(self, include_directory_object_references, additional_properties=None, object_ids=None, types=None): - super(GetObjectsParameters, self).__init__() - self.additional_properties = additional_properties - self.object_ids = object_ids - self.types = types - self.include_directory_object_references = include_directory_object_references + def __init__(self, **kwargs): + super(GetObjectsParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.object_ids = kwargs.get('object_ids', None) + self.types = kwargs.get('types', None) + self.include_directory_object_references = kwargs.get('include_directory_object_references', None) diff --git a/azure-graphrbac/azure/graphrbac/models/get_objects_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/get_objects_parameters_py3.py new file mode 100644 index 000000000000..1c7620f14b78 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/get_objects_parameters_py3.py @@ -0,0 +1,48 @@ +# 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 GetObjectsParameters(Model): + """Request parameters for the GetObjectsByObjectIds API. + + 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 object_ids: The requested object IDs. + :type object_ids: list[str] + :param types: The requested object types. + :type types: list[str] + :param include_directory_object_references: Required. If true, also + searches for object IDs in the partner tenant. + :type include_directory_object_references: bool + """ + + _validation = { + 'include_directory_object_references': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_ids': {'key': 'objectIds', 'type': '[str]'}, + 'types': {'key': 'types', 'type': '[str]'}, + 'include_directory_object_references': {'key': 'includeDirectoryObjectReferences', 'type': 'bool'}, + } + + def __init__(self, *, include_directory_object_references: bool, additional_properties=None, object_ids=None, types=None, **kwargs) -> None: + super(GetObjectsParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.object_ids = object_ids + self.types = types + self.include_directory_object_references = include_directory_object_references diff --git a/azure-graphrbac/azure/graphrbac/models/graph_error.py b/azure-graphrbac/azure/graphrbac/models/graph_error.py index 4c7c3a0110ca..45d8eef94eba 100644 --- a/azure-graphrbac/azure/graphrbac/models/graph_error.py +++ b/azure-graphrbac/azure/graphrbac/models/graph_error.py @@ -27,10 +27,10 @@ class GraphError(Model): 'message': {'key': 'odata\\.error.message.value', 'type': 'str'}, } - def __init__(self, code=None, message=None): - super(GraphError, self).__init__() - self.code = code - self.message = message + def __init__(self, **kwargs): + super(GraphError, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) class GraphErrorException(HttpOperationError): diff --git a/azure-graphrbac/azure/graphrbac/models/graph_error_py3.py b/azure-graphrbac/azure/graphrbac/models/graph_error_py3.py new file mode 100644 index 000000000000..f3d18f840b31 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/graph_error_py3.py @@ -0,0 +1,45 @@ +# 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 +from msrest.exceptions import HttpOperationError + + +class GraphError(Model): + """Active Directory error information. + + :param code: Error code. + :type code: str + :param message: Error message value. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'odata\\.error.code', 'type': 'str'}, + 'message': {'key': 'odata\\.error.message.value', 'type': 'str'}, + } + + def __init__(self, *, code: str=None, message: str=None, **kwargs) -> None: + super(GraphError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class GraphErrorException(HttpOperationError): + """Server responsed with exception of type: 'GraphError'. + + :param deserialize: A deserializer + :param response: Server response to be deserialized. + """ + + def __init__(self, deserialize, response, *args): + + super(GraphErrorException, self).__init__(deserialize, response, 'GraphError', *args) diff --git a/azure-graphrbac/azure/graphrbac/models/graph_rbac_management_client_enums.py b/azure-graphrbac/azure/graphrbac/models/graph_rbac_management_client_enums.py index 99b1b1396548..8c62d75101a2 100644 --- a/azure-graphrbac/azure/graphrbac/models/graph_rbac_management_client_enums.py +++ b/azure-graphrbac/azure/graphrbac/models/graph_rbac_management_client_enums.py @@ -12,7 +12,7 @@ from enum import Enum -class UserType(Enum): +class UserType(str, Enum): member = "Member" guest = "Guest" diff --git a/azure-graphrbac/azure/graphrbac/models/group_add_member_parameters.py b/azure-graphrbac/azure/graphrbac/models/group_add_member_parameters.py index bccfccf03c8b..408c7c280e19 100644 --- a/azure-graphrbac/azure/graphrbac/models/group_add_member_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/group_add_member_parameters.py @@ -15,10 +15,12 @@ class GroupAddMemberParameters(Model): """Request parameters for adding a member to a group. + 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: A member object URL, such as + :param url: Required. A member 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 member @@ -35,7 +37,7 @@ class GroupAddMemberParameters(Model): 'url': {'key': 'url', 'type': 'str'}, } - def __init__(self, url, additional_properties=None): - super(GroupAddMemberParameters, self).__init__() - self.additional_properties = additional_properties - self.url = url + def __init__(self, **kwargs): + super(GroupAddMemberParameters, 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/group_add_member_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/group_add_member_parameters_py3.py new file mode 100644 index 000000000000..bf4b12a1a32b --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/group_add_member_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 GroupAddMemberParameters(Model): + """Request parameters for adding a member to a group. + + 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 member 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 member + (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(GroupAddMemberParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.url = url diff --git a/azure-graphrbac/azure/graphrbac/models/group_create_parameters.py b/azure-graphrbac/azure/graphrbac/models/group_create_parameters.py index 6eaf7ddcbe41..81a35b77c8cf 100644 --- a/azure-graphrbac/azure/graphrbac/models/group_create_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/group_create_parameters.py @@ -18,20 +18,22 @@ class GroupCreateParameters(Model): Variables are only populated by the server, and will be ignored when sending a request. + 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 display_name: Group display name + :param display_name: Required. Group display name :type display_name: str - :ivar 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. - Default value: False . + :ivar mail_enabled: Required. Whether the group is mail-enabled. Must be + false. This is because only pure security groups can be created using the + Graph API. Default value: False . :vartype mail_enabled: bool - :param mail_nickname: Mail nickname + :param mail_nickname: Required. Mail nickname :type mail_nickname: str - :ivar security_enabled: Whether the group is a security group. Must be - true. This is because only pure security groups can be created using the - Graph API. Default value: True . + :ivar security_enabled: Required. Whether the group is a security group. + Must be true. This is because only pure security groups can be created + using the Graph API. Default value: True . :vartype security_enabled: bool """ @@ -54,8 +56,8 @@ class GroupCreateParameters(Model): security_enabled = True - def __init__(self, display_name, mail_nickname, additional_properties=None): - super(GroupCreateParameters, self).__init__() - self.additional_properties = additional_properties - self.display_name = display_name - self.mail_nickname = mail_nickname + def __init__(self, **kwargs): + super(GroupCreateParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.display_name = kwargs.get('display_name', None) + self.mail_nickname = kwargs.get('mail_nickname', None) diff --git a/azure-graphrbac/azure/graphrbac/models/group_create_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/group_create_parameters_py3.py new file mode 100644 index 000000000000..6a06875ce127 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/group_create_parameters_py3.py @@ -0,0 +1,63 @@ +# 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 GroupCreateParameters(Model): + """Request parameters for creating a new group. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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 display_name: Required. Group display name + :type display_name: str + :ivar mail_enabled: Required. Whether the group is mail-enabled. Must be + false. This is because only pure security groups can be created using the + Graph API. Default value: False . + :vartype mail_enabled: bool + :param mail_nickname: Required. Mail nickname + :type mail_nickname: str + :ivar security_enabled: Required. Whether the group is a security group. + Must be true. This is because only pure security groups can be created + using the Graph API. Default value: True . + :vartype security_enabled: bool + """ + + _validation = { + 'display_name': {'required': True}, + 'mail_enabled': {'required': True, 'constant': True}, + 'mail_nickname': {'required': True}, + 'security_enabled': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + '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_enabled = False + + security_enabled = True + + def __init__(self, *, display_name: str, mail_nickname: str, additional_properties=None, **kwargs) -> None: + super(GroupCreateParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.display_name = display_name + self.mail_nickname = mail_nickname diff --git a/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters.py b/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters.py index 27693c062e60..75ed0f53dcc5 100644 --- a/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters.py @@ -15,12 +15,14 @@ class GroupGetMemberGroupsParameters(Model): """Request parameters for GetMemberGroups API call. + 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 security_enabled_only: If true, only membership in security-enabled - groups should be checked. Otherwise, membership in all groups should be - checked. + :param security_enabled_only: Required. If true, only membership in + security-enabled groups should be checked. Otherwise, membership in all + groups should be checked. :type security_enabled_only: bool """ @@ -33,7 +35,7 @@ class GroupGetMemberGroupsParameters(Model): 'security_enabled_only': {'key': 'securityEnabledOnly', 'type': 'bool'}, } - def __init__(self, security_enabled_only, additional_properties=None): - super(GroupGetMemberGroupsParameters, self).__init__() - self.additional_properties = additional_properties - self.security_enabled_only = security_enabled_only + def __init__(self, **kwargs): + super(GroupGetMemberGroupsParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.security_enabled_only = kwargs.get('security_enabled_only', None) diff --git a/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters_py3.py new file mode 100644 index 000000000000..2ff9062d6d94 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/group_get_member_groups_parameters_py3.py @@ -0,0 +1,41 @@ +# 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 GroupGetMemberGroupsParameters(Model): + """Request parameters for GetMemberGroups API call. + + 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 security_enabled_only: Required. If true, only membership in + security-enabled groups should be checked. Otherwise, membership in all + groups should be checked. + :type security_enabled_only: bool + """ + + _validation = { + 'security_enabled_only': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'security_enabled_only': {'key': 'securityEnabledOnly', 'type': 'bool'}, + } + + def __init__(self, *, security_enabled_only: bool, additional_properties=None, **kwargs) -> None: + super(GroupGetMemberGroupsParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.security_enabled_only = security_enabled_only diff --git a/azure-graphrbac/azure/graphrbac/models/key_credential.py b/azure-graphrbac/azure/graphrbac/models/key_credential.py index 70f83b80b1f6..ed56f7672311 100644 --- a/azure-graphrbac/azure/graphrbac/models/key_credential.py +++ b/azure-graphrbac/azure/graphrbac/models/key_credential.py @@ -46,13 +46,13 @@ class KeyCredential(Model): 'custom_key_identifier': {'key': 'customKeyIdentifier', 'type': 'bytearray'}, } - def __init__(self, additional_properties=None, start_date=None, end_date=None, value=None, key_id=None, usage=None, type=None, custom_key_identifier=None): - super(KeyCredential, self).__init__() - self.additional_properties = additional_properties - self.start_date = start_date - self.end_date = end_date - self.value = value - self.key_id = key_id - self.usage = usage - self.type = type - self.custom_key_identifier = custom_key_identifier + def __init__(self, **kwargs): + super(KeyCredential, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.value = kwargs.get('value', None) + self.key_id = kwargs.get('key_id', None) + self.usage = kwargs.get('usage', None) + self.type = kwargs.get('type', None) + self.custom_key_identifier = kwargs.get('custom_key_identifier', None) diff --git a/azure-graphrbac/azure/graphrbac/models/key_credential_py3.py b/azure-graphrbac/azure/graphrbac/models/key_credential_py3.py new file mode 100644 index 000000000000..b6550d8d11de --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/key_credential_py3.py @@ -0,0 +1,58 @@ +# 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 KeyCredential(Model): + """Active Directory Key Credential information. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param start_date: Start date. + :type start_date: datetime + :param end_date: End date. + :type end_date: datetime + :param value: Key value. + :type value: str + :param key_id: Key ID. + :type key_id: str + :param usage: Usage. Acceptable values are 'Verify' and 'Sign'. + :type usage: str + :param type: Type. Acceptable values are 'AsymmetricX509Cert' and + 'Symmetric'. + :type type: str + :param custom_key_identifier: Custom Key Identifier + :type custom_key_identifier: bytearray + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'value': {'key': 'value', 'type': 'str'}, + 'key_id': {'key': 'keyId', 'type': 'str'}, + 'usage': {'key': 'usage', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'custom_key_identifier': {'key': 'customKeyIdentifier', 'type': 'bytearray'}, + } + + def __init__(self, *, additional_properties=None, start_date=None, end_date=None, value: str=None, key_id: str=None, usage: str=None, type: str=None, custom_key_identifier: bytearray=None, **kwargs) -> None: + super(KeyCredential, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.start_date = start_date + self.end_date = end_date + self.value = value + self.key_id = key_id + self.usage = usage + self.type = type + self.custom_key_identifier = custom_key_identifier diff --git a/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters.py b/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters.py index 9f0596127112..4263c460c6f4 100644 --- a/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters.py @@ -15,7 +15,9 @@ class KeyCredentialsUpdateParameters(Model): """Request parameters for a KeyCredentials update operation. - :param value: A collection of KeyCredentials. + All required parameters must be populated in order to send to Azure. + + :param value: Required. A collection of KeyCredentials. :type value: list[~azure.graphrbac.models.KeyCredential] """ @@ -27,6 +29,6 @@ class KeyCredentialsUpdateParameters(Model): 'value': {'key': 'value', 'type': '[KeyCredential]'}, } - def __init__(self, value): - super(KeyCredentialsUpdateParameters, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(KeyCredentialsUpdateParameters, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters_py3.py new file mode 100644 index 000000000000..acabfe64b1db --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/key_credentials_update_parameters_py3.py @@ -0,0 +1,34 @@ +# 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 KeyCredentialsUpdateParameters(Model): + """Request parameters for a KeyCredentials update operation. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A collection of KeyCredentials. + :type value: list[~azure.graphrbac.models.KeyCredential] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyCredential]'}, + } + + def __init__(self, *, value, **kwargs) -> None: + super(KeyCredentialsUpdateParameters, self).__init__(**kwargs) + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/password_credential.py b/azure-graphrbac/azure/graphrbac/models/password_credential.py index d10a08a6cdf9..28d9e2709458 100644 --- a/azure-graphrbac/azure/graphrbac/models/password_credential.py +++ b/azure-graphrbac/azure/graphrbac/models/password_credential.py @@ -36,10 +36,10 @@ class PasswordCredential(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, additional_properties=None, start_date=None, end_date=None, key_id=None, value=None): - super(PasswordCredential, self).__init__() - self.additional_properties = additional_properties - self.start_date = start_date - self.end_date = end_date - self.key_id = key_id - self.value = value + def __init__(self, **kwargs): + super(PasswordCredential, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.start_date = kwargs.get('start_date', None) + self.end_date = kwargs.get('end_date', None) + self.key_id = kwargs.get('key_id', None) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/password_credential_py3.py b/azure-graphrbac/azure/graphrbac/models/password_credential_py3.py new file mode 100644 index 000000000000..102f23659286 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/password_credential_py3.py @@ -0,0 +1,45 @@ +# 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 PasswordCredential(Model): + """Active Directory Password Credential information. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param start_date: Start date. + :type start_date: datetime + :param end_date: End date. + :type end_date: datetime + :param key_id: Key ID. + :type key_id: str + :param value: Key value. + :type value: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'start_date': {'key': 'startDate', 'type': 'iso-8601'}, + 'end_date': {'key': 'endDate', 'type': 'iso-8601'}, + 'key_id': {'key': 'keyId', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, start_date=None, end_date=None, key_id: str=None, value: str=None, **kwargs) -> None: + super(PasswordCredential, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.start_date = start_date + self.end_date = end_date + self.key_id = key_id + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters.py b/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters.py index 46f34f2f086a..0ac238bdf6d7 100644 --- a/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters.py @@ -15,7 +15,9 @@ class PasswordCredentialsUpdateParameters(Model): """Request parameters for a PasswordCredentials update operation. - :param value: A collection of PasswordCredentials. + All required parameters must be populated in order to send to Azure. + + :param value: Required. A collection of PasswordCredentials. :type value: list[~azure.graphrbac.models.PasswordCredential] """ @@ -27,6 +29,6 @@ class PasswordCredentialsUpdateParameters(Model): 'value': {'key': 'value', 'type': '[PasswordCredential]'}, } - def __init__(self, value): - super(PasswordCredentialsUpdateParameters, self).__init__() - self.value = value + def __init__(self, **kwargs): + super(PasswordCredentialsUpdateParameters, self).__init__(**kwargs) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters_py3.py new file mode 100644 index 000000000000..7410950c6120 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/password_credentials_update_parameters_py3.py @@ -0,0 +1,34 @@ +# 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 PasswordCredentialsUpdateParameters(Model): + """Request parameters for a PasswordCredentials update operation. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. A collection of PasswordCredentials. + :type value: list[~azure.graphrbac.models.PasswordCredential] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PasswordCredential]'}, + } + + def __init__(self, *, value, **kwargs) -> None: + super(PasswordCredentialsUpdateParameters, self).__init__(**kwargs) + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/password_profile.py b/azure-graphrbac/azure/graphrbac/models/password_profile.py index ab79d5990cb4..7da56ef55c4c 100644 --- a/azure-graphrbac/azure/graphrbac/models/password_profile.py +++ b/azure-graphrbac/azure/graphrbac/models/password_profile.py @@ -15,10 +15,12 @@ class PasswordProfile(Model): """The password profile associated with a user. + 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 password: Password + :param password: Required. Password :type password: str :param force_change_password_next_login: Whether to force a password change on next login. @@ -35,8 +37,8 @@ class PasswordProfile(Model): 'force_change_password_next_login': {'key': 'forceChangePasswordNextLogin', 'type': 'bool'}, } - def __init__(self, password, additional_properties=None, force_change_password_next_login=None): - super(PasswordProfile, self).__init__() - self.additional_properties = additional_properties - self.password = password - self.force_change_password_next_login = force_change_password_next_login + def __init__(self, **kwargs): + super(PasswordProfile, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.password = kwargs.get('password', None) + self.force_change_password_next_login = kwargs.get('force_change_password_next_login', None) diff --git a/azure-graphrbac/azure/graphrbac/models/password_profile_py3.py b/azure-graphrbac/azure/graphrbac/models/password_profile_py3.py new file mode 100644 index 000000000000..bf3a10197609 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/password_profile_py3.py @@ -0,0 +1,44 @@ +# 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 PasswordProfile(Model): + """The password profile associated with a user. + + 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 password: Required. Password + :type password: str + :param force_change_password_next_login: Whether to force a password + change on next login. + :type force_change_password_next_login: bool + """ + + _validation = { + 'password': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'password': {'key': 'password', 'type': 'str'}, + 'force_change_password_next_login': {'key': 'forceChangePasswordNextLogin', 'type': 'bool'}, + } + + def __init__(self, *, password: str, additional_properties=None, force_change_password_next_login: bool=None, **kwargs) -> None: + super(PasswordProfile, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.password = password + self.force_change_password_next_login = force_change_password_next_login diff --git a/azure-graphrbac/azure/graphrbac/models/permissions.py b/azure-graphrbac/azure/graphrbac/models/permissions.py index 040966e7de6d..d433d559b540 100644 --- a/azure-graphrbac/azure/graphrbac/models/permissions.py +++ b/azure-graphrbac/azure/graphrbac/models/permissions.py @@ -45,13 +45,13 @@ class Permissions(Model): 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, } - def __init__(self, odatatype=None, client_id=None, consent_type=None, principal_id=None, resource_id=None, scope=None, start_time=None, expiry_time=None): - super(Permissions, self).__init__() - self.odatatype = odatatype - self.client_id = client_id - self.consent_type = consent_type - self.principal_id = principal_id - self.resource_id = resource_id - self.scope = scope - self.start_time = start_time - self.expiry_time = expiry_time + def __init__(self, **kwargs): + super(Permissions, self).__init__(**kwargs) + self.odatatype = kwargs.get('odatatype', None) + self.client_id = kwargs.get('client_id', None) + self.consent_type = kwargs.get('consent_type', None) + self.principal_id = kwargs.get('principal_id', None) + self.resource_id = kwargs.get('resource_id', None) + self.scope = kwargs.get('scope', None) + self.start_time = kwargs.get('start_time', None) + self.expiry_time = kwargs.get('expiry_time', None) diff --git a/azure-graphrbac/azure/graphrbac/models/permissions_py3.py b/azure-graphrbac/azure/graphrbac/models/permissions_py3.py new file mode 100644 index 000000000000..6f3211d46a1c --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/permissions_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 Permissions(Model): + """Permissions. + + :param odatatype: Microsoft.DirectoryServices.OAuth2PermissionGrant + :type odatatype: str + :param client_id: The objectId of the Service Principal associated with + the app + :type client_id: str + :param consent_type: Typically set to AllPrincipals + :type consent_type: str + :param principal_id: Set to null if AllPrincipals is set + :type principal_id: object + :param resource_id: Service Principal Id of the resource you want to grant + :type resource_id: str + :param scope: Typically set to user_impersonation + :type scope: str + :param start_time: Start time for TTL + :type start_time: str + :param expiry_time: Expiry time for TTL + :type expiry_time: str + """ + + _attribute_map = { + 'odatatype': {'key': 'odata\\.type', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'consent_type': {'key': 'consentType', 'type': 'str'}, + 'principal_id': {'key': 'principalId', 'type': 'object'}, + 'resource_id': {'key': 'resourceId', 'type': 'str'}, + 'scope': {'key': 'scope', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'str'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, + } + + def __init__(self, *, odatatype: str=None, client_id: str=None, consent_type: str=None, principal_id=None, resource_id: str=None, scope: str=None, start_time: str=None, expiry_time: str=None, **kwargs) -> None: + super(Permissions, self).__init__(**kwargs) + self.odatatype = odatatype + self.client_id = client_id + self.consent_type = consent_type + self.principal_id = principal_id + self.resource_id = resource_id + self.scope = scope + self.start_time = start_time + self.expiry_time = expiry_time diff --git a/azure-graphrbac/azure/graphrbac/models/required_resource_access.py b/azure-graphrbac/azure/graphrbac/models/required_resource_access.py index 35e6dcf3624f..b8d953263323 100644 --- a/azure-graphrbac/azure/graphrbac/models/required_resource_access.py +++ b/azure-graphrbac/azure/graphrbac/models/required_resource_access.py @@ -20,11 +20,13 @@ class RequiredResourceAccess(Model): application. The requiredResourceAccess property of the Application entity is a collection of ReqiredResourceAccess. + 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 resource_access: The list of OAuth2.0 permission scopes and app - roles that the application requires from the specified resource. + :param resource_access: Required. The list of OAuth2.0 permission scopes + and app roles that the application requires from the specified resource. :type resource_access: list[~azure.graphrbac.models.ResourceAccess] :param resource_app_id: The unique identifier for the resource that the application requires access to. This should be equal to the appId declared @@ -42,8 +44,8 @@ class RequiredResourceAccess(Model): 'resource_app_id': {'key': 'resourceAppId', 'type': 'str'}, } - def __init__(self, resource_access, additional_properties=None, resource_app_id=None): - super(RequiredResourceAccess, self).__init__() - self.additional_properties = additional_properties - self.resource_access = resource_access - self.resource_app_id = resource_app_id + def __init__(self, **kwargs): + super(RequiredResourceAccess, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.resource_access = kwargs.get('resource_access', None) + self.resource_app_id = kwargs.get('resource_app_id', None) diff --git a/azure-graphrbac/azure/graphrbac/models/required_resource_access_py3.py b/azure-graphrbac/azure/graphrbac/models/required_resource_access_py3.py new file mode 100644 index 000000000000..059d04af9119 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/required_resource_access_py3.py @@ -0,0 +1,51 @@ +# 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 RequiredResourceAccess(Model): + """Specifies the set of OAuth 2.0 permission scopes and app roles under the + specified resource that an application requires access to. The specified + OAuth 2.0 permission scopes may be requested by client applications + (through the requiredResourceAccess collection) when calling a resource + application. The requiredResourceAccess property of the Application entity + is a collection of ReqiredResourceAccess. + + 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 resource_access: Required. The list of OAuth2.0 permission scopes + and app roles that the application requires from the specified resource. + :type resource_access: list[~azure.graphrbac.models.ResourceAccess] + :param resource_app_id: The unique identifier for the resource that the + application requires access to. This should be equal to the appId declared + on the target resource application. + :type resource_app_id: str + """ + + _validation = { + 'resource_access': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'resource_access': {'key': 'resourceAccess', 'type': '[ResourceAccess]'}, + 'resource_app_id': {'key': 'resourceAppId', 'type': 'str'}, + } + + def __init__(self, *, resource_access, additional_properties=None, resource_app_id: str=None, **kwargs) -> None: + super(RequiredResourceAccess, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.resource_access = resource_access + self.resource_app_id = resource_app_id diff --git a/azure-graphrbac/azure/graphrbac/models/resource_access.py b/azure-graphrbac/azure/graphrbac/models/resource_access.py index d06699c5739d..be02fa75fc61 100644 --- a/azure-graphrbac/azure/graphrbac/models/resource_access.py +++ b/azure-graphrbac/azure/graphrbac/models/resource_access.py @@ -17,11 +17,13 @@ class ResourceAccess(Model): requires. The resourceAccess property of the RequiredResourceAccess type is a collection of ResourceAccess. + 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 id: The unique identifier for one of the OAuth2Permission or - AppRole instances that the resource application exposes. + :param id: Required. The unique identifier for one of the OAuth2Permission + or AppRole instances that the resource application exposes. :type id: str :param type: Specifies whether the id property references an OAuth2Permission or an AppRole. Possible values are "scope" or "role". @@ -38,8 +40,8 @@ class ResourceAccess(Model): 'type': {'key': 'type', 'type': 'str'}, } - def __init__(self, id, additional_properties=None, type=None): - super(ResourceAccess, self).__init__() - self.additional_properties = additional_properties - self.id = id - self.type = type + def __init__(self, **kwargs): + super(ResourceAccess, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.id = kwargs.get('id', None) + self.type = kwargs.get('type', None) diff --git a/azure-graphrbac/azure/graphrbac/models/resource_access_py3.py b/azure-graphrbac/azure/graphrbac/models/resource_access_py3.py new file mode 100644 index 000000000000..ec6134ea1e0f --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/resource_access_py3.py @@ -0,0 +1,47 @@ +# 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 ResourceAccess(Model): + """Specifies an OAuth 2.0 permission scope or an app role that an application + requires. The resourceAccess property of the RequiredResourceAccess type is + a collection of ResourceAccess. + + 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 id: Required. The unique identifier for one of the OAuth2Permission + or AppRole instances that the resource application exposes. + :type id: str + :param type: Specifies whether the id property references an + OAuth2Permission or an AppRole. Possible values are "scope" or "role". + :type type: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'id': {'key': 'id', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__(self, *, id: str, additional_properties=None, type: str=None, **kwargs) -> None: + super(ResourceAccess, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.id = id + self.type = type diff --git a/azure-graphrbac/azure/graphrbac/models/service_principal.py b/azure-graphrbac/azure/graphrbac/models/service_principal.py index 37d9382b1c79..d68f9140ce40 100644 --- a/azure-graphrbac/azure/graphrbac/models/service_principal.py +++ b/azure-graphrbac/azure/graphrbac/models/service_principal.py @@ -18,6 +18,8 @@ class ServicePrincipal(DirectoryObject): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -26,12 +28,16 @@ class ServicePrincipal(DirectoryObject): :ivar deletion_timestamp: The time at which the directory object was deleted. :vartype deletion_timestamp: datetime - :param object_type: Constant filled by server. + :param object_type: Required. Constant filled by server. :type object_type: str :param display_name: The display name of the service principal. :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] """ @@ -49,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=None, app_id=None, service_principal_names=None): - super(ServicePrincipal, self).__init__(additional_properties=additional_properties) - self.display_name = display_name - self.app_id = app_id - self.service_principal_names = service_principal_names + 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_create_parameters.py b/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters.py index 54b49b0e2c8c..a788a73032e7 100644 --- a/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters.py @@ -15,12 +15,14 @@ class ServicePrincipalCreateParameters(Model): """Request parameters for creating a new service principal. + 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 app_id: application Id + :param app_id: Required. application Id :type app_id: str - :param account_enabled: Whether the account is enabled + :param account_enabled: Required. Whether the account is enabled :type account_enabled: bool :param key_credentials: A collection of KeyCredential objects. :type key_credentials: list[~azure.graphrbac.models.KeyCredential] @@ -42,10 +44,10 @@ class ServicePrincipalCreateParameters(Model): 'password_credentials': {'key': 'passwordCredentials', 'type': '[PasswordCredential]'}, } - def __init__(self, app_id, account_enabled, additional_properties=None, key_credentials=None, password_credentials=None): - super(ServicePrincipalCreateParameters, self).__init__() - self.additional_properties = additional_properties - self.app_id = app_id - self.account_enabled = account_enabled - self.key_credentials = key_credentials - self.password_credentials = password_credentials + def __init__(self, **kwargs): + super(ServicePrincipalCreateParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.app_id = kwargs.get('app_id', None) + self.account_enabled = kwargs.get('account_enabled', None) + self.key_credentials = kwargs.get('key_credentials', None) + self.password_credentials = kwargs.get('password_credentials', None) diff --git a/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters_py3.py new file mode 100644 index 000000000000..b5a5b4e29c46 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/service_principal_create_parameters_py3.py @@ -0,0 +1,53 @@ +# 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 ServicePrincipalCreateParameters(Model): + """Request parameters for creating a new service principal. + + 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 app_id: Required. application Id + :type app_id: str + :param account_enabled: Required. Whether the account is enabled + :type account_enabled: bool + :param key_credentials: A collection of KeyCredential objects. + :type key_credentials: list[~azure.graphrbac.models.KeyCredential] + :param password_credentials: A collection of PasswordCredential objects + :type password_credentials: + list[~azure.graphrbac.models.PasswordCredential] + """ + + _validation = { + 'app_id': {'required': True}, + 'account_enabled': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'account_enabled': {'key': 'accountEnabled', 'type': 'bool'}, + 'key_credentials': {'key': 'keyCredentials', 'type': '[KeyCredential]'}, + 'password_credentials': {'key': 'passwordCredentials', 'type': '[PasswordCredential]'}, + } + + def __init__(self, *, app_id: str, account_enabled: bool, additional_properties=None, key_credentials=None, password_credentials=None, **kwargs) -> None: + super(ServicePrincipalCreateParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.app_id = app_id + self.account_enabled = account_enabled + self.key_credentials = key_credentials + self.password_credentials = password_credentials diff --git a/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py b/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py new file mode 100644 index 000000000000..d9dce61da9b8 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/service_principal_py3.py @@ -0,0 +1,68 @@ +# 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 .directory_object_py3 import DirectoryObject + + +class ServicePrincipal(DirectoryObject): + """Active Directory service principal information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar object_id: The object ID. + :vartype object_id: str + :ivar deletion_timestamp: The time at which the directory object was + deleted. + :vartype deletion_timestamp: datetime + :param object_type: Required. Constant filled by server. + :type object_type: str + :param display_name: The display name of the service principal. + :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] + """ + + _validation = { + 'object_id': {'readonly': True}, + 'deletion_timestamp': {'readonly': True}, + 'object_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, + '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, 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/models/sign_in_name.py b/azure-graphrbac/azure/graphrbac/models/sign_in_name.py index eff41300e667..88bc84483e95 100644 --- a/azure-graphrbac/azure/graphrbac/models/sign_in_name.py +++ b/azure-graphrbac/azure/graphrbac/models/sign_in_name.py @@ -33,8 +33,8 @@ class SignInName(Model): 'value': {'key': 'value', 'type': 'str'}, } - def __init__(self, additional_properties=None, type=None, value=None): - super(SignInName, self).__init__() - self.additional_properties = additional_properties - self.type = type - self.value = value + def __init__(self, **kwargs): + super(SignInName, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.type = kwargs.get('type', None) + self.value = kwargs.get('value', None) diff --git a/azure-graphrbac/azure/graphrbac/models/sign_in_name_py3.py b/azure-graphrbac/azure/graphrbac/models/sign_in_name_py3.py new file mode 100644 index 000000000000..5832de5e8285 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/sign_in_name_py3.py @@ -0,0 +1,40 @@ +# 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 SignInName(Model): + """Contains information about a sign-in name of a local account user in an + Azure Active Directory B2C tenant. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param type: A string value that can be used to classify user sign-in + types in your directory, such as 'emailAddress' or 'userName'. + :type type: str + :param value: The sign-in used by the local account. Must be unique across + the company/tenant. For example, 'johnc@example.com'. + :type value: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'type': {'key': 'type', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, type: str=None, value: str=None, **kwargs) -> None: + super(SignInName, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.type = type + self.value = value diff --git a/azure-graphrbac/azure/graphrbac/models/user.py b/azure-graphrbac/azure/graphrbac/models/user.py index bfe788dc93c9..f9416be17c45 100644 --- a/azure-graphrbac/azure/graphrbac/models/user.py +++ b/azure-graphrbac/azure/graphrbac/models/user.py @@ -18,6 +18,8 @@ class User(DirectoryObject): Variables are only populated by the server, and will be ignored when sending a request. + 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] @@ -26,7 +28,7 @@ class User(DirectoryObject): :ivar deletion_timestamp: The time at which the directory object was deleted. :vartype deletion_timestamp: datetime - :param object_type: Constant filled by server. + :param object_type: Required. Constant filled by server. :type object_type: str :param immutable_id: This must be specified if you are using a federated domain for the user's userPrincipalName (UPN) property when creating a new @@ -84,17 +86,17 @@ class User(DirectoryObject): 'sign_in_names': {'key': 'signInNames', 'type': '[SignInName]'}, } - def __init__(self, additional_properties=None, immutable_id=None, usage_location=None, given_name=None, surname=None, user_type=None, account_enabled=None, display_name=None, user_principal_name=None, mail_nickname=None, mail=None, sign_in_names=None): - super(User, self).__init__(additional_properties=additional_properties) - self.immutable_id = immutable_id - self.usage_location = usage_location - self.given_name = given_name - self.surname = surname - self.user_type = user_type - self.account_enabled = account_enabled - self.display_name = display_name - self.user_principal_name = user_principal_name - self.mail_nickname = mail_nickname - self.mail = mail - self.sign_in_names = sign_in_names + def __init__(self, **kwargs): + super(User, self).__init__(**kwargs) + self.immutable_id = kwargs.get('immutable_id', None) + self.usage_location = kwargs.get('usage_location', None) + self.given_name = kwargs.get('given_name', None) + self.surname = kwargs.get('surname', None) + self.user_type = kwargs.get('user_type', None) + self.account_enabled = kwargs.get('account_enabled', None) + self.display_name = kwargs.get('display_name', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + self.mail_nickname = kwargs.get('mail_nickname', None) + self.mail = kwargs.get('mail', None) + self.sign_in_names = kwargs.get('sign_in_names', None) self.object_type = 'User' diff --git a/azure-graphrbac/azure/graphrbac/models/user_base.py b/azure-graphrbac/azure/graphrbac/models/user_base.py index ce960c2802cc..a5c4da02444f 100644 --- a/azure-graphrbac/azure/graphrbac/models/user_base.py +++ b/azure-graphrbac/azure/graphrbac/models/user_base.py @@ -47,11 +47,11 @@ class UserBase(Model): 'user_type': {'key': 'userType', 'type': 'str'}, } - def __init__(self, additional_properties=None, immutable_id=None, usage_location=None, given_name=None, surname=None, user_type=None): - super(UserBase, self).__init__() - self.additional_properties = additional_properties - self.immutable_id = immutable_id - self.usage_location = usage_location - self.given_name = given_name - self.surname = surname - self.user_type = user_type + def __init__(self, **kwargs): + super(UserBase, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.immutable_id = kwargs.get('immutable_id', None) + self.usage_location = kwargs.get('usage_location', None) + self.given_name = kwargs.get('given_name', None) + self.surname = kwargs.get('surname', None) + self.user_type = kwargs.get('user_type', None) diff --git a/azure-graphrbac/azure/graphrbac/models/user_base_py3.py b/azure-graphrbac/azure/graphrbac/models/user_base_py3.py new file mode 100644 index 000000000000..14c1fc0d3ab6 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/user_base_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 UserBase(Model): + """UserBase. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param immutable_id: This must be specified if you are using a federated + domain for the user's userPrincipalName (UPN) property when creating a new + user account. It is used to associate an on-premises Active Directory user + account with their Azure AD user object. + :type immutable_id: str + :param usage_location: A two letter country code (ISO standard 3166). + Required for users that will be assigned licenses due to legal requirement + to check for availability of services in countries. Examples include: + "US", "JP", and "GB". + :type usage_location: str + :param given_name: The given name for the user. + :type given_name: str + :param surname: The user's surname (family name or last name). + :type surname: str + :param user_type: A string value that can be used to classify user types + in your directory, such as 'Member' and 'Guest'. Possible values include: + 'Member', 'Guest' + :type user_type: str or ~azure.graphrbac.models.UserType + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'usage_location': {'key': 'usageLocation', 'type': 'str'}, + 'given_name': {'key': 'givenName', 'type': 'str'}, + 'surname': {'key': 'surname', 'type': 'str'}, + 'user_type': {'key': 'userType', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, immutable_id: str=None, usage_location: str=None, given_name: str=None, surname: str=None, user_type=None, **kwargs) -> None: + super(UserBase, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.immutable_id = immutable_id + self.usage_location = usage_location + self.given_name = given_name + self.surname = surname + self.user_type = user_type diff --git a/azure-graphrbac/azure/graphrbac/models/user_create_parameters.py b/azure-graphrbac/azure/graphrbac/models/user_create_parameters.py index 214a3fc6bf5c..1491954f50c2 100644 --- a/azure-graphrbac/azure/graphrbac/models/user_create_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/user_create_parameters.py @@ -15,6 +15,8 @@ class UserCreateParameters(UserBase): """Request parameters for creating a new work or school account user. + 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] @@ -36,17 +38,17 @@ class UserCreateParameters(UserBase): in your directory, such as 'Member' and 'Guest'. Possible values include: 'Member', 'Guest' :type user_type: str or ~azure.graphrbac.models.UserType - :param account_enabled: Whether the account is enabled. + :param account_enabled: Required. Whether the account is enabled. :type account_enabled: bool - :param display_name: The display name of the user. + :param display_name: Required. The display name of the user. :type display_name: str - :param password_profile: Password Profile + :param password_profile: Required. Password Profile :type password_profile: ~azure.graphrbac.models.PasswordProfile - :param user_principal_name: The user principal name + :param user_principal_name: Required. The user principal name (someuser@contoso.com). It must contain one of the verified domains for the tenant. :type user_principal_name: str - :param mail_nickname: The mail alias for the user. + :param mail_nickname: Required. The mail alias for the user. :type mail_nickname: str :param mail: The primary email address of the user. :type mail: str @@ -75,11 +77,11 @@ class UserCreateParameters(UserBase): 'mail': {'key': 'mail', 'type': 'str'}, } - def __init__(self, account_enabled, display_name, password_profile, user_principal_name, mail_nickname, additional_properties=None, immutable_id=None, usage_location=None, given_name=None, surname=None, user_type=None, mail=None): - super(UserCreateParameters, self).__init__(additional_properties=additional_properties, immutable_id=immutable_id, usage_location=usage_location, given_name=given_name, surname=surname, user_type=user_type) - self.account_enabled = account_enabled - self.display_name = display_name - self.password_profile = password_profile - self.user_principal_name = user_principal_name - self.mail_nickname = mail_nickname - self.mail = mail + def __init__(self, **kwargs): + super(UserCreateParameters, self).__init__(**kwargs) + self.account_enabled = kwargs.get('account_enabled', None) + self.display_name = kwargs.get('display_name', None) + self.password_profile = kwargs.get('password_profile', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + self.mail_nickname = kwargs.get('mail_nickname', None) + self.mail = kwargs.get('mail', None) diff --git a/azure-graphrbac/azure/graphrbac/models/user_create_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/user_create_parameters_py3.py new file mode 100644 index 000000000000..9d3d79e6aa06 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/user_create_parameters_py3.py @@ -0,0 +1,87 @@ +# 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 .user_base_py3 import UserBase + + +class UserCreateParameters(UserBase): + """Request parameters for creating a new work or school account user. + + 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 immutable_id: This must be specified if you are using a federated + domain for the user's userPrincipalName (UPN) property when creating a new + user account. It is used to associate an on-premises Active Directory user + account with their Azure AD user object. + :type immutable_id: str + :param usage_location: A two letter country code (ISO standard 3166). + Required for users that will be assigned licenses due to legal requirement + to check for availability of services in countries. Examples include: + "US", "JP", and "GB". + :type usage_location: str + :param given_name: The given name for the user. + :type given_name: str + :param surname: The user's surname (family name or last name). + :type surname: str + :param user_type: A string value that can be used to classify user types + in your directory, such as 'Member' and 'Guest'. Possible values include: + 'Member', 'Guest' + :type user_type: str or ~azure.graphrbac.models.UserType + :param account_enabled: Required. Whether the account is enabled. + :type account_enabled: bool + :param display_name: Required. The display name of the user. + :type display_name: str + :param password_profile: Required. Password Profile + :type password_profile: ~azure.graphrbac.models.PasswordProfile + :param user_principal_name: Required. The user principal name + (someuser@contoso.com). It must contain one of the verified domains for + the tenant. + :type user_principal_name: str + :param mail_nickname: Required. The mail alias for the user. + :type mail_nickname: str + :param mail: The primary email address of the user. + :type mail: str + """ + + _validation = { + 'account_enabled': {'required': True}, + 'display_name': {'required': True}, + 'password_profile': {'required': True}, + 'user_principal_name': {'required': True}, + 'mail_nickname': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'usage_location': {'key': 'usageLocation', 'type': 'str'}, + 'given_name': {'key': 'givenName', 'type': 'str'}, + 'surname': {'key': 'surname', 'type': 'str'}, + 'user_type': {'key': 'userType', 'type': 'str'}, + 'account_enabled': {'key': 'accountEnabled', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'password_profile': {'key': 'passwordProfile', 'type': 'PasswordProfile'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, + 'mail': {'key': 'mail', 'type': 'str'}, + } + + def __init__(self, *, account_enabled: bool, display_name: str, password_profile, user_principal_name: str, mail_nickname: str, additional_properties=None, immutable_id: str=None, usage_location: str=None, given_name: str=None, surname: str=None, user_type=None, mail: str=None, **kwargs) -> None: + super(UserCreateParameters, self).__init__(additional_properties=additional_properties, immutable_id=immutable_id, usage_location=usage_location, given_name=given_name, surname=surname, user_type=user_type, **kwargs) + self.account_enabled = account_enabled + self.display_name = display_name + self.password_profile = password_profile + self.user_principal_name = user_principal_name + self.mail_nickname = mail_nickname + self.mail = mail diff --git a/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters.py b/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters.py index 2aa519ad80c2..e0938a126279 100644 --- a/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters.py @@ -15,12 +15,14 @@ class UserGetMemberGroupsParameters(Model): """Request parameters for GetMemberGroups API call. + 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 security_enabled_only: If true, only membership in security-enabled - groups should be checked. Otherwise, membership in all groups should be - checked. + :param security_enabled_only: Required. If true, only membership in + security-enabled groups should be checked. Otherwise, membership in all + groups should be checked. :type security_enabled_only: bool """ @@ -33,7 +35,7 @@ class UserGetMemberGroupsParameters(Model): 'security_enabled_only': {'key': 'securityEnabledOnly', 'type': 'bool'}, } - def __init__(self, security_enabled_only, additional_properties=None): - super(UserGetMemberGroupsParameters, self).__init__() - self.additional_properties = additional_properties - self.security_enabled_only = security_enabled_only + def __init__(self, **kwargs): + super(UserGetMemberGroupsParameters, self).__init__(**kwargs) + self.additional_properties = kwargs.get('additional_properties', None) + self.security_enabled_only = kwargs.get('security_enabled_only', None) diff --git a/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters_py3.py new file mode 100644 index 000000000000..5dec7dd33e14 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/user_get_member_groups_parameters_py3.py @@ -0,0 +1,41 @@ +# 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 UserGetMemberGroupsParameters(Model): + """Request parameters for GetMemberGroups API call. + + 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 security_enabled_only: Required. If true, only membership in + security-enabled groups should be checked. Otherwise, membership in all + groups should be checked. + :type security_enabled_only: bool + """ + + _validation = { + 'security_enabled_only': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'security_enabled_only': {'key': 'securityEnabledOnly', 'type': 'bool'}, + } + + def __init__(self, *, security_enabled_only: bool, additional_properties=None, **kwargs) -> None: + super(UserGetMemberGroupsParameters, self).__init__(**kwargs) + self.additional_properties = additional_properties + self.security_enabled_only = security_enabled_only diff --git a/azure-graphrbac/azure/graphrbac/models/user_py3.py b/azure-graphrbac/azure/graphrbac/models/user_py3.py new file mode 100644 index 000000000000..69975f146353 --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/user_py3.py @@ -0,0 +1,102 @@ +# 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 .directory_object_py3 import DirectoryObject + + +class User(DirectoryObject): + """Active Directory user information. + + Variables are only populated by the server, and will be ignored when + sending a request. + + 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] + :ivar object_id: The object ID. + :vartype object_id: str + :ivar deletion_timestamp: The time at which the directory object was + deleted. + :vartype deletion_timestamp: datetime + :param object_type: Required. Constant filled by server. + :type object_type: str + :param immutable_id: This must be specified if you are using a federated + domain for the user's userPrincipalName (UPN) property when creating a new + user account. It is used to associate an on-premises Active Directory user + account with their Azure AD user object. + :type immutable_id: str + :param usage_location: A two letter country code (ISO standard 3166). + Required for users that will be assigned licenses due to legal requirement + to check for availability of services in countries. Examples include: + "US", "JP", and "GB". + :type usage_location: str + :param given_name: The given name for the user. + :type given_name: str + :param surname: The user's surname (family name or last name). + :type surname: str + :param user_type: A string value that can be used to classify user types + in your directory, such as 'Member' and 'Guest'. Possible values include: + 'Member', 'Guest' + :type user_type: str or ~azure.graphrbac.models.UserType + :param account_enabled: Whether the account is enabled. + :type account_enabled: bool + :param display_name: The display name of the user. + :type display_name: str + :param user_principal_name: The principal name of the user. + :type user_principal_name: str + :param mail_nickname: The mail alias for the user. + :type mail_nickname: str + :param mail: The primary email address of the user. + :type mail: str + :param sign_in_names: The sign-in names of the user. + :type sign_in_names: list[~azure.graphrbac.models.SignInName] + """ + + _validation = { + 'object_id': {'readonly': True}, + 'deletion_timestamp': {'readonly': True}, + 'object_type': {'required': True}, + } + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'deletion_timestamp': {'key': 'deletionTimestamp', 'type': 'iso-8601'}, + 'object_type': {'key': 'objectType', 'type': 'str'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'usage_location': {'key': 'usageLocation', 'type': 'str'}, + 'given_name': {'key': 'givenName', 'type': 'str'}, + 'surname': {'key': 'surname', 'type': 'str'}, + 'user_type': {'key': 'userType', 'type': 'str'}, + 'account_enabled': {'key': 'accountEnabled', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, + 'mail': {'key': 'mail', 'type': 'str'}, + 'sign_in_names': {'key': 'signInNames', 'type': '[SignInName]'}, + } + + def __init__(self, *, additional_properties=None, immutable_id: str=None, usage_location: str=None, given_name: str=None, surname: str=None, user_type=None, account_enabled: bool=None, display_name: str=None, user_principal_name: str=None, mail_nickname: str=None, mail: str=None, sign_in_names=None, **kwargs) -> None: + super(User, self).__init__(additional_properties=additional_properties, **kwargs) + self.immutable_id = immutable_id + self.usage_location = usage_location + self.given_name = given_name + self.surname = surname + self.user_type = user_type + self.account_enabled = account_enabled + self.display_name = display_name + self.user_principal_name = user_principal_name + self.mail_nickname = mail_nickname + self.mail = mail + self.sign_in_names = sign_in_names + self.object_type = 'User' diff --git a/azure-graphrbac/azure/graphrbac/models/user_update_parameters.py b/azure-graphrbac/azure/graphrbac/models/user_update_parameters.py index 06a097245b73..a5e7a6e2f8e4 100644 --- a/azure-graphrbac/azure/graphrbac/models/user_update_parameters.py +++ b/azure-graphrbac/azure/graphrbac/models/user_update_parameters.py @@ -64,10 +64,10 @@ class UserUpdateParameters(UserBase): 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, } - def __init__(self, additional_properties=None, immutable_id=None, usage_location=None, given_name=None, surname=None, user_type=None, account_enabled=None, display_name=None, password_profile=None, user_principal_name=None, mail_nickname=None): - super(UserUpdateParameters, self).__init__(additional_properties=additional_properties, immutable_id=immutable_id, usage_location=usage_location, given_name=given_name, surname=surname, user_type=user_type) - self.account_enabled = account_enabled - self.display_name = display_name - self.password_profile = password_profile - self.user_principal_name = user_principal_name - self.mail_nickname = mail_nickname + def __init__(self, **kwargs): + super(UserUpdateParameters, self).__init__(**kwargs) + self.account_enabled = kwargs.get('account_enabled', None) + self.display_name = kwargs.get('display_name', None) + self.password_profile = kwargs.get('password_profile', None) + self.user_principal_name = kwargs.get('user_principal_name', None) + self.mail_nickname = kwargs.get('mail_nickname', None) diff --git a/azure-graphrbac/azure/graphrbac/models/user_update_parameters_py3.py b/azure-graphrbac/azure/graphrbac/models/user_update_parameters_py3.py new file mode 100644 index 000000000000..c23ec766e26b --- /dev/null +++ b/azure-graphrbac/azure/graphrbac/models/user_update_parameters_py3.py @@ -0,0 +1,73 @@ +# 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 .user_base_py3 import UserBase + + +class UserUpdateParameters(UserBase): + """Request parameters for updating an existing work or school account user. + + :param additional_properties: Unmatched properties from the message are + deserialized this collection + :type additional_properties: dict[str, object] + :param immutable_id: This must be specified if you are using a federated + domain for the user's userPrincipalName (UPN) property when creating a new + user account. It is used to associate an on-premises Active Directory user + account with their Azure AD user object. + :type immutable_id: str + :param usage_location: A two letter country code (ISO standard 3166). + Required for users that will be assigned licenses due to legal requirement + to check for availability of services in countries. Examples include: + "US", "JP", and "GB". + :type usage_location: str + :param given_name: The given name for the user. + :type given_name: str + :param surname: The user's surname (family name or last name). + :type surname: str + :param user_type: A string value that can be used to classify user types + in your directory, such as 'Member' and 'Guest'. Possible values include: + 'Member', 'Guest' + :type user_type: str or ~azure.graphrbac.models.UserType + :param account_enabled: Whether the account is enabled. + :type account_enabled: bool + :param display_name: The display name of the user. + :type display_name: str + :param password_profile: The password profile of the user. + :type password_profile: ~azure.graphrbac.models.PasswordProfile + :param user_principal_name: The user principal name + (someuser@contoso.com). It must contain one of the verified domains for + the tenant. + :type user_principal_name: str + :param mail_nickname: The mail alias for the user. + :type mail_nickname: str + """ + + _attribute_map = { + 'additional_properties': {'key': '', 'type': '{object}'}, + 'immutable_id': {'key': 'immutableId', 'type': 'str'}, + 'usage_location': {'key': 'usageLocation', 'type': 'str'}, + 'given_name': {'key': 'givenName', 'type': 'str'}, + 'surname': {'key': 'surname', 'type': 'str'}, + 'user_type': {'key': 'userType', 'type': 'str'}, + 'account_enabled': {'key': 'accountEnabled', 'type': 'bool'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'password_profile': {'key': 'passwordProfile', 'type': 'PasswordProfile'}, + 'user_principal_name': {'key': 'userPrincipalName', 'type': 'str'}, + 'mail_nickname': {'key': 'mailNickname', 'type': 'str'}, + } + + def __init__(self, *, additional_properties=None, immutable_id: str=None, usage_location: str=None, given_name: str=None, surname: str=None, user_type=None, account_enabled: bool=None, display_name: str=None, password_profile=None, user_principal_name: str=None, mail_nickname: str=None, **kwargs) -> None: + super(UserUpdateParameters, self).__init__(additional_properties=additional_properties, immutable_id=immutable_id, usage_location=usage_location, given_name=given_name, surname=surname, user_type=user_type, **kwargs) + self.account_enabled = account_enabled + self.display_name = display_name + self.password_profile = password_profile + self.user_principal_name = user_principal_name + self.mail_nickname = mail_nickname 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/applications_operations.py b/azure-graphrbac/azure/graphrbac/operations/applications_operations.py index 3b33d2dae46e..6fafd11d9eac 100644 --- a/azure-graphrbac/azure/graphrbac/operations/applications_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/applications_operations.py @@ -66,6 +66,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -78,9 +79,8 @@ def create( body_content = self._serialize.body(parameters, 'ApplicationCreateParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [201]: raise models.GraphErrorException(self._deserialize, response) @@ -142,7 +142,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -151,9 +151,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -201,7 +200,6 @@ def delete( # 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: @@ -210,8 +208,8 @@ def delete( 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) + 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) @@ -252,7 +250,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -261,8 +259,8 @@ def get( 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) + 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) @@ -323,9 +321,8 @@ def patch( body_content = self._serialize.body(parameters, 'ApplicationUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -377,7 +374,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -386,9 +383,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -460,9 +456,8 @@ def add_owner( body_content = self._serialize.body(parameters, 'ApplicationAddOwnerParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) @@ -510,7 +505,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -519,9 +514,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -585,9 +579,8 @@ def update_key_credentials( body_content = self._serialize.body(parameters, 'KeyCredentialsUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -635,7 +628,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -644,9 +637,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -710,9 +702,8 @@ def update_password_credentials( body_content = self._serialize.body(parameters, 'PasswordCredentialsUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) 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/domains_operations.py b/azure-graphrbac/azure/graphrbac/operations/domains_operations.py index fefc35164abc..f5c27702d0a5 100644 --- a/azure-graphrbac/azure/graphrbac/operations/domains_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/domains_operations.py @@ -75,7 +75,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -84,9 +84,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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]: exp = CloudError(response) @@ -136,7 +135,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -145,8 +144,8 @@ def get( 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) + 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]: exp = CloudError(response) diff --git a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py index a017004325d8..bfaa1348e2b9 100644 --- a/azure-graphrbac/azure/graphrbac/operations/groups_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/groups_operations.py @@ -68,6 +68,7 @@ def is_member_of( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -80,9 +81,8 @@ def is_member_of( body_content = self._serialize.body(parameters, 'CheckGroupMembershipParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [200]: raise models.GraphErrorException(self._deserialize, response) @@ -133,7 +133,6 @@ def remove_member( # 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: @@ -142,8 +141,8 @@ def remove_member( 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) + 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) @@ -207,9 +206,8 @@ def add_member( body_content = self._serialize.body(parameters, 'GroupAddMemberParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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) @@ -249,6 +247,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -261,9 +260,8 @@ def create( body_content = self._serialize.body(parameters, 'GroupCreateParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [201]: raise models.GraphErrorException(self._deserialize, response) @@ -325,7 +323,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -334,9 +332,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -399,7 +396,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -408,9 +405,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -460,7 +456,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -469,8 +465,8 @@ def get( 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) + 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) @@ -517,7 +513,6 @@ def delete( # 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: @@ -526,8 +521,8 @@ def delete( 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) + 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) @@ -585,6 +580,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -597,9 +593,8 @@ def internal_paging(next_link=None, raw=False): body_content = self._serialize.body(parameters, 'GroupGetMemberGroupsParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [200]: raise models.GraphErrorException(self._deserialize, response) @@ -616,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/oauth2_operations.py b/azure-graphrbac/azure/graphrbac/operations/oauth2_operations.py index 859f49ae167f..c5cd91d69a44 100644 --- a/azure-graphrbac/azure/graphrbac/operations/oauth2_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/oauth2_operations.py @@ -69,7 +69,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -78,8 +78,8 @@ def get( 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) + 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]: exp = CloudError(response) @@ -128,6 +128,7 @@ def post( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -143,9 +144,8 @@ def post( body_content = None # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [201]: exp = CloudError(response) diff --git a/azure-graphrbac/azure/graphrbac/operations/objects_operations.py b/azure-graphrbac/azure/graphrbac/operations/objects_operations.py index 570a1b4abc28..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['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('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. @@ -134,6 +79,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -146,9 +92,8 @@ def internal_paging(next_link=None, raw=False): body_content = self._serialize.body(parameters, 'GetObjectsParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [200]: exp = CloudError(response) @@ -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/service_principals_operations.py b/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py index 55bb2ddbc6b0..ac353899cdad 100644 --- a/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/service_principals_operations.py @@ -67,6 +67,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -79,9 +80,8 @@ def create( body_content = self._serialize.body(parameters, 'ServicePrincipalCreateParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [201]: raise models.GraphErrorException(self._deserialize, response) @@ -143,7 +143,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -152,9 +152,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -202,7 +201,6 @@ def delete( # 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: @@ -211,8 +209,8 @@ def delete( 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) + 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) @@ -254,7 +252,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -263,8 +261,8 @@ def get( 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) + 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) @@ -323,7 +321,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -332,9 +330,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -391,7 +388,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -400,9 +397,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -467,9 +463,8 @@ def update_key_credentials( body_content = self._serialize.body(parameters, 'KeyCredentialsUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -517,7 +512,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -526,9 +521,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -592,9 +586,8 @@ def update_password_credentials( body_content = self._serialize.body(parameters, 'PasswordCredentialsUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) 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'} diff --git a/azure-graphrbac/azure/graphrbac/operations/users_operations.py b/azure-graphrbac/azure/graphrbac/operations/users_operations.py index a7f16e13b9ab..85295468fd9e 100644 --- a/azure-graphrbac/azure/graphrbac/operations/users_operations.py +++ b/azure-graphrbac/azure/graphrbac/operations/users_operations.py @@ -66,6 +66,7 @@ def create( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -78,9 +79,8 @@ def create( body_content = self._serialize.body(parameters, 'UserCreateParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [201]: raise models.GraphErrorException(self._deserialize, response) @@ -142,7 +142,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -151,9 +151,8 @@ def internal_paging(next_link=None, raw=False): 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) + 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) @@ -203,7 +202,7 @@ def get( # Construct headers header_parameters = {} - header_parameters['Content-Type'] = 'application/json; charset=utf-8' + 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: @@ -212,8 +211,8 @@ def get( 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) + 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) @@ -275,9 +274,8 @@ def update( body_content = self._serialize.body(parameters, 'UserUpdateParameters') # Construct and send request - request = self._client.patch(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + request = self._client.patch(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) @@ -318,7 +316,6 @@ def delete( # 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: @@ -327,8 +324,8 @@ def delete( 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) + 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) @@ -386,6 +383,7 @@ def internal_paging(next_link=None, raw=False): # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' 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()) @@ -398,9 +396,8 @@ def internal_paging(next_link=None, raw=False): body_content = self._serialize.body(parameters, 'UserGetMemberGroupsParameters') # Construct and send request - request = self._client.post(url, query_parameters) - response = self._client.send( - request, header_parameters, body_content, stream=False, **operation_config) + 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 [200]: raise models.GraphErrorException(self._deserialize, response)