Skip to content

Commit

Permalink
CodeGen from PR 13873 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 582cab0f3e14fcdff0b28fa73e1a8e270e5c7dd3 into 86e3315
  • Loading branch information
SDKAuto committed Apr 10, 2021
1 parent 977bfe9 commit eed4a06
Show file tree
Hide file tree
Showing 28 changed files with 1,187 additions and 44 deletions.
1 change: 1 addition & 0 deletions sdk/cosmos/azure-mgmt-cosmosdb/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
8 changes: 8 additions & 0 deletions sdk/cosmos/azure-mgmt-cosmosdb/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"autorest": "V2",
"use": "@microsoft.azure/autorest.python@~4.0.71",
"commit": "542f3485be62be4ece2cbfb0047faee3e99a461f",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/cosmos-db/resource-manager/readme.md --keep-version-file --multiapi --no-async --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --use=@microsoft.azure/autorest.python@~4.0.71 --version=V2",
"readme": "specification/cosmos-db/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@


class CosmosDBManagementClient(SDKClient):
"""Azure Cosmos DB Database Service Resource Provider REST API
"""CosmosDBManagementClient
:ivar config: Configuration for client.
:vartype config: CosmosDBManagementClientConfiguration
Expand Down Expand Up @@ -101,7 +101,6 @@ def __init__(
super(CosmosDBManagementClient, 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 = '2021-03-15'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
from ._models_py3 import PercentileMetricValue
from ._models_py3 import PeriodicModeBackupPolicy
from ._models_py3 import PeriodicModeProperties
from ._models_py3 import Permission
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateEndpointProperty
from ._models_py3 import PrivateLinkResource
Expand All @@ -119,6 +120,10 @@
from ._models_py3 import SqlDatabaseGetPropertiesResource
from ._models_py3 import SqlDatabaseGetResults
from ._models_py3 import SqlDatabaseResource
from ._models_py3 import SqlRoleAssignmentCreateUpdateParameters
from ._models_py3 import SqlRoleAssignmentGetResults
from ._models_py3 import SqlRoleDefinitionCreateUpdateParameters
from ._models_py3 import SqlRoleDefinitionGetResults
from ._models_py3 import SqlStoredProcedureCreateUpdateParameters
from ._models_py3 import SqlStoredProcedureGetPropertiesResource
from ._models_py3 import SqlStoredProcedureGetResults
Expand Down Expand Up @@ -238,6 +243,7 @@
from ._models import PercentileMetricValue
from ._models import PeriodicModeBackupPolicy
from ._models import PeriodicModeProperties
from ._models import Permission
from ._models import PrivateEndpointConnection
from ._models import PrivateEndpointProperty
from ._models import PrivateLinkResource
Expand All @@ -256,6 +262,10 @@
from ._models import SqlDatabaseGetPropertiesResource
from ._models import SqlDatabaseGetResults
from ._models import SqlDatabaseResource
from ._models import SqlRoleAssignmentCreateUpdateParameters
from ._models import SqlRoleAssignmentGetResults
from ._models import SqlRoleDefinitionCreateUpdateParameters
from ._models import SqlRoleDefinitionGetResults
from ._models import SqlStoredProcedureCreateUpdateParameters
from ._models import SqlStoredProcedureGetPropertiesResource
from ._models import SqlStoredProcedureGetResults
Expand Down Expand Up @@ -301,6 +311,8 @@
from ._paged_models import PrivateLinkResourcePaged
from ._paged_models import SqlContainerGetResultsPaged
from ._paged_models import SqlDatabaseGetResultsPaged
from ._paged_models import SqlRoleAssignmentGetResultsPaged
from ._paged_models import SqlRoleDefinitionGetResultsPaged
from ._paged_models import SqlStoredProcedureGetResultsPaged
from ._paged_models import SqlTriggerGetResultsPaged
from ._paged_models import SqlUserDefinedFunctionGetResultsPaged
Expand Down Expand Up @@ -328,6 +340,7 @@
UnitType,
PrimaryAggregationType,
BackupPolicyType,
RoleDefinitionType,
)

__all__ = [
Expand Down Expand Up @@ -422,6 +435,7 @@
'PercentileMetricValue',
'PeriodicModeBackupPolicy',
'PeriodicModeProperties',
'Permission',
'PrivateEndpointConnection',
'PrivateEndpointProperty',
'PrivateLinkResource',
Expand All @@ -440,6 +454,10 @@
'SqlDatabaseGetPropertiesResource',
'SqlDatabaseGetResults',
'SqlDatabaseResource',
'SqlRoleAssignmentCreateUpdateParameters',
'SqlRoleAssignmentGetResults',
'SqlRoleDefinitionCreateUpdateParameters',
'SqlRoleDefinitionGetResults',
'SqlStoredProcedureCreateUpdateParameters',
'SqlStoredProcedureGetPropertiesResource',
'SqlStoredProcedureGetResults',
Expand Down Expand Up @@ -480,6 +498,8 @@
'SqlStoredProcedureGetResultsPaged',
'SqlUserDefinedFunctionGetResultsPaged',
'SqlTriggerGetResultsPaged',
'SqlRoleDefinitionGetResultsPaged',
'SqlRoleAssignmentGetResultsPaged',
'MongoDBDatabaseGetResultsPaged',
'MongoDBCollectionGetResultsPaged',
'TableGetResultsPaged',
Expand Down Expand Up @@ -511,4 +531,5 @@
'UnitType',
'PrimaryAggregationType',
'BackupPolicyType',
'RoleDefinitionType',
]
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,9 @@ class BackupPolicyType(str, Enum):

periodic = "Periodic"
continuous = "Continuous"


class RoleDefinitionType(str, Enum):

built_in_role = "BuiltInRole"
custom_role = "CustomRole"
212 changes: 211 additions & 1 deletion sdk/cosmos/azure-mgmt-cosmosdb/azure/mgmt/cosmosdb/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,12 +752,32 @@ def __init__(self, **kwargs):


class CloudError(Model):
"""CloudError.
"""An error response from the service.
:param error:
:type error: ~azure.mgmt.cosmosdb.models.ErrorResponse
"""

_attribute_map = {
'error': {'key': 'error', 'type': 'ErrorResponse'},
}

def __init__(self, **kwargs):
super(CloudError, self).__init__(**kwargs)
self.error = kwargs.get('error', None)


class CloudErrorException(HttpOperationError):
"""Server responsed with exception of type: 'CloudError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""

def __init__(self, deserialize, response, *args):

super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args)


