text:
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'

module Google
  module Apis
    module ClouduseraccountsVmBeta
      # Cloud User Accounts API
      #
      # Creates and manages users and groups for accessing Google Compute Engine
      #  virtual machines.
      #
      # @example
      #    require 'google/apis/clouduseraccounts_vm_beta'
      #
      #    Clouduseraccounts = Google::Apis::ClouduseraccountsVmBeta # Alias the module
      #    service = Clouduseraccounts::CloudUserAccountsService.new
      #
      # @see https://cloud.google.com/compute/docs/access/user-accounts/api/latest/
      class CloudUserAccountsService < Google::Apis::Core::BaseService
        # @return [String]
        #  API key. Your API key identifies your project and provides you with API access,
        #  quota, and reports. Required unless you provide an OAuth 2.0 token.
        attr_accessor :key

        # @return [String]
        #  Available to use for quota purposes for server-side applications. Can be any
        #  arbitrary string assigned to a user, but should not exceed 40 characters.
        #  Overrides userIp if both are provided.
        attr_accessor :quota_user

        # @return [String]
        #  IP address of the site where the request originates. Use this if you want to
        #  enforce per-user limits.
        attr_accessor :user_ip

        def initialize
          super('https://www.googleapis.com/', 'clouduseraccounts/vm_beta/projects/')
          @batch_path = 'batch'
        end

        # Deletes the specified operation resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] operation
        #   Name of the Operations resource to delete.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [NilClass] No result returned for this method
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [void]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def delete_global_accounts_operation(project, operation, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:delete, '{project}/global/operations/{operation}', options)
          command.params['project'] = project unless project.nil?
          command.params['operation'] = operation unless operation.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Retrieves the specified operation resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] operation
        #   Name of the Operations resource to return.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_global_accounts_operation(project, operation, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/operations/{operation}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['operation'] = operation unless operation.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Retrieves the list of operation resources contained within the specified
        # project.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] filter
        #   Sets a filter expression for filtering listed resources, in the form filter=`
        #   expression`. Your `expression` must be in the format: field_name
        #   comparison_string literal_string.
        #   The field_name is the name of the field you want to compare. Only atomic field
        #   types are supported (string, number, boolean). The comparison_string must be
        #   either eq (equals) or ne (not equals). The literal_string is the string value
        #   to filter to. The literal value must be valid for the type of field you are
        #   filtering by (string, number, boolean). For string fields, the literal value
        #   is interpreted as a regular expression using RE2 syntax. The literal value
        #   must match the entire field.
        #   For example, to filter for instances that do not have a name of example-
        #   instance, you would use filter=name ne example-instance.
        #   Compute Engine Beta API Only: If you use filtering in the Beta API, you can
        #   also filter on nested fields. For example, you could filter on instances that
        #   have set the scheduling.automaticRestart field to true. In particular, use
        #   filtering on nested fields to take advantage of instance labels to organize
        #   and filter results based on label values.
        #   The Beta API also supports filtering on multiple expressions by providing each
        #   separate expression within parentheses. For example, (scheduling.
        #   automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are
        #   treated as AND expressions, meaning that resources must match all expressions
        #   to pass the filters.
        # @param [Fixnum] max_results
        #   The maximum number of results per page that should be returned. If the number
        #   of available results is larger than maxResults, Compute Engine returns a
        #   nextPageToken that can be used to get the next page of results in subsequent
        #   list requests.
        # @param [String] order_by
        #   Sorts list results by a certain order. By default, results are returned in
        #   alphanumerical order based on the resource name.
        #   You can also sort results in descending order based on the creation timestamp
        #   using orderBy="creationTimestamp desc". This sorts results based on the
        #   creationTimestamp field in reverse chronological order (newest result first).
        #   Use this to sort resources like operations so that the newest operation is
        #   returned first.
        #   Currently, only sorting by name or creationTimestamp desc is supported.
        # @param [String] page_token
        #   Specifies a page token to use. Set pageToken to the nextPageToken returned by
        #   a previous list request to get the next page of results.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::OperationList] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::OperationList]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def list_global_accounts_operations(project, filter: nil, max_results: nil, order_by: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/operations', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::OperationList::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::OperationList
          command.params['project'] = project unless project.nil?
          command.query['filter'] = filter unless filter.nil?
          command.query['maxResults'] = max_results unless max_results.nil?
          command.query['orderBy'] = order_by unless order_by.nil?
          command.query['pageToken'] = page_token unless page_token.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Adds users to the specified group.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] group_name
        #   Name of the group for this request.
        # @param [Google::Apis::ClouduseraccountsVmBeta::GroupsAddMemberRequest] groups_add_member_request_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def add_group_member(project, group_name, groups_add_member_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/groups/{groupName}/addMember', options)
          command.request_representation = Google::Apis::ClouduseraccountsVmBeta::GroupsAddMemberRequest::Representation
          command.request_object = groups_add_member_request_object
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['groupName'] = group_name unless group_name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Deletes the specified Group resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] group_name
        #   Name of the Group resource to delete.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def delete_group(project, group_name, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:delete, '{project}/global/groups/{groupName}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['groupName'] = group_name unless group_name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Returns the specified Group resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] group_name
        #   Name of the Group resource to return.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Group] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Group]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_group(project, group_name, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/groups/{groupName}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Group::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Group
          command.params['project'] = project unless project.nil?
          command.params['groupName'] = group_name unless group_name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Creates a Group resource in the specified project using the data included in
        # the request.
        # @param [String] project
        #   Project ID for this request.
        # @param [Google::Apis::ClouduseraccountsVmBeta::Group] group_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def insert_group(project, group_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/groups', options)
          command.request_representation = Google::Apis::ClouduseraccountsVmBeta::Group::Representation
          command.request_object = group_object
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Retrieves the list of groups contained within the specified project.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] filter
        #   Sets a filter expression for filtering listed resources, in the form filter=`
        #   expression`. Your `expression` must be in the format: field_name
        #   comparison_string literal_string.
        #   The field_name is the name of the field you want to compare. Only atomic field
        #   types are supported (string, number, boolean). The comparison_string must be
        #   either eq (equals) or ne (not equals). The literal_string is the string value
        #   to filter to. The literal value must be valid for the type of field you are
        #   filtering by (string, number, boolean). For string fields, the literal value
        #   is interpreted as a regular expression using RE2 syntax. The literal value
        #   must match the entire field.
        #   For example, to filter for instances that do not have a name of example-
        #   instance, you would use filter=name ne example-instance.
        #   Compute Engine Beta API Only: If you use filtering in the Beta API, you can
        #   also filter on nested fields. For example, you could filter on instances that
        #   have set the scheduling.automaticRestart field to true. In particular, use
        #   filtering on nested fields to take advantage of instance labels to organize
        #   and filter results based on label values.
        #   The Beta API also supports filtering on multiple expressions by providing each
        #   separate expression within parentheses. For example, (scheduling.
        #   automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are
        #   treated as AND expressions, meaning that resources must match all expressions
        #   to pass the filters.
        # @param [Fixnum] max_results
        #   The maximum number of results per page that should be returned. If the number
        #   of available results is larger than maxResults, Compute Engine returns a
        #   nextPageToken that can be used to get the next page of results in subsequent
        #   list requests.
        # @param [String] order_by
        #   Sorts list results by a certain order. By default, results are returned in
        #   alphanumerical order based on the resource name.
        #   You can also sort results in descending order based on the creation timestamp
        #   using orderBy="creationTimestamp desc". This sorts results based on the
        #   creationTimestamp field in reverse chronological order (newest result first).
        #   Use this to sort resources like operations so that the newest operation is
        #   returned first.
        #   Currently, only sorting by name or creationTimestamp desc is supported.
        # @param [String] page_token
        #   Specifies a page token to use. Set pageToken to the nextPageToken returned by
        #   a previous list request to get the next page of results.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::GroupList] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::GroupList]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def list_groups(project, filter: nil, max_results: nil, order_by: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/groups', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::GroupList::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::GroupList
          command.params['project'] = project unless project.nil?
          command.query['filter'] = filter unless filter.nil?
          command.query['maxResults'] = max_results unless max_results.nil?
          command.query['orderBy'] = order_by unless order_by.nil?
          command.query['pageToken'] = page_token unless page_token.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Removes users from the specified group.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] group_name
        #   Name of the group for this request.
        # @param [Google::Apis::ClouduseraccountsVmBeta::GroupsRemoveMemberRequest] groups_remove_member_request_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def remove_group_member(project, group_name, groups_remove_member_request_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/groups/{groupName}/removeMember', options)
          command.request_representation = Google::Apis::ClouduseraccountsVmBeta::GroupsRemoveMemberRequest::Representation
          command.request_object = groups_remove_member_request_object
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['groupName'] = group_name unless group_name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Returns a list of authorized public keys for a specific user account.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] zone
        #   Name of the zone for this request.
        # @param [String] user
        #   The user account for which you want to get a list of authorized public keys.
        # @param [String] instance
        #   The fully-qualified URL of the virtual machine requesting the view.
        # @param [Boolean] login
        #   Whether the view was requested as part of a user-initiated login.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::LinuxGetAuthorizedKeysViewResponse] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::LinuxGetAuthorizedKeysViewResponse]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_linux_authorized_keys_view(project, zone, user, instance, login: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/zones/{zone}/authorizedKeysView/{user}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::LinuxGetAuthorizedKeysViewResponse::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::LinuxGetAuthorizedKeysViewResponse
          command.params['project'] = project unless project.nil?
          command.params['zone'] = zone unless zone.nil?
          command.params['user'] = user unless user.nil?
          command.query['instance'] = instance unless instance.nil?
          command.query['login'] = login unless login.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Retrieves a list of user accounts for an instance within a specific project.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] zone
        #   Name of the zone for this request.
        # @param [String] instance
        #   The fully-qualified URL of the virtual machine requesting the views.
        # @param [String] filter
        #   Sets a filter expression for filtering listed resources, in the form filter=`
        #   expression`. Your `expression` must be in the format: field_name
        #   comparison_string literal_string.
        #   The field_name is the name of the field you want to compare. Only atomic field
        #   types are supported (string, number, boolean). The comparison_string must be
        #   either eq (equals) or ne (not equals). The literal_string is the string value
        #   to filter to. The literal value must be valid for the type of field you are
        #   filtering by (string, number, boolean). For string fields, the literal value
        #   is interpreted as a regular expression using RE2 syntax. The literal value
        #   must match the entire field.
        #   For example, to filter for instances that do not have a name of example-
        #   instance, you would use filter=name ne example-instance.
        #   Compute Engine Beta API Only: If you use filtering in the Beta API, you can
        #   also filter on nested fields. For example, you could filter on instances that
        #   have set the scheduling.automaticRestart field to true. In particular, use
        #   filtering on nested fields to take advantage of instance labels to organize
        #   and filter results based on label values.
        #   The Beta API also supports filtering on multiple expressions by providing each
        #   separate expression within parentheses. For example, (scheduling.
        #   automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are
        #   treated as AND expressions, meaning that resources must match all expressions
        #   to pass the filters.
        # @param [Fixnum] max_results
        #   The maximum number of results per page that should be returned. If the number
        #   of available results is larger than maxResults, Compute Engine returns a
        #   nextPageToken that can be used to get the next page of results in subsequent
        #   list requests.
        # @param [String] order_by
        #   Sorts list results by a certain order. By default, results are returned in
        #   alphanumerical order based on the resource name.
        #   You can also sort results in descending order based on the creation timestamp
        #   using orderBy="creationTimestamp desc". This sorts results based on the
        #   creationTimestamp field in reverse chronological order (newest result first).
        #   Use this to sort resources like operations so that the newest operation is
        #   returned first.
        #   Currently, only sorting by name or creationTimestamp desc is supported.
        # @param [String] page_token
        #   Specifies a page token to use. Set pageToken to the nextPageToken returned by
        #   a previous list request to get the next page of results.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::LinuxGetLinuxAccountViewsResponse] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::LinuxGetLinuxAccountViewsResponse]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_linux_linux_account_views(project, zone, instance, filter: nil, max_results: nil, order_by: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/zones/{zone}/linuxAccountViews', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::LinuxGetLinuxAccountViewsResponse::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::LinuxGetLinuxAccountViewsResponse
          command.params['project'] = project unless project.nil?
          command.params['zone'] = zone unless zone.nil?
          command.query['filter'] = filter unless filter.nil?
          command.query['instance'] = instance unless instance.nil?
          command.query['maxResults'] = max_results unless max_results.nil?
          command.query['orderBy'] = order_by unless order_by.nil?
          command.query['pageToken'] = page_token unless page_token.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Adds a public key to the specified User resource with the data included in the
        # request.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] user
        #   Name of the user for this request.
        # @param [Google::Apis::ClouduseraccountsVmBeta::PublicKey] public_key_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def add_user_public_key(project, user, public_key_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/users/{user}/addPublicKey', options)
          command.request_representation = Google::Apis::ClouduseraccountsVmBeta::PublicKey::Representation
          command.request_object = public_key_object
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['user'] = user unless user.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Deletes the specified User resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] user
        #   Name of the user resource to delete.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def delete_user(project, user, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:delete, '{project}/global/users/{user}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['user'] = user unless user.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Returns the specified User resource.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] user
        #   Name of the user resource to return.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::User] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::User]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_user(project, user, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/users/{user}', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::User::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::User
          command.params['project'] = project unless project.nil?
          command.params['user'] = user unless user.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Creates a User resource in the specified project using the data included in
        # the request.
        # @param [String] project
        #   Project ID for this request.
        # @param [Google::Apis::ClouduseraccountsVmBeta::User] user_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def insert_user(project, user_object = nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/users', options)
          command.request_representation = Google::Apis::ClouduseraccountsVmBeta::User::Representation
          command.request_object = user_object
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Retrieves a list of users contained within the specified project.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] filter
        #   Sets a filter expression for filtering listed resources, in the form filter=`
        #   expression`. Your `expression` must be in the format: field_name
        #   comparison_string literal_string.
        #   The field_name is the name of the field you want to compare. Only atomic field
        #   types are supported (string, number, boolean). The comparison_string must be
        #   either eq (equals) or ne (not equals). The literal_string is the string value
        #   to filter to. The literal value must be valid for the type of field you are
        #   filtering by (string, number, boolean). For string fields, the literal value
        #   is interpreted as a regular expression using RE2 syntax. The literal value
        #   must match the entire field.
        #   For example, to filter for instances that do not have a name of example-
        #   instance, you would use filter=name ne example-instance.
        #   Compute Engine Beta API Only: If you use filtering in the Beta API, you can
        #   also filter on nested fields. For example, you could filter on instances that
        #   have set the scheduling.automaticRestart field to true. In particular, use
        #   filtering on nested fields to take advantage of instance labels to organize
        #   and filter results based on label values.
        #   The Beta API also supports filtering on multiple expressions by providing each
        #   separate expression within parentheses. For example, (scheduling.
        #   automaticRestart eq true) (zone eq us-central1-f). Multiple expressions are
        #   treated as AND expressions, meaning that resources must match all expressions
        #   to pass the filters.
        # @param [Fixnum] max_results
        #   The maximum number of results per page that should be returned. If the number
        #   of available results is larger than maxResults, Compute Engine returns a
        #   nextPageToken that can be used to get the next page of results in subsequent
        #   list requests.
        # @param [String] order_by
        #   Sorts list results by a certain order. By default, results are returned in
        #   alphanumerical order based on the resource name.
        #   You can also sort results in descending order based on the creation timestamp
        #   using orderBy="creationTimestamp desc". This sorts results based on the
        #   creationTimestamp field in reverse chronological order (newest result first).
        #   Use this to sort resources like operations so that the newest operation is
        #   returned first.
        #   Currently, only sorting by name or creationTimestamp desc is supported.
        # @param [String] page_token
        #   Specifies a page token to use. Set pageToken to the nextPageToken returned by
        #   a previous list request to get the next page of results.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::UserList] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::UserList]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def list_users(project, filter: nil, max_results: nil, order_by: nil, page_token: nil, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:get, '{project}/global/users', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::UserList::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::UserList
          command.params['project'] = project unless project.nil?
          command.query['filter'] = filter unless filter.nil?
          command.query['maxResults'] = max_results unless max_results.nil?
          command.query['orderBy'] = order_by unless order_by.nil?
          command.query['pageToken'] = page_token unless page_token.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        # Removes the specified public key from the user.
        # @param [String] project
        #   Project ID for this request.
        # @param [String] user
        #   Name of the user for this request.
        # @param [String] fingerprint
        #   The fingerprint of the public key to delete. Public keys are identified by
        #   their fingerprint, which is defined by RFC4716 to be the MD5 digest of the
        #   public key.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        #   Overrides userIp if both are provided.
        # @param [String] user_ip
        #   IP address of the site where the request originates. Use this if you want to
        #   enforce per-user limits.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::ClouduseraccountsVmBeta::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::ClouduseraccountsVmBeta::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def remove_user_public_key(project, user, fingerprint, fields: nil, quota_user: nil, user_ip: nil, options: nil, &block)
          command =  make_simple_command(:post, '{project}/global/users/{user}/removePublicKey', options)
          command.response_representation = Google::Apis::ClouduseraccountsVmBeta::Operation::Representation
          command.response_class = Google::Apis::ClouduseraccountsVmBeta::Operation
          command.params['project'] = project unless project.nil?
          command.params['user'] = user unless user.nil?
          command.query['fingerprint'] = fingerprint unless fingerprint.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
          execute_or_queue_command(command, &block)
        end

        protected

        def apply_command_defaults(command)
          command.query['key'] = key unless key.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          command.query['userIp'] = user_ip unless user_ip.nil?
        end
      end
    end
  end
