=begin
#Kubernetes

#No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)

OpenAPI spec version: v1.13.4

Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 2.2.3

=end

require "uri"

module Kubernetes
  class CoordinationV1beta1Api
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end

    # 
    # create a Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [V1beta1Lease]
    def create_namespaced_lease(namespace, body, opts = {})
      data, _status_code, _headers = create_namespaced_lease_with_http_info(namespace, body, opts)
      return data
    end

    # 
    # create a Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [Array<(V1beta1Lease, Fixnum, Hash)>] V1beta1Lease data, response status code and response headers
    def create_namespaced_lease_with_http_info(namespace, body, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.create_namespaced_lease ..."
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.create_namespaced_lease"
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling CoordinationV1beta1Api.create_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases".sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(body)
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1Lease')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#create_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # delete collection of Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [V1Status]
    def delete_collection_namespaced_lease(namespace, opts = {})
      data, _status_code, _headers = delete_collection_namespaced_lease_with_http_info(namespace, opts)
      return data
    end

    # 
    # delete collection of Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [Array<(V1Status, Fixnum, Hash)>] V1Status data, response status code and response headers
    def delete_collection_namespaced_lease_with_http_info(namespace, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.delete_collection_namespaced_lease ..."
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.delete_collection_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases".sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?
      query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?
      query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?
      query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?
      query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1Status')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#delete_collection_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # delete a Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [V1DeleteOptions] :body 
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @option opts [Integer] :grace_period_seconds The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    # @option opts [BOOLEAN] :orphan_dependents Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers list. Either this field or PropagationPolicy may be set, but not both.
    # @option opts [String] :propagation_policy Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: &#39;Orphan&#39; - orphan the dependents; &#39;Background&#39; - allow the garbage collector to delete the dependents in the background; &#39;Foreground&#39; - a cascading policy that deletes all dependents in the foreground.
    # @return [V1Status]
    def delete_namespaced_lease(name, namespace, opts = {})
      data, _status_code, _headers = delete_namespaced_lease_with_http_info(name, namespace, opts)
      return data
    end

    # 
    # delete a Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [V1DeleteOptions] :body 
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @option opts [Integer] :grace_period_seconds The duration in seconds before the object should be deleted. Value must be non-negative integer. The value zero indicates delete immediately. If this value is nil, the default grace period for the specified type will be used. Defaults to a per object value if not specified. zero means delete immediately.
    # @option opts [BOOLEAN] :orphan_dependents Deprecated: please use the PropagationPolicy, this field will be deprecated in 1.7. Should the dependent objects be orphaned. If true/false, the \&quot;orphan\&quot; finalizer will be added to/removed from the object&#39;s finalizers list. Either this field or PropagationPolicy may be set, but not both.
    # @option opts [String] :propagation_policy Whether and how garbage collection will be performed. Either this field or OrphanDependents may be set, but not both. The default policy is decided by the existing finalizer set in the metadata.finalizers and the resource-specific default policy. Acceptable values are: &#39;Orphan&#39; - orphan the dependents; &#39;Background&#39; - allow the garbage collector to delete the dependents in the background; &#39;Foreground&#39; - a cascading policy that deletes all dependents in the foreground.
    # @return [Array<(V1Status, Fixnum, Hash)>] V1Status data, response status code and response headers
    def delete_namespaced_lease_with_http_info(name, namespace, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.delete_namespaced_lease ..."
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling CoordinationV1beta1Api.delete_namespaced_lease"
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.delete_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases/{name}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?
      query_params[:'gracePeriodSeconds'] = opts[:'grace_period_seconds'] if !opts[:'grace_period_seconds'].nil?
      query_params[:'orphanDependents'] = opts[:'orphan_dependents'] if !opts[:'orphan_dependents'].nil?
      query_params[:'propagationPolicy'] = opts[:'propagation_policy'] if !opts[:'propagation_policy'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(opts[:'body'])
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1Status')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#delete_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # get available resources
    # @param [Hash] opts the optional parameters
    # @return [V1APIResourceList]
    def get_api_resources(opts = {})
      data, _status_code, _headers = get_api_resources_with_http_info(opts)
      return data
    end

    # 
    # get available resources
    # @param [Hash] opts the optional parameters
    # @return [Array<(V1APIResourceList, Fixnum, Hash)>] V1APIResourceList data, response status code and response headers
    def get_api_resources_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.get_api_resources ..."
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/"

      # query parameters
      query_params = {}

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1APIResourceList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#get_api_resources\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # list or watch objects of kind Lease
    # @param [Hash] opts the optional parameters
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [V1beta1LeaseList]
    def list_lease_for_all_namespaces(opts = {})
      data, _status_code, _headers = list_lease_for_all_namespaces_with_http_info(opts)
      return data
    end

    # 
    # list or watch objects of kind Lease
    # @param [Hash] opts the optional parameters
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [Array<(V1beta1LeaseList, Fixnum, Hash)>] V1beta1LeaseList data, response status code and response headers
    def list_lease_for_all_namespaces_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.list_lease_for_all_namespaces ..."
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/leases"

      # query parameters
      query_params = {}
      query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?
      query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?
      query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?
      query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?
      query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?
      query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1LeaseList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#list_lease_for_all_namespaces\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # list or watch objects of kind Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [V1beta1LeaseList]
    def list_namespaced_lease(namespace, opts = {})
      data, _status_code, _headers = list_namespaced_lease_with_http_info(namespace, opts)
      return data
    end

    # 
    # list or watch objects of kind Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :include_uninitialized If true, partially initialized resources are included in the response.
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :continue The continue option should be set when retrieving more results from the server. Since this value is server defined, clients may only use the continue value from a previous query result with identical query parameters (except for the value of continue) and the server may reject a continue value it does not recognize. If the specified continue value is no longer valid whether due to expiration (generally five to fifteen minutes) or a configuration change on the server, the server will respond with a 410 ResourceExpired error together with a continue token. If the client needs a consistent list, it must restart their list without the continue field. Otherwise, the client may send another list request with the token received with the 410 error, the server will respond with a list starting from the next key, but from the latest snapshot, which is inconsistent from the previous list results - objects that are created, modified, or deleted after the first list request will be included in the response, as long as their keys are after the \&quot;next key\&quot;.  This field is not supported when watch is true. Clients may start a watch from the last resourceVersion value returned by the server and not miss any modifications.
    # @option opts [String] :field_selector A selector to restrict the list of returned objects by their fields. Defaults to everything.
    # @option opts [String] :label_selector A selector to restrict the list of returned objects by their labels. Defaults to everything.
    # @option opts [Integer] :limit limit is a maximum number of responses to return for a list call. If more items exist, the server will set the &#x60;continue&#x60; field on the list metadata to a value that can be used with the same initial query to retrieve the next set of results. Setting a limit may return fewer than the requested amount of items (up to zero items) in the event all requested objects are filtered out and clients should only use the presence of the continue field to determine whether more results are available. Servers may choose not to support the limit argument and will return all of the available results. If limit is specified and the continue field is empty, clients may assume that no more results are available. This field is not supported if watch is true.  The server guarantees that the objects returned when using continue will be identical to issuing a single list call without a limit - that is, no objects created, modified, or deleted after the first request is issued will be included in any subsequent continued requests. This is sometimes referred to as a consistent snapshot, and ensures that a client that is using limit to receive smaller chunks of a very large result can ensure they see all possible objects. If objects are updated during a chunked list the version of the object that was present at the time the first list result was calculated is returned.
    # @option opts [String] :resource_version When specified with a watch call, shows changes that occur after that particular version of a resource. Defaults to changes from the beginning of history. When specified for list: - if unset, then the result is returned from remote storage based on quorum-read flag; - if it&#39;s 0, then we simply return what we currently have in cache, no guarantee; - if set to non zero, then the result is at least as fresh as given rv.
    # @option opts [Integer] :timeout_seconds Timeout for the list/watch call. This limits the duration of the call, regardless of any activity or inactivity.
    # @option opts [BOOLEAN] :watch Watch for changes to the described resources and return them as a stream of add, update, and remove notifications. Specify resourceVersion.
    # @return [Array<(V1beta1LeaseList, Fixnum, Hash)>] V1beta1LeaseList data, response status code and response headers
    def list_namespaced_lease_with_http_info(namespace, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.list_namespaced_lease ..."
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.list_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases".sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'includeUninitialized'] = opts[:'include_uninitialized'] if !opts[:'include_uninitialized'].nil?
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'continue'] = opts[:'continue'] if !opts[:'continue'].nil?
      query_params[:'fieldSelector'] = opts[:'field_selector'] if !opts[:'field_selector'].nil?
      query_params[:'labelSelector'] = opts[:'label_selector'] if !opts[:'label_selector'].nil?
      query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
      query_params[:'resourceVersion'] = opts[:'resource_version'] if !opts[:'resource_version'].nil?
      query_params[:'timeoutSeconds'] = opts[:'timeout_seconds'] if !opts[:'timeout_seconds'].nil?
      query_params[:'watch'] = opts[:'watch'] if !opts[:'watch'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf', 'application/json;stream=watch', 'application/vnd.kubernetes.protobuf;stream=watch'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1LeaseList')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#list_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # partially update the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [V1beta1Lease]
    def patch_namespaced_lease(name, namespace, body, opts = {})
      data, _status_code, _headers = patch_namespaced_lease_with_http_info(name, namespace, body, opts)
      return data
    end

    # 
    # partially update the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [Array<(V1beta1Lease, Fixnum, Hash)>] V1beta1Lease data, response status code and response headers
    def patch_namespaced_lease_with_http_info(name, namespace, body, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.patch_namespaced_lease ..."
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling CoordinationV1beta1Api.patch_namespaced_lease"
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.patch_namespaced_lease"
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling CoordinationV1beta1Api.patch_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases/{name}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json-patch+json', 'application/merge-patch+json', 'application/strategic-merge-patch+json'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(body)
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1Lease')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#patch_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # read the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [BOOLEAN] :exact Should the export be exact.  Exact export maintains cluster-specific fields like &#39;Namespace&#39;.
    # @option opts [BOOLEAN] :export Should this value be exported.  Export strips fields that a user can not specify.
    # @return [V1beta1Lease]
    def read_namespaced_lease(name, namespace, opts = {})
      data, _status_code, _headers = read_namespaced_lease_with_http_info(name, namespace, opts)
      return data
    end

    # 
    # read the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [BOOLEAN] :exact Should the export be exact.  Exact export maintains cluster-specific fields like &#39;Namespace&#39;.
    # @option opts [BOOLEAN] :export Should this value be exported.  Export strips fields that a user can not specify.
    # @return [Array<(V1beta1Lease, Fixnum, Hash)>] V1beta1Lease data, response status code and response headers
    def read_namespaced_lease_with_http_info(name, namespace, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.read_namespaced_lease ..."
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling CoordinationV1beta1Api.read_namespaced_lease"
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.read_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases/{name}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'exact'] = opts[:'exact'] if !opts[:'exact'].nil?
      query_params[:'export'] = opts[:'export'] if !opts[:'export'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1Lease')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#read_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # 
    # replace the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [V1beta1Lease]
    def replace_namespaced_lease(name, namespace, body, opts = {})
      data, _status_code, _headers = replace_namespaced_lease_with_http_info(name, namespace, body, opts)
      return data
    end

    # 
    # replace the specified Lease
    # @param name name of the Lease
    # @param namespace object name and auth scope, such as for teams and projects
    # @param body 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :pretty If &#39;true&#39;, then the output is pretty printed.
    # @option opts [String] :dry_run When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed
    # @return [Array<(V1beta1Lease, Fixnum, Hash)>] V1beta1Lease data, response status code and response headers
    def replace_namespaced_lease_with_http_info(name, namespace, body, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug "Calling API: CoordinationV1beta1Api.replace_namespaced_lease ..."
      end
      # verify the required parameter 'name' is set
      if @api_client.config.client_side_validation && name.nil?
        fail ArgumentError, "Missing the required parameter 'name' when calling CoordinationV1beta1Api.replace_namespaced_lease"
      end
      # verify the required parameter 'namespace' is set
      if @api_client.config.client_side_validation && namespace.nil?
        fail ArgumentError, "Missing the required parameter 'namespace' when calling CoordinationV1beta1Api.replace_namespaced_lease"
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling CoordinationV1beta1Api.replace_namespaced_lease"
      end
      # resource path
      local_var_path = "/apis/coordination.k8s.io/v1beta1/namespaces/{namespace}/leases/{name}".sub('{' + 'name' + '}', name.to_s).sub('{' + 'namespace' + '}', namespace.to_s)

      # query parameters
      query_params = {}
      query_params[:'pretty'] = opts[:'pretty'] if !opts[:'pretty'].nil?
      query_params[:'dryRun'] = opts[:'dry_run'] if !opts[:'dry_run'].nil?

      # header parameters
      header_params = {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/yaml', 'application/vnd.kubernetes.protobuf'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['*/*'])

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(body)
      auth_names = ['BearerToken']
      data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => 'V1beta1Lease')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: CoordinationV1beta1Api#replace_namespaced_lease\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