class ClusterKey(Model):
"""Cosmos DB Cassandra table cluster key.
Expand Down Expand Up @@ -3606,6 +3626,26 @@ def __init__(self, **kwargs):
self.backup_retention_interval_in_hours = kwargs.get('backup_retention_interval_in_hours', None)


class Permission(Model):
"""The set of data plane operations permitted through this Role Definition.
:param data_actions: An array of data actions that are allowed.
:type data_actions: list[str]
:param not_data_actions: An array of data actions that are denied.
:type not_data_actions: list[str]
"""

_attribute_map = {
'data_actions': {'key': 'dataActions', 'type': '[str]'},
'not_data_actions': {'key': 'notDataActions', 'type': '[str]'},
}

def __init__(self, **kwargs):
super(Permission, self).__init__(**kwargs)
self.data_actions = kwargs.get('data_actions', None)
self.not_data_actions = kwargs.get('not_data_actions', None)


class ProxyResource(Resource):
"""Proxy Resource.
Expand Down Expand Up @@ -4260,6 +4300,176 @@ def __init__(self, **kwargs):
self.id = kwargs.get('id', None)


class SqlRoleAssignmentCreateUpdateParameters(Model):
"""Parameters to create and update an Azure Cosmos DB SQL Role Assignment.
:param role_definition_id: The unique identifier for the associated Role
Definition.
:type role_definition_id: str
:param scope: The data plane resource path for which access is being
granted through this Role Assignment.
:type scope: str
:param principal_id: The unique identifier for the associated AAD
principal in the AAD graph to which access is being granted through this
Role Assignment. Tenant ID for the principal is inferred using the tenant
associated with the subscription.
:type principal_id: str
"""

_attribute_map = {
'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'},
'scope': {'key': 'properties.scope', 'type': 'str'},
'principal_id': {'key': 'properties.principalId', 'type': 'str'},
}

def __init__(self, **kwargs):
super(SqlRoleAssignmentCreateUpdateParameters, self).__init__(**kwargs)
self.role_definition_id = kwargs.get('role_definition_id', None)
self.scope = kwargs.get('scope', None)
self.principal_id = kwargs.get('principal_id', None)


