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

package security_management_l_d_a_p

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

import (
	"fmt"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// New creates a new security management l d a p API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

/*
Client for security management l d a p API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	ChangeOrder(params *ChangeOrderParams, opts ...ClientOption) (*ChangeOrderNoContent, error)

	CreateLdapServer(params *CreateLdapServerParams, opts ...ClientOption) (*CreateLdapServerCreated, error)

	DeleteLdapServer(params *DeleteLdapServerParams, opts ...ClientOption) (*DeleteLdapServerNoContent, error)

	GetLdapServer(params *GetLdapServerParams, opts ...ClientOption) (*GetLdapServerOK, error)

	GetLdapServers(params *GetLdapServersParams, opts ...ClientOption) (*GetLdapServersOK, error)

	UpdateLdapServer(params *UpdateLdapServerParams, opts ...ClientOption) (*UpdateLdapServerNoContent, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
ChangeOrder changes l d a p server order
*/
func (a *Client) ChangeOrder(params *ChangeOrderParams, opts ...ClientOption) (*ChangeOrderNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewChangeOrderParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "changeOrder",
		Method:             "POST",
		PathPattern:        "/v1/security/ldap/change-order",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &ChangeOrderReader{formats: a.formats},
		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.(*ChangeOrderNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for changeOrder: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
CreateLdapServer creates l d a p server
*/
func (a *Client) CreateLdapServer(params *CreateLdapServerParams, opts ...ClientOption) (*CreateLdapServerCreated, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreateLdapServerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "createLdapServer",
		Method:             "POST",
		PathPattern:        "/v1/security/ldap",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &CreateLdapServerReader{formats: a.formats},
		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.(*CreateLdapServerCreated)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for createLdapServer: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
DeleteLdapServer deletes l d a p server
*/
func (a *Client) DeleteLdapServer(params *DeleteLdapServerParams, opts ...ClientOption) (*DeleteLdapServerNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteLdapServerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "deleteLdapServer",
		Method:             "DELETE",
		PathPattern:        "/v1/security/ldap/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeleteLdapServerReader{formats: a.formats},
		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.(*DeleteLdapServerNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for deleteLdapServer: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetLdapServer gets l d a p server
*/
func (a *Client) GetLdapServer(params *GetLdapServerParams, opts ...ClientOption) (*GetLdapServerOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLdapServerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getLdapServer",
		Method:             "GET",
		PathPattern:        "/v1/security/ldap/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetLdapServerReader{formats: a.formats},
		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.(*GetLdapServerOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getLdapServer: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetLdapServers lists l d a p servers
*/
func (a *Client) GetLdapServers(params *GetLdapServersParams, opts ...ClientOption) (*GetLdapServersOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLdapServersParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getLdapServers",
		Method:             "GET",
		PathPattern:        "/v1/security/ldap",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetLdapServersReader{formats: a.formats},
		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.(*GetLdapServersOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getLdapServers: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
UpdateLdapServer updates l d a p server
*/
func (a *Client) UpdateLdapServer(params *UpdateLdapServerParams, opts ...ClientOption) (*UpdateLdapServerNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUpdateLdapServerParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "updateLdapServer",
		Method:             "PUT",
		PathPattern:        "/v1/security/ldap/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateLdapServerReader{formats: a.formats},
		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.(*UpdateLdapServerNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for updateLdapServer: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

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