end


text:
package com.janela.mobile.persistence;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;

import com.google.inject.Inject;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.eclipse.egit.github.core.User;
import org.eclipse.egit.github.core.service.OrganizationService;
import org.eclipse.egit.github.core.service.UserService;

/**
 * Cache of organization under an account
 */
public class Organizations implements PersistableResource<User> {

    private final UserService userService;

    private final OrganizationService orgService;

    /**
     * Create organizations cache with services to load from
     *
     * @param orgService
     * @param userService
     */
    @Inject
    public Organizations(OrganizationService orgService, UserService userService) {
        this.orgService = orgService;
        this.userService = userService;
    }

    @Override
    public Cursor getCursor(SQLiteDatabase readableDatabase) {
        SQLiteQueryBuilder builder = new SQLiteQueryBuilder();
        builder.setTables("orgs JOIN users ON (orgs.id = users.id)");
        return builder
                .query(readableDatabase, new String[] { "users.id",
                        "users.name", "users.avatarurl" }, null, null, null,
                        null, null);
    }

    @Override
    public User loadFrom(Cursor cursor) {
        User user = new User();
        user.setId(cursor.getInt(0));
        user.setLogin(cursor.getString(1));
        user.setAvatarUrl(cursor.getString(2));
        return user;
    }

    @Override
    public void store(SQLiteDatabase db, List<User> orgs) {
        db.delete("orgs", null, null);
        if (orgs.isEmpty())
            return;

        ContentValues values = new ContentValues(3);
        for (User user : orgs) {
            values.clear();

            values.put("id", user.getId());
            db.replace("orgs", null, values);

            values.put("name", user.getLogin());
            values.put("avatarurl", user.getAvatarUrl());
            db.replace("users", null, values);
        }
    }

