# encoding: utf-8
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.

module Azure::Cosmosdb::Mgmt::V2020_06_01_preview
  module Models
    #
    # Parameters to create and update an Azure Cosmos DB SQL Role Definition.
    #
    class SqlRoleDefinitionCreateUpdateParameters

      include MsRestAzure

      # @return [String] A user-friendly name for the Role Definition. Must be
      # unique for the database account.
      attr_accessor :role_name

      # @return [RoleDefinitionType] Indicates whether the Role Definition was
      # built-in or user created. Possible values include: 'BuiltInRole',
      # 'CustomRole'
      attr_accessor :type

      # @return [Array<String>] 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.
      attr_accessor :assignable_scopes

      # @return [Array<Permission>] The set of operations allowed through this
      # Role Definition.
      attr_accessor :permissions


      #
      # Mapper for SqlRoleDefinitionCreateUpdateParameters class as Ruby Hash.
      # This will be used for serialization/deserialization.
      #
      def self.mapper()
        {
          client_side_validation: true,
          required: false,
          serialized_name: 'SqlRoleDefinitionCreateUpdateParameters',
          type: {
            name: 'Composite',
            class_name: 'SqlRoleDefinitionCreateUpdateParameters',
            model_properties: {
              role_name: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.roleName',
                type: {
                  name: 'String'
                }
              },
              type: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.type',
                type: {
                  name: 'Enum',
                  module: 'RoleDefinitionType'
                }
              },
              assignable_scopes: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.assignableScopes',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'StringElementType',
                      type: {
                        name: 'String'
                      }
                  }
                }
              },
              permissions: {
                client_side_validation: true,
                required: false,
                serialized_name: 'properties.permissions',
                type: {
                  name: 'Sequence',
                  element: {
                      client_side_validation: true,
                      required: false,
                      serialized_name: 'PermissionElementType',
                      type: {
                        name: 'Composite',
                        class_name: 'Permission'
                      }
                  }
                }
              }
            }
          }
        }
      end
    end
  end
end
