=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 ManagementPlaneApiVpnIpsecTunnelProfilesApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Create custom IPSec tunnel profile
    # Create custom IPSec tunnel profile. IPSec tunnel profile is a reusable profile that captures phase two negotiation parameters and tunnel properties. System will be provisioned with system owned non editable default IPSec tunnel profile. Any change in profile affects all sessions consuming this profile.
    # @param ip_sec_vpn_tunnel_profile 
    # @param [Hash] opts the optional parameters
    # @return [IPSecVPNTunnelProfile]
    def create_ip_sec_vpn_tunnel_profile(ip_sec_vpn_tunnel_profile, opts = {})
      data, _status_code, _headers = create_ip_sec_vpn_tunnel_profile_with_http_info(ip_sec_vpn_tunnel_profile, opts)
      data
    end

    # Create custom IPSec tunnel profile
    # Create custom IPSec tunnel profile. IPSec tunnel profile is a reusable profile that captures phase two negotiation parameters and tunnel properties. System will be provisioned with system owned non editable default IPSec tunnel profile. Any change in profile affects all sessions consuming this profile.
    # @param ip_sec_vpn_tunnel_profile 
    # @param [Hash] opts the optional parameters
    # @return [Array<(IPSecVPNTunnelProfile, Fixnum, Hash)>] IPSecVPNTunnelProfile data, response status code and response headers
    def create_ip_sec_vpn_tunnel_profile_with_http_info(ip_sec_vpn_tunnel_profile, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecTunnelProfilesApi.create_ip_sec_vpn_tunnel_profile ...'
      end
      # verify the required parameter 'ip_sec_vpn_tunnel_profile' is set
      if @api_client.config.client_side_validation && ip_sec_vpn_tunnel_profile.nil?
        fail ArgumentError, "Missing the required parameter 'ip_sec_vpn_tunnel_profile' when calling ManagementPlaneApiVpnIpsecTunnelProfilesApi.create_ip_sec_vpn_tunnel_profile"
      end
      # resource path
      local_var_path = '/vpn/ipsec/tunnel-profiles'

      # 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(ip_sec_vpn_tunnel_profile)
      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 => 'IPSecVPNTunnelProfile')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiVpnIpsecTunnelProfilesApi#create_ip_sec_vpn_tunnel_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Delete custom IPSecTunnelProfile
    # Delete custom IPSec Tunnel Profile.
    # @param ipsec_vpn_tunnel_profile_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_ip_sec_vpn_tunnel_profile(ipsec_vpn_tunnel_profile_id, opts = {})
      delete_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, opts)
      nil
    end

    # Delete custom IPSecTunnelProfile
    # Delete custom IPSec Tunnel Profile.
    # @param ipsec_vpn_tunnel_profile_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_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecTunnelProfilesApi.delete_ip_sec_vpn_tunnel_profile ...'
      end
      # verify the required parameter 'ipsec_vpn_tunnel_profile_id' is set
      if @api_client.config.client_side_validation && ipsec_vpn_tunnel_profile_id.nil?
        fail ArgumentError, "Missing the required parameter 'ipsec_vpn_tunnel_profile_id' when calling ManagementPlaneApiVpnIpsecTunnelProfilesApi.delete_ip_sec_vpn_tunnel_profile"
      end
      # resource path
      local_var_path = '/vpn/ipsec/tunnel-profiles/{ipsec-vpn-tunnel-profile-id}'.sub('{' + 'ipsec-vpn-tunnel-profile-id' + '}', ipsec_vpn_tunnel_profile_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: ManagementPlaneApiVpnIpsecTunnelProfilesApi#delete_ip_sec_vpn_tunnel_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get IPSec tunnel profile
    # Get custom IPSec Tunnel Profile.
    # @param ipsec_vpn_tunnel_profile_id 
    # @param [Hash] opts the optional parameters
    # @return [IPSecVPNTunnelProfile]
    def get_ip_sec_vpn_tunnel_profile(ipsec_vpn_tunnel_profile_id, opts = {})
      data, _status_code, _headers = get_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, opts)
      data
    end

    # Get IPSec tunnel profile
    # Get custom IPSec Tunnel Profile.
    # @param ipsec_vpn_tunnel_profile_id 
    # @param [Hash] opts the optional parameters
    # @return [Array<(IPSecVPNTunnelProfile, Fixnum, Hash)>] IPSecVPNTunnelProfile data, response status code and response headers
    def get_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecTunnelProfilesApi.get_ip_sec_vpn_tunnel_profile ...'
      end
      # verify the required parameter 'ipsec_vpn_tunnel_profile_id' is set
      if @api_client.config.client_side_validation && ipsec_vpn_tunnel_profile_id.nil?
        fail ArgumentError, "Missing the required parameter 'ipsec_vpn_tunnel_profile_id' when calling ManagementPlaneApiVpnIpsecTunnelProfilesApi.get_ip_sec_vpn_tunnel_profile"
      end
      # resource path
      local_var_path = '/vpn/ipsec/tunnel-profiles/{ipsec-vpn-tunnel-profile-id}'.sub('{' + 'ipsec-vpn-tunnel-profile-id' + '}', ipsec_vpn_tunnel_profile_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 => 'IPSecVPNTunnelProfile')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiVpnIpsecTunnelProfilesApi#get_ip_sec_vpn_tunnel_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get IPSecTunnelProfile List Result
    # Get paginated list of all IPSecTunnelProfiles.
    # @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 [IPSecVPNTunnelProfileListResult]
    def list_ip_sec_vpn_tunnel_profiles(opts = {})
      data, _status_code, _headers = list_ip_sec_vpn_tunnel_profiles_with_http_info(opts)
      data
    end

    # Get IPSecTunnelProfile List Result
    # Get paginated list of all IPSecTunnelProfiles.
    # @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<(IPSecVPNTunnelProfileListResult, Fixnum, Hash)>] IPSecVPNTunnelProfileListResult data, response status code and response headers
    def list_ip_sec_vpn_tunnel_profiles_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecTunnelProfilesApi.list_ip_sec_vpn_tunnel_profiles ...'
      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 ManagementPlaneApiVpnIpsecTunnelProfilesApi.list_ip_sec_vpn_tunnel_profiles, 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 ManagementPlaneApiVpnIpsecTunnelProfilesApi.list_ip_sec_vpn_tunnel_profiles, must be greater than or equal to 0.'
      end

      # resource path
      local_var_path = '/vpn/ipsec/tunnel-profiles'

      # 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 => 'IPSecVPNTunnelProfileListResult')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiVpnIpsecTunnelProfilesApi#list_ip_sec_vpn_tunnel_profiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Edit custom IPSecTunnelProfile
    # Edit custom IPSec Tunnel Profile. System owned profiles are non editable.
    # @param ipsec_vpn_tunnel_profile_id 
    # @param ip_sec_vpn_tunnel_profile 
    # @param [Hash] opts the optional parameters
    # @return [IPSecVPNTunnelProfile]
    def update_ip_sec_vpn_tunnel_profile(ipsec_vpn_tunnel_profile_id, ip_sec_vpn_tunnel_profile, opts = {})
      data, _status_code, _headers = update_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, ip_sec_vpn_tunnel_profile, opts)
      data
    end

    # Edit custom IPSecTunnelProfile
    # Edit custom IPSec Tunnel Profile. System owned profiles are non editable.
    # @param ipsec_vpn_tunnel_profile_id 
    # @param ip_sec_vpn_tunnel_profile 
    # @param [Hash] opts the optional parameters
    # @return [Array<(IPSecVPNTunnelProfile, Fixnum, Hash)>] IPSecVPNTunnelProfile data, response status code and response headers
    def update_ip_sec_vpn_tunnel_profile_with_http_info(ipsec_vpn_tunnel_profile_id, ip_sec_vpn_tunnel_profile, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ManagementPlaneApiVpnIpsecTunnelProfilesApi.update_ip_sec_vpn_tunnel_profile ...'
      end
      # verify the required parameter 'ipsec_vpn_tunnel_profile_id' is set
      if @api_client.config.client_side_validation && ipsec_vpn_tunnel_profile_id.nil?
        fail ArgumentError, "Missing the required parameter 'ipsec_vpn_tunnel_profile_id' when calling ManagementPlaneApiVpnIpsecTunnelProfilesApi.update_ip_sec_vpn_tunnel_profile"
      end
      # verify the required parameter 'ip_sec_vpn_tunnel_profile' is set
      if @api_client.config.client_side_validation && ip_sec_vpn_tunnel_profile.nil?
        fail ArgumentError, "Missing the required parameter 'ip_sec_vpn_tunnel_profile' when calling ManagementPlaneApiVpnIpsecTunnelProfilesApi.update_ip_sec_vpn_tunnel_profile"
      end
      # resource path
      local_var_path = '/vpn/ipsec/tunnel-profiles/{ipsec-vpn-tunnel-profile-id}'.sub('{' + 'ipsec-vpn-tunnel-profile-id' + '}', ipsec_vpn_tunnel_profile_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(ip_sec_vpn_tunnel_profile)
      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 => 'IPSecVPNTunnelProfile')
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: ManagementPlaneApiVpnIpsecTunnelProfilesApi#update_ip_sec_vpn_tunnel_profile\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