    @Override
    public List<User> request() throws IOException {
        User user = userService.getUser();
        List<User> orgs = orgService.getOrganizations();
        List<User> all = new ArrayList<User>(orgs.size() + 1);
        all.add(user);
        all.addAll(orgs);
        return all;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<?php

// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.");
}

$page->add_breadcrumb_item($lang->bad_words, "index.php?module=config-badwords");

$plugins->run_hooks("admin_config_badwords_begin");

if($mybb->input['action'] == "add" && $mybb->request_method == "post")
{
	$plugins->run_hooks("admin_config_badwords_add");

	if(!trim($mybb->input['badword']))
	{
		$errors[] = $lang->error_missing_bad_word;
	}

	if(strlen(trim($mybb->input['badword'])) > 100)
	{
		$errors[] = $lang->bad_word_max;
	}

	if(strlen($mybb->input['replacement']) > 100)
	{
		$errors[] = $lang->replacement_word_max;
	}

	if(!$errors)
	{
		$query = $db->simple_select("badwords", "bid", "badword = '".$db->escape_string($mybb->input['badword'])."'");

		if($db->num_rows($query))
		{
			$errors[] = $lang->error_bad_word_filtered;
		}
	}

	$badword = str_replace('\*', '([a-zA-Z0-9_]{1})', preg_quote($mybb->input['badword'], "#"));

	// Don't allow certain badword replacements to be added if it would cause an infinite recursive loop.
	if(strlen($mybb->input['badword']) == strlen($mybb->input['replacement']) && preg_match("#(^|\W)".$badword."(\W|$)#i", $mybb->input['replacement']))
	{
		$errors[] = $lang->error_replacement_word_invalid;
	}

	if(!$errors)
	{
		$new_badword = array(
			"badword" => $db->escape_string($mybb->input['badword']),
			"replacement" => $db->escape_string($mybb->input['replacement'])
		);

		$bid = $db->insert_query("badwords", $new_badword);

		$plugins->run_hooks("admin_config_badwords_add_commit");

		// Log admin action
		log_admin_action($bid, $mybb->input['badword']);

		$cache->update_badwords();
		flash_message($lang->success_added_bad_word, 'success');
		admin_redirect("index.php?module=config-badwords");
	}
	else
	{
		$mybb->input['action'] = '';
	}
}

if($mybb->input['action'] == "delete")
{
	$plugins->run_hooks("admin_config_badwords_delete");

	$query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'");
	$badword = $db->fetch_array($query);

	// Does the bad word not exist?
	if(!$badword['bid'])
	{
		flash_message($lang->error_invalid_bid, 'error');
		admin_redirect("index.php?module=config-badwords");
	}

	// User clicked no
	if($mybb->input['no'])
	{
		admin_redirect("index.php?module=config-badwords");
	}

	if($mybb->request_method == "post")
	{
		// Delete the bad word
		$db->delete_query("badwords", "bid='{$badword['bid']}'");

		$plugins->run_hooks("admin_config_badwords_delete_commit");

		// Log admin action
		log_admin_action($badword['bid'], $badword['badword']);

		$cache->update_badwords();

		flash_message($lang->success_deleted_bad_word, 'success');
		admin_redirect("index.php?module=config-badwords");
	}
	else
	{
		$page->output_confirm_action("index.php?module=config-badwords&action=delete&bid={$badword['bid']}", $lang->confirm_bad_word_deletion);
	}
}

if($mybb->input['action'] == "edit")
{
	$plugins->run_hooks("admin_config_badwords_edit");

	$query = $db->simple_select("badwords", "*", "bid='".intval($mybb->input['bid'])."'");
	$badword = $db->fetch_array($query);

	// Does the bad word not exist?
	if(!$badword['bid'])
	{
		flash_message($lang->error_invalid_bid, 'error');
		admin_redirect("index.php?module=config-badwords");
	}

	if($mybb->request_method == "post")
	{
		if(!trim($mybb->input['badword']))
		{
			$errors[] = $lang->error_missing_bad_word;
		}

		if(strlen(trim($mybb->input['badword'])) > 100)
		{
			$errors[] = $lang->bad_word_max;
		}

		if(strlen($mybb->input['replacement']) > 100)
		{
			$errors[] = $lang->replacement_word_max;
		}

		if(!$errors)
		{
			$updated_badword = array(
				"badword" => $db->escape_string($mybb->input['badword']),
				"replacement" => $db->escape_string($mybb->input['replacement'])
			);

			$db->update_query("badwords", $updated_badword, "bid='{$badword['bid']}'");

			$plugins->run_hooks("admin_config_badwords_edit_commit");

			// Log admin action
			log_admin_action($badword['bid'], $mybb->input['badword']);

			$cache->update_badwords();

			flash_message($lang->success_updated_bad_word, 'success');
			admin_redirect("index.php?module=config-badwords");
		}
	}

	$page->add_breadcrumb_item($lang->edit_bad_word);
	$page->output_header($lang->bad_words." - ".$lang->edit_bad_word);

	$sub_tabs['editbadword'] = array(
		'title' => $lang->edit_bad_word,
		'description' => $lang->edit_bad_word_desc,
		'link' => "index.php?module=config-badwords"
	);

	$page->output_nav_tabs($sub_tabs, "editbadword");

	$form = new Form("index.php?module=config-badwords&action=edit&bid={$badword['bid']}", "post");

	if($errors)
	{
		$page->output_inline_error($errors);
		$badword_data = $mybb->input;
	}
	else
	{
		$badword_data = $badword;
	}

	$form_container = new FormContainer($lang->edit_bad_word);
	$form_container->output_row($lang->bad_word." *", $lang->bad_word_desc, $form->generate_text_box('badword', $badword_data['badword'], array('id' => 'badword')), 'badword');
	$form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $badword_data['replacement'], array('id' => 'replacement')), 'replacement');
	$form_container->end();
	$buttons[] = $form->generate_submit_button($lang->save_bad_word);
	$form->output_submit_wrapper($buttons);
	$form->end();

	$page->output_footer();
}

