1 Star 0 Fork 0

nanjo_fan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
scanner_client.go 12.30 KB
一键复制 编辑 原始数据 按行查看 历史
王帆 提交于 2023-02-13 08:49 . first commit
// Code generated by go-swagger; DO NOT EDIT.
package scanner
// 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 scanner API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for scanner API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
CreateScanner(params *CreateScannerParams, authInfo runtime.ClientAuthInfoWriter) (*CreateScannerCreated, error)
DeleteScanner(params *DeleteScannerParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteScannerOK, error)
GetScanner(params *GetScannerParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerOK, error)
GetScannerMetadata(params *GetScannerMetadataParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerMetadataOK, error)
ListScanners(params *ListScannersParams, authInfo runtime.ClientAuthInfoWriter) (*ListScannersOK, error)
PingScanner(params *PingScannerParams, authInfo runtime.ClientAuthInfoWriter) (*PingScannerOK, error)
SetScannerAsDefault(params *SetScannerAsDefaultParams, authInfo runtime.ClientAuthInfoWriter) (*SetScannerAsDefaultOK, error)
UpdateScanner(params *UpdateScannerParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateScannerOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
CreateScanner creates a scanner registration
Creats a new scanner registration with the given data.
*/
func (a *Client) CreateScanner(params *CreateScannerParams, authInfo runtime.ClientAuthInfoWriter) (*CreateScannerCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateScannerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "createScanner",
Method: "POST",
PathPattern: "/scanners",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &CreateScannerReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*CreateScannerCreated)
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 createScanner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteScanner deletes a scanner registration
Deletes the specified scanner registration.
*/
func (a *Client) DeleteScanner(params *DeleteScannerParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteScannerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteScannerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteScanner",
Method: "DELETE",
PathPattern: "/scanners/{registration_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteScannerReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteScannerOK)
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 deleteScanner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetScanner gets a scanner registration details
Retruns the details of the specified scanner registration.
*/
func (a *Client) GetScanner(params *GetScannerParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetScannerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getScanner",
Method: "GET",
PathPattern: "/scanners/{registration_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetScannerReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetScannerOK)
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 getScanner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetScannerMetadata gets the metadata of the specified scanner registration
Get the metadata of the specified scanner registration, including the capabilities and customized properties.
*/
func (a *Client) GetScannerMetadata(params *GetScannerMetadataParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerMetadataOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetScannerMetadataParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getScannerMetadata",
Method: "GET",
PathPattern: "/scanners/{registration_id}/metadata",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetScannerMetadataReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetScannerMetadataOK)
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 getScannerMetadata: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListScanners lists scanner registrations
Returns a list of currently configured scanner registrations.
*/
func (a *Client) ListScanners(params *ListScannersParams, authInfo runtime.ClientAuthInfoWriter) (*ListScannersOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListScannersParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listScanners",
Method: "GET",
PathPattern: "/scanners",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListScannersReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListScannersOK)
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 listScanners: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
PingScanner tests scanner registration settings
Pings scanner adapter to test endpoint URL and authorization settings.
*/
func (a *Client) PingScanner(params *PingScannerParams, authInfo runtime.ClientAuthInfoWriter) (*PingScannerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewPingScannerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "pingScanner",
Method: "POST",
PathPattern: "/scanners/ping",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &PingScannerReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*PingScannerOK)
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 pingScanner: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
SetScannerAsDefault sets system default scanner registration
Set the specified scanner registration as the system default one.
*/
func (a *Client) SetScannerAsDefault(params *SetScannerAsDefaultParams, authInfo runtime.ClientAuthInfoWriter) (*SetScannerAsDefaultOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewSetScannerAsDefaultParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "setScannerAsDefault",
Method: "PATCH",
PathPattern: "/scanners/{registration_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &SetScannerAsDefaultReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*SetScannerAsDefaultOK)
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 setScannerAsDefault: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateScanner updates a scanner registration
Updates the specified scanner registration.
*/
func (a *Client) UpdateScanner(params *UpdateScannerParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateScannerOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateScannerParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "updateScanner",
Method: "PUT",
PathPattern: "/scanners/{registration_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &UpdateScannerReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*UpdateScannerOK)
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 updateScanner: 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
}
Go
1
https://gitee.com/nanjo-fan/goharbor-client.git
git@gitee.com:nanjo-fan/goharbor-client.git
nanjo-fan
goharbor-client
goharbor-client
v1.0.2

搜索帮助