1 Star 0 Fork 0

nanjo_fan / goharbor-client

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
project_client.go 18.42 KB
一键复制 编辑 原始数据 按行查看 历史
王帆 提交于 2023-02-13 08:49 . first commit
// Code generated by go-swagger; DO NOT EDIT.
package project
// 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 project API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
return &Client{transport: transport, formats: formats}
}
/*
Client for project API
*/
type Client struct {
transport runtime.ClientTransport
formats strfmt.Registry
}
// ClientService is the interface for Client methods
type ClientService interface {
CreateProject(params *CreateProjectParams, authInfo runtime.ClientAuthInfoWriter) (*CreateProjectCreated, error)
DeleteProject(params *DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProjectOK, error)
GetLogs(params *GetLogsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLogsOK, error)
GetProject(params *GetProjectParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectOK, error)
GetProjectDeletable(params *GetProjectDeletableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectDeletableOK, error)
GetProjectSummary(params *GetProjectSummaryParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectSummaryOK, error)
GetScannerOfProject(params *GetScannerOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerOfProjectOK, error)
HeadProject(params *HeadProjectParams, authInfo runtime.ClientAuthInfoWriter) (*HeadProjectOK, error)
ListProjects(params *ListProjectsParams, authInfo runtime.ClientAuthInfoWriter) (*ListProjectsOK, error)
ListScannerCandidatesOfProject(params *ListScannerCandidatesOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*ListScannerCandidatesOfProjectOK, error)
SetScannerOfProject(params *SetScannerOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*SetScannerOfProjectOK, error)
UpdateProject(params *UpdateProjectParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateProjectOK, error)
SetTransport(transport runtime.ClientTransport)
}
/*
CreateProject creates a new project
This endpoint is for user to create a new project.
*/
func (a *Client) CreateProject(params *CreateProjectParams, authInfo runtime.ClientAuthInfoWriter) (*CreateProjectCreated, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewCreateProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "createProject",
Method: "POST",
PathPattern: "/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &CreateProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*CreateProjectCreated)
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 createProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
DeleteProject deletes project by project ID
This endpoint is aimed to delete project by project ID.
*/
func (a *Client) DeleteProject(params *DeleteProjectParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewDeleteProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "deleteProject",
Method: "DELETE",
PathPattern: "/projects/{project_name_or_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &DeleteProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*DeleteProjectOK)
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 deleteProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetLogs gets recent logs of the projects
Get recent logs of the projects
*/
func (a *Client) GetLogs(params *GetLogsParams, authInfo runtime.ClientAuthInfoWriter) (*GetLogsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetLogsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getLogs",
Method: "GET",
PathPattern: "/projects/{project_name}/logs",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetLogsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetLogsOK)
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 getLogs: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetProject returns specific project detail information
This endpoint returns specific project information by project ID.
*/
func (a *Client) GetProject(params *GetProjectParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getProject",
Method: "GET",
PathPattern: "/projects/{project_name_or_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetProjectOK)
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 getProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetProjectDeletable gets the deletable status of the project
Get the deletable status of the project
*/
func (a *Client) GetProjectDeletable(params *GetProjectDeletableParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectDeletableOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProjectDeletableParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getProjectDeletable",
Method: "GET",
PathPattern: "/projects/{project_name_or_id}/_deletable",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetProjectDeletableReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetProjectDeletableOK)
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 getProjectDeletable: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetProjectSummary gets summary of the project
Get summary of the project.
*/
func (a *Client) GetProjectSummary(params *GetProjectSummaryParams, authInfo runtime.ClientAuthInfoWriter) (*GetProjectSummaryOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetProjectSummaryParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getProjectSummary",
Method: "GET",
PathPattern: "/projects/{project_name_or_id}/summary",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetProjectSummaryReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetProjectSummaryOK)
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 getProjectSummary: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
GetScannerOfProject gets project level scanner
Get the scanner registration of the specified project. If no scanner registration is configured for the specified project, the system default scanner registration will be returned.
*/
func (a *Client) GetScannerOfProject(params *GetScannerOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*GetScannerOfProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewGetScannerOfProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "getScannerOfProject",
Method: "GET",
PathPattern: "/projects/{project_name_or_id}/scanner",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &GetScannerOfProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*GetScannerOfProjectOK)
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 getScannerOfProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
HeadProject checks if the project name user provided already exists
This endpoint is used to check if the project name provided already exist.
*/
func (a *Client) HeadProject(params *HeadProjectParams, authInfo runtime.ClientAuthInfoWriter) (*HeadProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewHeadProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "headProject",
Method: "HEAD",
PathPattern: "/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &HeadProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*HeadProjectOK)
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 headProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListProjects lists projects
This endpoint returns projects created by Harbor.
*/
func (a *Client) ListProjects(params *ListProjectsParams, authInfo runtime.ClientAuthInfoWriter) (*ListProjectsOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListProjectsParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listProjects",
Method: "GET",
PathPattern: "/projects",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListProjectsReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListProjectsOK)
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 listProjects: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
ListScannerCandidatesOfProject gets scanner registration candidates for configurating project level scanner
Retrieve the system configured scanner registrations as candidates of setting project level scanner.
*/
func (a *Client) ListScannerCandidatesOfProject(params *ListScannerCandidatesOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*ListScannerCandidatesOfProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewListScannerCandidatesOfProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "listScannerCandidatesOfProject",
Method: "GET",
PathPattern: "/projects/{project_name_or_id}/scanner/candidates",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &ListScannerCandidatesOfProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*ListScannerCandidatesOfProjectOK)
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 listScannerCandidatesOfProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
SetScannerOfProject configures scanner for the specified project
Set one of the system configured scanner registration as the indepndent scanner of the specified project.
*/
func (a *Client) SetScannerOfProject(params *SetScannerOfProjectParams, authInfo runtime.ClientAuthInfoWriter) (*SetScannerOfProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewSetScannerOfProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "setScannerOfProject",
Method: "PUT",
PathPattern: "/projects/{project_name_or_id}/scanner",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &SetScannerOfProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*SetScannerOfProjectOK)
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 setScannerOfProject: API contract not enforced by server. Client expected to get an error, but got: %T", result)
panic(msg)
}
/*
UpdateProject updates properties for a selected project
This endpoint is aimed to update the properties of a project.
*/
func (a *Client) UpdateProject(params *UpdateProjectParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateProjectOK, error) {
// TODO: Validate the params before sending
if params == nil {
params = NewUpdateProjectParams()
}
result, err := a.transport.Submit(&runtime.ClientOperation{
ID: "updateProject",
Method: "PUT",
PathPattern: "/projects/{project_name_or_id}",
ProducesMediaTypes: []string{"application/json"},
ConsumesMediaTypes: []string{"application/json"},
Schemes: []string{"http", "https"},
Params: params,
Reader: &UpdateProjectReader{formats: a.formats},
AuthInfo: authInfo,
Context: params.Context,
Client: params.HTTPClient,
})
if err != nil {
return nil, err
}
success, ok := result.(*UpdateProjectOK)
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 updateProject: 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

搜索帮助