if(!$mybb->input['action'])
{
	$plugins->run_hooks("admin_config_badwords_start");

	$page->output_header($lang->bad_words);

	$sub_tabs['badwords'] = array(
		'title' => $lang->bad_word_filters,
		'description' => $lang->bad_word_filters_desc,
		'link' => "index.php?module=config-badwords"
	);

	$page->output_nav_tabs($sub_tabs, "badwords");

	if($errors)
	{
		$page->output_inline_error($errors);
	}

	$table = new Table;
	$table->construct_header($lang->bad_word);
	$table->construct_header($lang->replacement, array("width" => "50%"));
	$table->construct_header($lang->controls, array("class" => "align_center", "width" => 150, "colspan" => 2));

	$query = $db->simple_select("badwords", "*", "", array("order_by" => "badword", "order_dir" => "asc"));
	while($badword = $db->fetch_array($query))
	{
		$badword['badword'] = htmlspecialchars_uni($badword['badword']);
		$badword['replacement'] = htmlspecialchars_uni($badword['replacement']);
		if(!$badword['replacement'])
		{
			$badword['replacement'] = '*****';
		}
		$table->construct_cell($badword['badword']);
		$table->construct_cell($badword['replacement']);
		$table->construct_cell("{$lang->edit}", array("class" => "align_center"));
		$table->construct_cell("post_code}\" onclick=\"return AdminCP.deleteConfirmation(this, '{$lang->confirm_bad_word_deletion}');\">{$lang->delete}", array("class" => "align_center"));
		$table->construct_row();
	}

	if($table->num_rows() == 0)
	{
		$table->construct_cell($lang->no_bad_words, array("colspan" => 4));
		$table->construct_row();
	}

	$table->output($lang->bad_word_filters);

	$form = new Form("index.php?module=config-badwords&action=add", "post", "add");

	$form_container = new FormContainer($lang->add_bad_word);
	$form_container->output_row($lang->bad_word." *", $lang->bad_word_desc, $form->generate_text_box('badword', $mybb->input['badword'], array('id' => 'badword')), 'badword');
	$form_container->output_row($lang->replacement, $lang->replacement_desc, $form->generate_text_box('replacement', $mybb->input['replacement'], array('id' => 'replacement')), 'replacement');
	$form_container->end();
	$buttons[] = $form->generate_submit_button($lang->save_bad_word);
	$form->output_submit_wrapper($buttons);
	$form->end();

	$page->output_footer();
}