class SqlRoleAssignmentGetResults(ARMProxyResource):
"""An Azure Cosmos DB Role Assignment.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:param role_definition_id: The unique identifier for the associated Role
Definition.
:type role_definition_id: str
:param scope: The data plane resource path for which access is being
granted through this Role Assignment.
:type scope: str
:param principal_id: The unique identifier for the associated AAD
principal in the AAD graph to which access is being granted through this
Role Assignment. Tenant ID for the principal is inferred using the tenant
associated with the subscription.
:type principal_id: str
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'role_definition_id': {'key': 'properties.roleDefinitionId', 'type': 'str'},
'scope': {'key': 'properties.scope', 'type': 'str'},
'principal_id': {'key': 'properties.principalId', 'type': 'str'},
}

def __init__(self, **kwargs):
super(SqlRoleAssignmentGetResults, self).__init__(**kwargs)
self.role_definition_id = kwargs.get('role_definition_id', None)
self.scope = kwargs.get('scope', None)
self.principal_id = kwargs.get('principal_id', None)


class SqlRoleDefinitionCreateUpdateParameters(Model):
"""Parameters to create and update an Azure Cosmos DB SQL Role Definition.
:param role_name: A user-friendly name for the Role Definition. Must be
unique for the database account.
:type role_name: str
:param type: Indicates whether the Role Definition was built-in or user
created. Possible values include: 'BuiltInRole', 'CustomRole'
:type type: str or ~azure.mgmt.cosmosdb.models.RoleDefinitionType
:param assignable_scopes: A set of fully qualified Scopes at or below
which Role Assignments may be created using this Role Definition. This
will allow application of this Role Definition on the entire database
account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as
assignable Scopes. Note that resources referenced in assignable Scopes
need not exist.
:type assignable_scopes: list[str]
:param permissions: The set of operations allowed through this Role
Definition.
:type permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""

_attribute_map = {
'role_name': {'key': 'properties.roleName', 'type': 'str'},
'type': {'key': 'properties.type', 'type': 'RoleDefinitionType'},
'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'},
'permissions': {'key': 'properties.permissions', 'type': '[Permission]'},
}

def __init__(self, **kwargs):
super(SqlRoleDefinitionCreateUpdateParameters, self).__init__(**kwargs)
self.role_name = kwargs.get('role_name', None)
self.type = kwargs.get('type', None)
self.assignable_scopes = kwargs.get('assignable_scopes', None)
self.permissions = kwargs.get('permissions', None)


class SqlRoleDefinitionGetResults(ARMProxyResource):
"""An Azure Cosmos DB SQL Role Definition.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The unique resource identifier of the database account.
:vartype id: str
:ivar name: The name of the database account.
:vartype name: str
:ivar type: The type of Azure resource.
:vartype type: str
:param role_name: A user-friendly name for the Role Definition. Must be
unique for the database account.
:type role_name: str
:param sql_role_definition_get_results_type: Indicates whether the Role
Definition was built-in or user created. Possible values include:
'BuiltInRole', 'CustomRole'
:type sql_role_definition_get_results_type: str or
~azure.mgmt.cosmosdb.models.RoleDefinitionType
:param assignable_scopes: A set of fully qualified Scopes at or below
which Role Assignments may be created using this Role Definition. This
will allow application of this Role Definition on the entire database
account or any underlying Database / Collection. Must have at least one
element. Scopes higher than Database account are not enforceable as
assignable Scopes. Note that resources referenced in assignable Scopes
need not exist.
:type assignable_scopes: list[str]
:param permissions: The set of operations allowed through this Role
Definition.
:type permissions: list[~azure.mgmt.cosmosdb.models.Permission]
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'role_name': {'key': 'properties.roleName', 'type': 'str'},
'sql_role_definition_get_results_type': {'key': 'properties.type', 'type': 'RoleDefinitionType'},
'assignable_scopes': {'key': 'properties.assignableScopes', 'type': '[str]'},
'permissions': {'key': 'properties.permissions', 'type': '[Permission]'},
}

def __init__(self, **kwargs):
super(SqlRoleDefinitionGetResults, self).__init__(**kwargs)
self.role_name = kwargs.get('role_name', None)
self.sql_role_definition_get_results_type = kwargs.get('sql_role_definition_get_results_type', None)
self.assignable_scopes = kwargs.get('assignable_scopes', None)
self.permissions = kwargs.get('permissions', None)


class SqlStoredProcedureCreateUpdateParameters(ARMResourceProperties):
"""Parameters to create and update Cosmos DB storedProcedure.
Expand Down
Loading

0 comments on commit eed4a06

Please sign in to comment.