func New(options ...Option) (*APIClient, error) {
	remote, err := url.ParseRequestURI(DefaultAddr)
	if err != nil {
		return nil, err
	}

	client := &APIClient{
		Timeout:    DefaultTimeout,
		Mount:      DefaultMount,
		Remote:     remote,
		BufferPool: bufferutil.NewPool(DefaultBufferPoolSize),
	}

	client.KV1 = &KV1{Client: client}
	client.KV2 = &KV2{Client: client}
	client.Transit = &Transit{Client: client}
	client.AWSAuth, err = NewAWSAuth()
	if err != nil {
		return nil, err
	}

	for _, option := range options {
		if err = option(client); err != nil {
			return nil, err
		}
	}

	xport := client.Transport
	if xport == nil {
		xport = &http.Transport{}
		err = http2.ConfigureTransport(xport)
		if err != nil {
			return nil, err
		}
	}

	client.Client = &http.Client{
		Transport: xport,
		Timeout:   client.Timeout,
	}

	return client, nil
}
// New creates a new vault client with a default set of options.
New creates a new vault client with a default set of options.
// New creates a new vault client with a default set of options .
func New(options ...Option) (*APIClient, error) {
	remote, err := url.ParseRequestURI(DefaultAddr)
	if err != nil {
		return nil, err
	}
	client := &APIClient{
		Timeout:    DefaultTimeout,
		Mount:      DefaultMount,
		Remote:     remote,
		BufferPool: bufferutil.NewPool(DefaultBufferPoolSize),
	}
	client.KV1 = &KV1{Client: client}
	client.KV2 = &KV2{Client: client}
	client.Transit = &Transit{Client: client}
	client.AWSAuth, err = NewAWSAuth()
	if err != nil {
		return nil, err
	}
	for _, option := range options {
		if err = option(client); err != nil {
			return nil, err
		}
	}
	xport := client.Transport
	if xport == nil {
		xport = &http.Transport{}
		err = http2.ConfigureTransport(xport)
		if err != nil {
			return nil, err
		}
	}
	client.Client = &http.Client{
		Transport: xport,
		Timeout:   client.Timeout,
	}
	return client, nil
}
func New ( options ... Option ) ( * APIClient , error ) { remote , err := url . ParseRequestURI ( DefaultAddr ) if err != nil { return nil , err } client := & APIClient { Timeout : DefaultTimeout , Mount : DefaultMount , Remote : remote , BufferPool : bufferutil . NewPool ( DefaultBufferPoolSize ) , } client . KV1 = & KV1 { Client : client } client . KV2 = & KV2 { Client : client } client . Transit = & Transit { Client : client } client . AWSAuth , err = NewAWSAuth ( ) if err != nil { return nil , err } for _ , option := range options { if err = option ( client ) ; err != nil { return nil , err } } xport := client . Transport if xport == nil { xport = & http . Transport { } err = http2 . ConfigureTransport ( xport ) if err != nil { return nil , err } } client . Client = & http . Client { Transport : xport , Timeout : client . Timeout , } return client , nil }
New creates a new vault client with a default set of options.
New creates a new vault client with a default set of options .