?>


text:
Category.delete_all
Product.delete_all
User.delete_all
ProductsCategory.delete_all

drinks = Category.create(name: "Drinks")
candy = Category.create(name: "Candy")
cookies = Category.create(name: "Cookies")
latin_america = Category.create(name: "Latin America")
scandinavia = Category.create(name: "Scandinavia")
central_europe = Category.create(name: "Central Europe")

alfajores = Product.create(
  name: "Alfajores",
  price: 10.49,
  description: "A traditional confection found in some regions of Spain, the Philippines, and in parts of Latin America.",
  stock: 20,
  image_url: "http://perudelights.com/wp-content/uploads/2012/09/Alfajores-10.jpg"
  )

stroopwafels = Product.create(
  name: "Stroopwafels",
  price: 9.49,
  description: "A stroopwafel is a waffle made from two thin layers of baked dough with a caramel-like syrup filling in the middle",
  stock: 10,
  image_url: "https://upload.wikimedia.org/wikipedia/commons/9/9a/Stroopwafels_01.jpg"
  )

mazapan = Product.create(
  name: "Mazapan",
  price: 5.99,
  description: "Almond based cookie",
  stock: 99,
  image_url: "http://farm4.static.flickr.com/3189/2740040709_9fb21d08ec.jpg"
  )

jarritos = Product.create(
  name: "Jarritos",
  price: 9.79,
  description: "Delicious hibiscus flavored soft drink.",
  stock: 4,
  image_url: "http://texas-wholesale.com/images/products/760005%20-2920-JARRITOS-JAMAICA-12oz-24ct-.jpg"
  )

pelon_pelo_rico = Product.create(
  name: "Pelon Pelo Rico",
  price: 9.79,
  description: "Delicious tamarind candies",
  stock: 10,
  image_url: "http://cdn1.bigcommerce.com/server2500/k2eyh8/products/151/images/365/Mexican_Candy_Hershey_Pelon_Pelo_Rico_Normal__53689.1365646002.1280.1280.jpg?c=2"
  )

