=begin
#NSX-T Manager API

#VMware NSX-T Manager REST API

OpenAPI spec version: 2.5.1.0.0

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

=end

require 'uri'

module NSXT
  class ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Create a static hop BFD peer
    # Creates a BFD peer for static route. The required parameters includes peer IP address. 
    # @param logical_router_id 
    # @param static_hop_bfd_peer 
    # @param [Hash] opts the optional parameters
    # @return [StaticHopBfdPeer]
    def create_static_hop_bfd_peer(logical_router_id, static_hop_bfd_peer, opts = {})
      data, _status_code, _headers = create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts)
      data
    end

    # Create a static hop BFD peer
    # Creates a BFD peer for static route. The required parameters includes peer IP address. 
    # @param logical_router_id 
    # @param static_hop_bfd_peer 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StaticHopBfdPeer, Fixnum, Hash)>] StaticHopBfdPeer data, response status code and response headers
    def create_static_hop_bfd_peer_with_http_info(logical_router_id, static_hop_bfd_peer, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer ...'
      end
      # verify the required parameter 'logical_router_id' is set
      if @api_client.config.client_side_validation && logical_router_id.nil?
        fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer"
      end
      # verify the required parameter 'static_hop_bfd_peer' is set
      if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?
        fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.create_static_hop_bfd_peer"
      end
      # resource path
      local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)

      # query parameters
      query_params = {}

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

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(static_hop_bfd_peer)
      auth_names = ['BasicAuth']
      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 => 'StaticHopBfdPeer')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#create_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Delete a specified static route BFD peer cofigured on a specified logical router
    # Deletes the specified BFD peer present on specified logical router. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :force Force delete the resource even if it is being used somewhere  (default to false)
    # @return [nil]
    def delete_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})
      delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)
      nil
    end

    # Delete a specified static route BFD peer cofigured on a specified logical router
    # Deletes the specified BFD peer present on specified logical router. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param [Hash] opts the optional parameters
    # @option opts [BOOLEAN] :force Force delete the resource even if it is being used somewhere 
    # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers
    def delete_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer ...'
      end
      # verify the required parameter 'logical_router_id' is set
      if @api_client.config.client_side_validation && logical_router_id.nil?
        fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer"
      end
      # verify the required parameter 'bfd_peer_id' is set
      if @api_client.config.client_side_validation && bfd_peer_id.nil?
        fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.delete_static_hop_bfd_peer"
      end
      # resource path
      local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)

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

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

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BasicAuth']
      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)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#delete_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # List static routes BFD Peers
    # Returns information about all BFD peers created on specified logical router for static routes. 
    # @param logical_router_id 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :cursor Opaque cursor to be used for getting next page of records (supplied by current result page)
    # @option opts [String] :included_fields Comma separated list of fields that should be included in query result
    # @option opts [Integer] :page_size Maximum number of results to return in this page (server may return fewer) (default to 1000)
    # @option opts [BOOLEAN] :sort_ascending 
    # @option opts [String] :sort_by Field by which records are sorted
    # @return [StaticHopBfdPeerListResult]
    def list_static_hop_bfd_peers(logical_router_id, opts = {})
      data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)
      data
    end

    # List static routes BFD Peers
    # Returns information about all BFD peers created on specified logical router for static routes. 
    # @param logical_router_id 
    # @param [Hash] opts the optional parameters
    # @option opts [String] :cursor Opaque cursor to be used for getting next page of records (supplied by current result page)
    # @option opts [String] :included_fields Comma separated list of fields that should be included in query result
    # @option opts [Integer] :page_size Maximum number of results to return in this page (server may return fewer)
    # @option opts [BOOLEAN] :sort_ascending 
    # @option opts [String] :sort_by Field by which records are sorted
    # @return [Array<(StaticHopBfdPeerListResult, Fixnum, Hash)>] StaticHopBfdPeerListResult data, response status code and response headers
    def list_static_hop_bfd_peers_with_http_info(logical_router_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers ...'
      end
      # verify the required parameter 'logical_router_id' is set
      if @api_client.config.client_side_validation && logical_router_id.nil?
        fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers"
      end
      if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000
        fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be smaller than or equal to 1000.'
      end

      if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0
        fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.list_static_hop_bfd_peers, must be greater than or equal to 0.'
      end

      # resource path
      local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s)

      # query parameters
      query_params = {}
      query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
      query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?
      query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?
      query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?
      query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?

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

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BasicAuth']
      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 => 'StaticHopBfdPeerListResult')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#list_static_hop_bfd_peers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Read a static route BFD peer
    # Read the BFD peer having specified ID. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param [Hash] opts the optional parameters
    # @return [StaticHopBfdPeer]
    def read_static_hop_bfd_peer(logical_router_id, bfd_peer_id, opts = {})
      data, _status_code, _headers = read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts)
      data
    end

    # Read a static route BFD peer
    # Read the BFD peer having specified ID. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StaticHopBfdPeer, Fixnum, Hash)>] StaticHopBfdPeer data, response status code and response headers
    def read_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer ...'
      end
      # verify the required parameter 'logical_router_id' is set
      if @api_client.config.client_side_validation && logical_router_id.nil?
        fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer"
      end
      # verify the required parameter 'bfd_peer_id' is set
      if @api_client.config.client_side_validation && bfd_peer_id.nil?
        fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.read_static_hop_bfd_peer"
      end
      # resource path
      local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)

      # query parameters
      query_params = {}

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

      # form parameters
      form_params = {}

      # http body (model)
      post_body = nil
      auth_names = ['BasicAuth']
      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 => 'StaticHopBfdPeer')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#read_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update a static route BFD peer
    # Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param static_hop_bfd_peer 
    # @param [Hash] opts the optional parameters
    # @return [StaticHopBfdPeer]
    def update_static_hop_bfd_peer(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})
      data, _status_code, _headers = update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts)
      data
    end

    # Update a static route BFD peer
    # Modifies the static route BFD peer. Modifiable parameters includes peer IP, enable flag and configuration of the BFD peer. 
    # @param logical_router_id 
    # @param bfd_peer_id 
    # @param static_hop_bfd_peer 
    # @param [Hash] opts the optional parameters
    # @return [Array<(StaticHopBfdPeer, Fixnum, Hash)>] StaticHopBfdPeer data, response status code and response headers
    def update_static_hop_bfd_peer_with_http_info(logical_router_id, bfd_peer_id, static_hop_bfd_peer, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer ...'
      end
      # verify the required parameter 'logical_router_id' is set
      if @api_client.config.client_side_validation && logical_router_id.nil?
        fail ArgumentError, "Missing the required parameter 'logical_router_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer"
      end
      # verify the required parameter 'bfd_peer_id' is set
      if @api_client.config.client_side_validation && bfd_peer_id.nil?
        fail ArgumentError, "Missing the required parameter 'bfd_peer_id' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer"
      end
      # verify the required parameter 'static_hop_bfd_peer' is set
      if @api_client.config.client_side_validation && static_hop_bfd_peer.nil?
        fail ArgumentError, "Missing the required parameter 'static_hop_bfd_peer' when calling ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi.update_static_hop_bfd_peer"
      end
      # resource path
      local_var_path = '/logical-routers/{logical-router-id}/routing/static-routes/bfd-peers/{bfd-peer-id}'.sub('{' + 'logical-router-id' + '}', logical_router_id.to_s).sub('{' + 'bfd-peer-id' + '}', bfd_peer_id.to_s)

      # query parameters
      query_params = {}

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

      # form parameters
      form_params = {}

      # http body (model)
      post_body = @api_client.object_to_http_body(static_hop_bfd_peer)
      auth_names = ['BasicAuth']
      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 => 'StaticHopBfdPeer')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiLogicalRoutingAndServicesBfdPeersApi#update_static_hop_bfd_peer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
