1 Star 0 Fork 0

pengchengduan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ldap_client.go 6.94 KB
一键复制 编辑 原始数据 按行查看 历史
pengchengduan 提交于 2024-02-01 17:28 . first commit
// Code generated by go-swagger; DO NOT EDIT.
package ldap
// 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 ldap API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for ldap API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
ImportLdapUser(params *ImportLdapUserParams, authInfo runtime.ClientAuthInfoWriter) (*ImportLdapUserOK, error)
PingLdap(params *PingLdapParams, authInfo runtime.ClientAuthInfoWriter) (*PingLdapOK, error)
SearchLdapGroup(params *SearchLdapGroupParams, authInfo runtime.ClientAuthInfoWriter) (*SearchLdapGroupOK, error)
SearchLdapUser(params *SearchLdapUserParams, authInfo runtime.ClientAuthInfoWriter) (*SearchLdapUserOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
ImportLdapUser imports selected available ldap users
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.
*/
func (a *Client) ImportLdapUser(params *ImportLdapUserParams, authInfo runtime.ClientAuthInfoWriter) (*ImportLdapUserOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewImportLdapUserParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "importLdapUser",
Method: "POST",
PathPattern: "/ldap/users/import",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ImportLdapUserReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ImportLdapUserOK)
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 importLdapUser: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PingLdap pings available ldap service
This endpoint ping the available ldap service for test related configuration parameters.
*/
func (a *Client) PingLdap(params *PingLdapParams, authInfo runtime.ClientAuthInfoWriter) (*PingLdapOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPingLdapParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "pingLdap",
Method: "POST",
PathPattern: "/ldap/ping",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PingLdapReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*PingLdapOK)
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 pingLdap: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
SearchLdapGroup searches available ldap groups
This endpoint searches the available ldap groups based on related configuration parameters. support to search by groupname or groupdn.
*/
func (a *Client) SearchLdapGroup(params *SearchLdapGroupParams, authInfo runtime.ClientAuthInfoWriter) (*SearchLdapGroupOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewSearchLdapGroupParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "searchLdapGroup",
Method: "GET",
PathPattern: "/ldap/groups/search",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &SearchLdapGroupReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*SearchLdapGroupOK)
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 searchLdapGroup: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
SearchLdapUser searches available ldap users
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.
*/
func (a *Client) SearchLdapUser(params *SearchLdapUserParams, authInfo runtime.ClientAuthInfoWriter) (*SearchLdapUserOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewSearchLdapUserParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "searchLdapUser",
Method: "GET",
PathPattern: "/ldap/users/search",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &SearchLdapUserReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*SearchLdapUserOK)
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 searchLdapUser: 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
}
1
https://gitee.com/pengchengduan/goharbor-client.git
git@gitee.com:pengchengduan/goharbor-client.git
pengchengduan
goharbor-client
goharbor-client
41c6882efe91

搜索帮助

53164aa7 5694891 3bd8fe86 5694891