pepperkakor = Product.create(
  name: "Pepperkakor",
  price: 4.99,
  description: "A ginger biscuit, ginger nut or ginger snap is a globally popular biscuit based snack food, flavoured with ginger. Ginger biscuits are flavoured with powdered ginger and a variety of other spices, most commonly cinnamon, molasses and nutmeg",
  stock: 30,
  image_url: "http://mittkok.expressen.se/wp-content/uploads/2014/12/08382c5d-740d-4741-8c3d-d2e96bbf5046-636x424.jpg"
  )

smoelentrekkers = Product.create(
  name: "Smoelen-trekkers",
  price: 2.99,
  description: "Sour & sugary candy",
  stock: 100,
  image_url: "https://elsgoos.files.wordpress.com/2012/10/smoelentrekkers1.jpg"
  )

User.create(
  name:'tom',
  email: 'tom@tom.com',
  password: 'tomtom'
  )

User.create(
  name:'tim',
  email: 'tim@tim.com',
  password: 'timtim',
  admin: true
  )

ProductsCategory.create(
  product_id: alfajores.id,
  category_id: cookies.id
  )

ProductsCategory.create(
  product_id: alfajores.id,
  category_id: latin_america.id
  )

ProductsCategory.create(
  product_id: stroopwafels.id,
  category_id: cookies.id
  )

ProductsCategory.create(
  product_id: stroopwafels.id,
  category_id: scandinavia.id
  )

ProductsCategory.create(
  product_id: mazapan.id,
  category_id: cookies.id
  )

ProductsCategory.create(
  product_id: mazapan.id,
  category_id: latin_america.id
  )

ProductsCategory.create(
  product_id: jarritos.id,
  category_id: drinks.id
  )

ProductsCategory.create(
  product_id: jarritos.id,
  category_id: latin_america.id
  )

ProductsCategory.create(
  product_id: pelon_pelo_rico.id,
  category_id: candy.id
  )

ProductsCategory.create(
  product_id: pelon_pelo_rico.id,
  category_id: latin_america.id
  )

ProductsCategory.create(
  product_id: pepperkakor.id,
  category_id: cookies.id
  )

ProductsCategory.create(
  product_id: pepperkakor.id,
  category_id: scandinavia.id
  )

ProductsCategory.create(
  product_id: smoelentrekkers.id,
  category_id: candy.id
  )

ProductsCategory.create(
  product_id: smoelentrekkers.id,
  category_id: central_europe.id
  )


text:
package net.thetranquilpsychonaut.hashtagger.sites.gplus.retrofit.pojos;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by itwenty on 6/11/14.
 */
public class ActivityFeed implements Serializable
{
    String kind;
    String etag;
    String nextPageToken;
    String selfLink;
    String title;
    String updated;
    String id;
    List<Activity> items = new ArrayList<Activity>();

    public String getKind()
    {
        return kind;
    }

    public void setKind( String kind )
    {
        this.kind = kind;
    }

    public String getEtag()
    {
        return etag;
    }

    public void setEtag( String etag )
    {
        this.etag = etag;
    }

    public String getNextPageToken()
    {
        return nextPageToken;
    }

    public void setNextPageToken( String nextPageToken )
    {
        this.nextPageToken = nextPageToken;
    }

    public String getSelfLink()
    {
        return selfLink;
    }

    public void setSelfLink( String selfLink )
    {
        this.selfLink = selfLink;
    }

    public String getTitle()
    {
        return title;
    }

    public void setTitle( String title )
    {
        this.title = title;
    }

    public String getUpdated()
    {
        return updated;
    }

    public void setUpdated( String updated )
    {
        this.updated = updated;
    }

    public String getId()
    {
        return id;
    }

    public void setId( String id )
    {
        this.id = id;
    }

    public List<Activity> getItems()
    {
        return items;
    }

