github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/ldap/ldap_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package ldap
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	strfmt "github.com/go-openapi/strfmt"
    14  )
    15  
    16  //go:generate mockery -name API -inpkg
    17  
    18  // API is the interface of the ldap client
    19  type API interface {
    20  	/*
    21  	   ImportLdapUser imports selected available ldap users
    22  
    23  	   This endpoint adds the selected available ldap users to harbor based on related configuration parameters from the system. System will try to guess the user email address and realname, add to harbor user information. If have errors when import user, will return the list of importing failed uid and the failed reason.
    24  	*/
    25  	ImportLdapUser(ctx context.Context, params *ImportLdapUserParams) (*ImportLdapUserOK, error)
    26  	/*
    27  	   PingLdap pings available ldap service
    28  
    29  	   This endpoint ping the available ldap service for test related configuration parameters.
    30  	*/
    31  	PingLdap(ctx context.Context, params *PingLdapParams) (*PingLdapOK, error)
    32  	/*
    33  	   SearchLdapGroup searches available ldap groups
    34  
    35  	   This endpoint searches the available ldap groups based on related configuration parameters. support to search by groupname or groupdn.
    36  	*/
    37  	SearchLdapGroup(ctx context.Context, params *SearchLdapGroupParams) (*SearchLdapGroupOK, error)
    38  	/*
    39  	   SearchLdapUser searches available ldap users
    40  
    41  	   This endpoint searches the available ldap users based on related configuration parameters. Support searched by input ladp configuration, load configuration from the system and specific filter.
    42  	*/
    43  	SearchLdapUser(ctx context.Context, params *SearchLdapUserParams) (*SearchLdapUserOK, error)
    44  }
    45  
    46  // New creates a new ldap API client.
    47  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    48  	return &Client{
    49  		transport: transport,
    50  		formats:   formats,
    51  		authInfo:  authInfo,
    52  	}
    53  }
    54  
    55  /*
    56  Client for ldap API
    57  */
    58  type Client struct {
    59  	transport runtime.ClientTransport
    60  	formats   strfmt.Registry
    61  	authInfo  runtime.ClientAuthInfoWriter
    62  }
    63  
    64  /*
    65  ImportLdapUser imports selected available ldap users
    66  
    67  This endpoint adds the selected available ldap users to harbor based on related configuration parameters from the system. System will try to guess the user email address and realname, add to harbor user information. If have errors when import user, will return the list of importing failed uid and the failed reason.
    68  */
    69  func (a *Client) ImportLdapUser(ctx context.Context, params *ImportLdapUserParams) (*ImportLdapUserOK, error) {
    70  
    71  	result, err := a.transport.Submit(&runtime.ClientOperation{
    72  		ID:                 "importLdapUser",
    73  		Method:             "POST",
    74  		PathPattern:        "/ldap/users/import",
    75  		ProducesMediaTypes: []string{"application/json"},
    76  		ConsumesMediaTypes: []string{"application/json"},
    77  		Schemes:            []string{"http", "https"},
    78  		Params:             params,
    79  		Reader:             &ImportLdapUserReader{formats: a.formats},
    80  		AuthInfo:           a.authInfo,
    81  		Context:            ctx,
    82  		Client:             params.HTTPClient,
    83  	})
    84  	if err != nil {
    85  		return nil, err
    86  	}
    87  	return result.(*ImportLdapUserOK), nil
    88  
    89  }
    90  
    91  /*
    92  PingLdap pings available ldap service
    93  
    94  This endpoint ping the available ldap service for test related configuration parameters.
    95  */
    96  func (a *Client) PingLdap(ctx context.Context, params *PingLdapParams) (*PingLdapOK, error) {
    97  
    98  	result, err := a.transport.Submit(&runtime.ClientOperation{
    99  		ID:                 "pingLdap",
   100  		Method:             "POST",
   101  		PathPattern:        "/ldap/ping",
   102  		ProducesMediaTypes: []string{"application/json"},
   103  		ConsumesMediaTypes: []string{"application/json"},
   104  		Schemes:            []string{"http", "https"},
   105  		Params:             params,
   106  		Reader:             &PingLdapReader{formats: a.formats},
   107  		AuthInfo:           a.authInfo,
   108  		Context:            ctx,
   109  		Client:             params.HTTPClient,
   110  	})
   111  	if err != nil {
   112  		return nil, err
   113  	}
   114  	return result.(*PingLdapOK), nil
   115  
   116  }
   117  
   118  /*
   119  SearchLdapGroup searches available ldap groups
   120  
   121  This endpoint searches the available ldap groups based on related configuration parameters. support to search by groupname or groupdn.
   122  */
   123  func (a *Client) SearchLdapGroup(ctx context.Context, params *SearchLdapGroupParams) (*SearchLdapGroupOK, error) {
   124  
   125  	result, err := a.transport.Submit(&runtime.ClientOperation{
   126  		ID:                 "searchLdapGroup",
   127  		Method:             "GET",
   128  		PathPattern:        "/ldap/groups/search",
   129  		ProducesMediaTypes: []string{"application/json"},
   130  		ConsumesMediaTypes: []string{"application/json"},
   131  		Schemes:            []string{"http", "https"},
   132  		Params:             params,
   133  		Reader:             &SearchLdapGroupReader{formats: a.formats},
   134  		AuthInfo:           a.authInfo,
   135  		Context:            ctx,
   136  		Client:             params.HTTPClient,
   137  	})
   138  	if err != nil {
   139  		return nil, err
   140  	}
   141  	return result.(*SearchLdapGroupOK), nil
   142  
   143  }
   144  
   145  /*
   146  SearchLdapUser searches available ldap users
   147  
   148  This endpoint searches the available ldap users based on related configuration parameters. Support searched by input ladp configuration, load configuration from the system and specific filter.
   149  */
   150  func (a *Client) SearchLdapUser(ctx context.Context, params *SearchLdapUserParams) (*SearchLdapUserOK, error) {
   151  
   152  	result, err := a.transport.Submit(&runtime.ClientOperation{
   153  		ID:                 "searchLdapUser",
   154  		Method:             "GET",
   155  		PathPattern:        "/ldap/users/search",
   156  		ProducesMediaTypes: []string{"application/json"},
   157  		ConsumesMediaTypes: []string{"application/json"},
   158  		Schemes:            []string{"http", "https"},
   159  		Params:             params,
   160  		Reader:             &SearchLdapUserReader{formats: a.formats},
   161  		AuthInfo:           a.authInfo,
   162  		Context:            ctx,
   163  		Client:             params.HTTPClient,
   164  	})
   165  	if err != nil {
   166  		return nil, err
   167  	}
   168  	return result.(*SearchLdapUserOK), nil
   169  
   170  }