// Code generated by go-swagger; DO NOT EDIT.

package secret_manager_service

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/runtime"
	httptransport "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
)

// New creates a new secret manager service API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

// New creates a new secret manager service API client with basic auth credentials.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
	return &Client{transport: transport, formats: strfmt.Default}
}

// New creates a new secret manager service API client with a bearer token for authentication.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
	return &Client{transport: transport, formats: strfmt.Default}
}

/*
Client for secret manager service API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	GetSecretManagerByID(params *GetSecretManagerByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSecretManagerByIDOK, error)

	OffboardSecretManager(params *OffboardSecretManagerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OffboardSecretManagerOK, error)

	OnboardSecretManager(params *OnboardSecretManagerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OnboardSecretManagerOK, error)

	PatchSecretManagerFeatures(params *PatchSecretManagerFeaturesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchSecretManagerFeaturesOK, error)

	UpdateSecretManagerToken(params *UpdateSecretManagerTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateSecretManagerTokenOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
GetSecretManagerByID get secret manager by ID API
*/
func (a *Client) GetSecretManagerByID(params *GetSecretManagerByIDParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSecretManagerByIDOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetSecretManagerByIDParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GetSecretManagerByID",
		Method:             "GET",
		PathPattern:        "/2023-05-01/vault-radar/projects/{location.project_id}/secret-managers/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetSecretManagerByIDReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetSecretManagerByIDOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GetSecretManagerByIDDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
OffboardSecretManager offboard secret manager API
*/
func (a *Client) OffboardSecretManager(params *OffboardSecretManagerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OffboardSecretManagerOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewOffboardSecretManagerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "OffboardSecretManager",
		Method:             "POST",
		PathPattern:        "/2023-05-01/vault-radar/projects/{location.project_id}/secret-managers/offboard",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &OffboardSecretManagerReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*OffboardSecretManagerOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*OffboardSecretManagerDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
OnboardSecretManager onboard secret manager API
*/
func (a *Client) OnboardSecretManager(params *OnboardSecretManagerParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*OnboardSecretManagerOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewOnboardSecretManagerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "OnboardSecretManager",
		Method:             "POST",
		PathPattern:        "/2023-05-01/vault-radar/projects/{location.project_id}/secret-managers/onboard",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &OnboardSecretManagerReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*OnboardSecretManagerOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*OnboardSecretManagerDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
PatchSecretManagerFeatures patch secret manager features API
*/
func (a *Client) PatchSecretManagerFeatures(params *PatchSecretManagerFeaturesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PatchSecretManagerFeaturesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPatchSecretManagerFeaturesParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "PatchSecretManagerFeatures",
		Method:             "PATCH",
		PathPattern:        "/2023-05-01/vault-radar/projects/{location.project_id}/secret-managers/features",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PatchSecretManagerFeaturesReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PatchSecretManagerFeaturesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*PatchSecretManagerFeaturesDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UpdateSecretManagerToken updates secret manager token updates the token and token location of a secret manager any empty field will be interpreted as an update to empty value specify all fields explicitly when updating
*/
func (a *Client) UpdateSecretManagerToken(params *UpdateSecretManagerTokenParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UpdateSecretManagerTokenOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUpdateSecretManagerTokenParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UpdateSecretManagerToken",
		Method:             "PUT",
		PathPattern:        "/2023-05-01/vault-radar/projects/{location.project_id}/secret-managers/token",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateSecretManagerTokenReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*UpdateSecretManagerTokenOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UpdateSecretManagerTokenDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