    public void setItems( List<Activity> items )
    {
        this.items = items;
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
LuaSpotLib (Lua SPOT v1.0)
</TITLE>

<META NAME="keywords" CONTENT="nl.uva.np.luaspot.LuaSpotLib class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Lua SPOT
v1.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

nl.uva.np.luaspot

Class LuaSpotLib

java.lang.Object
  nl.uva.np.luaspot.LuaSpotLib

All Implemented Interfaces:
JavaFunction

public class LuaSpotLib
extends java.lang.Object
implements JavaFunction

Lua SPOT API for Lua script. This API contains functions that are
 provided by Lua SPOT. All functions will be placed under luaspot
 table, so they have to be called by using luaspot. prefix.
 For example:

-- This is a Lua script to acquire a synchronization lock
luaspot.lock()

Available functions:

send(dst, msg): Send a message msg to
     dst by putting the message inside a router function call.

send_raw(dst, msg): Send a raw message msg
     to dst. By using this function, the message will be sent
     as is without using the routing function call.

add_id(id): Insert the given id to the
     packet identifier list.

check_id(id): Check whether the given id is
     already in the packet identifier list.

get_new_id(): Get new unique id to be used in routing
     packet.

get_node_addr(): Get network address of this sensor network.

<s>get_pkt_src()</s>: Use luaspot.sender
     instead.

mem_set(app, var, val): Save a value val
     and use app and var as the identifier.

mem_get(app, var): Get saved value identified by
     app and var.

dispatch(addr, msg): Call the dispatch()
     function of ServiceManager and forward the addr and
     msg parameters to it.

lock(app): Acquire a lock identified by app

release(app): Release a lock identified by app

next_token(str, del): Return the first token inside the
     string str and delete the token if del is
     set to true

The table luaspot also has one variable that contains
 the address of sender node. This address can be retrieved by using
 luaspot.sender variable.

Field Summary

static int
ADD_ID

static int
CHECK_ID

static int
DISPATCH

static int
GET_NEW_ID

static int
GET_NODE_ADDR

static int
GET_PKT_SRC

static int
LOCK

static int
MEM_GET

static int
MEM_SET

static java.lang.String[]
NAMES

static int
NEXT_TOKEN

static int
NUM_FUNCTIONS

static int
SEND

static int
SEND_RAW

static int
UNLOCK

Constructor Summary

LuaSpotLib(int index)

          Create a Lua function handler in Java for function with index specified
 in the parameter.

Method Summary

static void
addId(java.lang.String id)

 int
call(LuaCallFrame callFrame,
     int nArguments)

          General contract

  Input:

  callFrame = the frame that contains all the arguments, and where all the results should be put.

  nArgs = number of function arguments

  callFrame.get(i) = an argument (0 <= i < nArgs)

static java.lang.String
getNewMessageId()

          Get new globally unique message id.

static java.lang.String
getNodeAddress()

          Get the node address.

static java.lang.Object
memGet(java.lang.String app,
       java.lang.String var)

static void
memSet(java.lang.String app,
       java.lang.String var,
       java.lang.Object data)

static void
register(LuaState state)

          Register all function to the Lua virtual machine given in the parameter.

static void
setNodeAddress(java.lang.String address)

          Set the node address.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

NAMES

public static final java.lang.String[] NAMES

SEND

public static final int SEND

See Also:
Constant Field Values

SEND_RAW

public static final int SEND_RAW

See Also:
Constant Field Values

ADD_ID

public static final int ADD_ID

See Also:
Constant Field Values

CHECK_ID

public static final int CHECK_ID

See Also:
Constant Field Values

GET_NEW_ID

public static final int GET_NEW_ID

See Also:
Constant Field Values

GET_NODE_ADDR

public static final int GET_NODE_ADDR

See Also:
Constant Field Values

GET_PKT_SRC

public static final int GET_PKT_SRC

See Also:
Constant Field Values

MEM_SET

public static final int MEM_SET

See Also:
Constant Field Values

MEM_GET

public static final int MEM_GET

See Also:
Constant Field Values

DISPATCH

public static final int DISPATCH

See Also:
Constant Field Values

LOCK

public static final int LOCK

See Also:
Constant Field Values

UNLOCK

public static final int UNLOCK

See Also:
Constant Field Values

NEXT_TOKEN

public static final int NEXT_TOKEN

See Also:
Constant Field Values

NUM_FUNCTIONS

public static final int NUM_FUNCTIONS

Constructor Detail

LuaSpotLib

public LuaSpotLib(int index)

Create a Lua function handler in Java for function with index specified
 in the parameter.

Parameters:
index - The function index that is handled by this object

Method Detail

register

public static void register(LuaState state)

Register all function to the Lua virtual machine given in the parameter.

Parameters:
state - The Lua virtual machine state

setNodeAddress

public static void setNodeAddress(java.lang.String address)

Set the node address.

Parameters:
address - the node address.

getNodeAddress

public static java.lang.String getNodeAddress()

Get the node address.

Returns:
the node address.

getNewMessageId

public static java.lang.String getNewMessageId()

Get new globally unique message id.

Returns:
message id

call

public int call(LuaCallFrame callFrame,
                int nArguments)

Description copied from interface: JavaFunction

General contract

  Input:

  callFrame = the frame that contains all the arguments, and where all the results should be put.

  nArgs = number of function arguments

  callFrame.get(i) = an argument (0 <= i < nArgs)

Specified by:
call in interface JavaFunction

Parameters:
callFrame - - the current callframe for the function
nArguments - - number of function arguments

Returns:
N - number of return values. The N top objects on the stack are considered the return values

addId

public static void addId(java.lang.String id)

memSet

public static void memSet(java.lang.String app,
                          java.lang.String var,
                          java.lang.Object data)

memGet

public static java.lang.Object memGet(java.lang.String app,
                                      java.lang.String var)

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

Lua SPOT
v1.0

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
package net.savantly.sprout.starter.security.oauth;

import org.springframework.security.oauth2.client.OAuth2AuthorizedClient;
import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.user.OAuth2User;

public class DefaultSproutOAuth2UserService extends DefaultOAuth2UserService {

	private final OAuthUserMapper userMapper;

	public DefaultSproutOAuth2UserService(OAuthUserMapper userMapper) {
		this.userMapper = userMapper;
	}

	@Override
	public OAuth2User loadUser(OAuth2UserRequest request) throws OAuth2AuthenticationException {
		OAuth2User user = super.loadUser(request);
		OAuth2AuthorizedClient client = new OAuth2AuthorizedClient(request.getClientRegistration(), user.getName(),
				request.getAccessToken());
		return userMapper.mapUser(user, client);
	}
}


text:
<?php

namespace JS\Translator;

use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;

class TranslatorServiceFactory implements FactoryInterface {

    public function createService(ServiceLocatorInterface $serviceLocator) {
        // Configure the translator
        $config = $serviceLocator->get('Configuration');
        $trConfig = isset($config['translator']) ? $config['translator'] : [];
        $translator = Translator::factory($trConfig);
        $translator->setTextDomain('js');
        return $translator;
    }

}


text:
<head>
  <link href="http://gmpg.org/xfn/11" rel="profile">
  <meta http-equiv="content-type" content="text/html; charset=utf-8">

  <!-- Enable responsiveness on mobile devices-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">

  <title>
    {% if page.title == "Home" %}
      {{ site.title }} · {{ site.tagline }}
    {% else %}
      {{ page.title }} · {{ site.title }}
    {% endif %}
  </title>

  <!-- CSS -->
  <link rel="stylesheet" href="/public/css/poole.css">
  <link rel="stylesheet" href="/public/css/syntax.css">
  <link rel="stylesheet" href="/public/css/lanyon.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Serif:400,400italic,700|PT+Sans:400">

  <!-- See here for more details: http://knsv.github.io/mermaid/#simple-usage-on-a-web-page -->
  <script src="/public/javascript/mermaid.6.0.0.min.js"></script>
  <script>mermaid.initialize({startOnLoad:true});</script>

  <!-- taken from http://www.idryman.org/blog/2012/03/10/writing-math-equations-on-octopress/ -->
  <!-- mathjax config similar to math.stackexchange -->
  <script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    jax: ["input/TeX", "output/HTML-CSS"],
    tex2jax: {
      inlineMath: [ ['$', '$'] ],
      displayMath: [ ['$$', '$$']],
      processEscapes: true,
      skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
    },
    messageStyle: "none",
    "HTML-CSS": { preferredFont: "TeX", availableFonts: ["STIX","TeX"] }
  });
  </script>
  <script src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML" type="text/javascript"></script>

  <!-- Icons -->
  <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/public/apple-touch-icon-144-precomposed.png">
  <link rel="shortcut icon" href="/public/favicon.ico">

  <!-- RSS -->
  <link rel="alternate" type="application/rss+xml" title="RSS" href="/atom.xml">
</head>


text:
package multiverse.msgsys;

public class AllocNameMessage extends Message
{
    public AllocNameMessage() {
    }

    public AllocNameMessage(String type, String agentName)
    {
        msgType = MessageTypes.MSG_TYPE_ALLOC_NAME;
        this.type = type;
        this.agentName = agentName;
    }

    public String getType()
    {
        return type;
    }

    public String getAgentName()
    {
        return agentName;
    }

    private String type;
    private String agentName;

    private static final long serialVersionUID = 1L;
}


text:
package org.jrbsoft.statistic.junit;

import static org.junit.Assert.assertTrue;

import org.jrbsoft.statistic.model.AbstractMinMaxType;
import org.junit.Test;

public class AbstractMinMaxTypeTest {

	@Test
	public void testInteger() {
		final AbstractMinMaxType<?> minMaxType = AbstractMinMaxType.asMinMaxType(99L);
		minMaxType.set(22L);
		minMaxType.set(11L);
		minMaxType.set(22L);
		minMaxType.set(44L);
		minMaxType.set("");
		assertTrue(minMaxType.getMin().equals(11L));
		assertTrue(minMaxType.getMax().equals(44L));
	}

}


text:
package com.amazonaws.services.lexruntime.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * A context is a variable that contains information about the current state of the conversation between a user and
 * Amazon Lex. Context can be set automatically by Amazon Lex when an intent is fulfilled, or it can be set at runtime
 * using the PutContent, PutText, or PutSession operation.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ActiveContext implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The name of the context.
     *

     */
    private String name;
    /**
     *

     * The length of time or number of turns that a context remains active.
     *

     */
    private ActiveContextTimeToLive timeToLive;
    /**
     *

     * State variables for the current context. You can use these values as default values for slots in subsequent
     * events.
     *

     */
    private java.util.Map<String, String> parameters;

    /**
     *

     * The name of the context.
     *

     *
     * @param name
     *        The name of the context.
     */

    public void setName(String name) {
        this.name = name;
    }

    /**
     *

     * The name of the context.
     *

     *
     * @return The name of the context.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name of the context.
     *

     *
     * @param name
     *        The name of the context.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ActiveContext withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * The length of time or number of turns that a context remains active.
     *

     *
     * @param timeToLive
     *        The length of time or number of turns that a context remains active.
     */

    public void setTimeToLive(ActiveContextTimeToLive timeToLive) {
        this.timeToLive = timeToLive;
    }

    /**
     *

     * The length of time or number of turns that a context remains active.
     *

     *
     * @return The length of time or number of turns that a context remains active.
     */

    public ActiveContextTimeToLive getTimeToLive() {
        return this.timeToLive;
    }

    /**
     *

     * The length of time or number of turns that a context remains active.
     *

     *
     * @param timeToLive
     *        The length of time or number of turns that a context remains active.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ActiveContext withTimeToLive(ActiveContextTimeToLive timeToLive) {
        setTimeToLive(timeToLive);
        return this;
    }

    /**
     *

     * State variables for the current context. You can use these values as default values for slots in subsequent
     * events.
     *

     *
     * @return State variables for the current context. You can use these values as default values for slots in
     *         subsequent events.
     */

    public java.util.Map<String, String> getParameters() {
        return parameters;
    }

    /**
     *

     * State variables for the current context. You can use these values as default values for slots in subsequent
     * events.
     *

     *
     * @param parameters
     *        State variables for the current context. You can use these values as default values for slots in
     *        subsequent events.
     */

    public void setParameters(java.util.Map<String, String> parameters) {
        this.parameters = parameters;
    }

    /**
     *

     * State variables for the current context. You can use these values as default values for slots in subsequent
     * events.
     *

     *
     * @param parameters
     *        State variables for the current context. You can use these values as default values for slots in
     *        subsequent events.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ActiveContext withParameters(java.util.Map<String, String> parameters) {
        setParameters(parameters);
        return this;
    }

    /**
     * Add a single Parameters entry
     *
     * @see ActiveContext#withParameters
     * @returns a reference to this object so that method calls can be chained together.
     */

    public ActiveContext addParametersEntry(String key, String value) {
        if (null == this.parameters) {
            this.parameters = new java.util.HashMap<String, String>();
        }
        if (this.parameters.containsKey(key))
            throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided.");
        this.parameters.put(key, value);
        return this;
    }

    /**
     * Removes all the entries added into Parameters.
     *
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public ActiveContext clearParametersEntries() {
        this.parameters = null;
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getTimeToLive() != null)
            sb.append("TimeToLive: ").append(getTimeToLive()).append(",");
        if (getParameters() != null)
            sb.append("Parameters: ").append("***Sensitive Data Redacted***");
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof ActiveContext == false)
            return false;
        ActiveContext other = (ActiveContext) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getTimeToLive() == null ^ this.getTimeToLive() == null)
            return false;
        if (other.getTimeToLive() != null && other.getTimeToLive().equals(this.getTimeToLive()) == false)
            return false;
        if (other.getParameters() == null ^ this.getParameters() == null)
            return false;
        if (other.getParameters() != null && other.getParameters().equals(this.getParameters()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getTimeToLive() == null) ? 0 : getTimeToLive().hashCode());
        hashCode = prime * hashCode + ((getParameters() == null) ? 0 : getParameters().hashCode());
        return hashCode;
    }

    @Override
    public ActiveContext clone() {
        try {
            return (ActiveContext) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.lexruntime.model.transform.ActiveContextMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}