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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package project
     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 project client
    19  type API interface {
    20  	/*
    21  	   CreateProject creates a new project
    22  
    23  	   This endpoint is for user to create a new project.*/
    24  	CreateProject(ctx context.Context, params *CreateProjectParams) (*CreateProjectCreated, error)
    25  	/*
    26  	   DeleteProject deletes project by project ID
    27  
    28  	   This endpoint is aimed to delete project by project ID.*/
    29  	DeleteProject(ctx context.Context, params *DeleteProjectParams) (*DeleteProjectOK, error)
    30  	/*
    31  	   GetLogs gets recent logs of the projects
    32  
    33  	   Get recent logs of the projects*/
    34  	GetLogs(ctx context.Context, params *GetLogsParams) (*GetLogsOK, error)
    35  	/*
    36  	   GetProject returns specific project detail information
    37  
    38  	   This endpoint returns specific project information by project ID.*/
    39  	GetProject(ctx context.Context, params *GetProjectParams) (*GetProjectOK, error)
    40  	/*
    41  	   GetProjectDeletable gets the deletable status of the project
    42  
    43  	   Get the deletable status of the project*/
    44  	GetProjectDeletable(ctx context.Context, params *GetProjectDeletableParams) (*GetProjectDeletableOK, error)
    45  	/*
    46  	   GetProjectSummary gets summary of the project
    47  
    48  	   Get summary of the project.*/
    49  	GetProjectSummary(ctx context.Context, params *GetProjectSummaryParams) (*GetProjectSummaryOK, error)
    50  	/*
    51  	   GetScannerOfProject gets project level scanner
    52  
    53  	   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.*/
    54  	GetScannerOfProject(ctx context.Context, params *GetScannerOfProjectParams) (*GetScannerOfProjectOK, error)
    55  	/*
    56  	   HeadProject checks if the project name user provided already exists
    57  
    58  	   This endpoint is used to check if the project name provided already exist.*/
    59  	HeadProject(ctx context.Context, params *HeadProjectParams) (*HeadProjectOK, error)
    60  	/*
    61  	   ListProjects lists projects
    62  
    63  	   This endpoint returns projects created by Harbor.*/
    64  	ListProjects(ctx context.Context, params *ListProjectsParams) (*ListProjectsOK, error)
    65  	/*
    66  	   ListScannerCandidatesOfProject gets scanner registration candidates for configurating project level scanner
    67  
    68  	   Retrieve the system configured scanner registrations as candidates of setting project level scanner.*/
    69  	ListScannerCandidatesOfProject(ctx context.Context, params *ListScannerCandidatesOfProjectParams) (*ListScannerCandidatesOfProjectOK, error)
    70  	/*
    71  	   SetScannerOfProject configures scanner for the specified project
    72  
    73  	   Set one of the system configured scanner registration as the indepndent scanner of the specified project.*/
    74  	SetScannerOfProject(ctx context.Context, params *SetScannerOfProjectParams) (*SetScannerOfProjectOK, error)
    75  	/*
    76  	   UpdateProject updates properties for a selected project
    77  
    78  	   This endpoint is aimed to update the properties of a project.*/
    79  	UpdateProject(ctx context.Context, params *UpdateProjectParams) (*UpdateProjectOK, error)
    80  }
    81  
    82  // New creates a new project API client.
    83  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    84  	return &Client{
    85  		transport: transport,
    86  		formats:   formats,
    87  		authInfo:  authInfo,
    88  	}
    89  }
    90  
    91  /*
    92  Client for project API
    93  */
    94  type Client struct {
    95  	transport runtime.ClientTransport
    96  	formats   strfmt.Registry
    97  	authInfo  runtime.ClientAuthInfoWriter
    98  }
    99  
   100  /*
   101  CreateProject creates a new project
   102  
   103  This endpoint is for user to create a new project.
   104  */
   105  func (a *Client) CreateProject(ctx context.Context, params *CreateProjectParams) (*CreateProjectCreated, error) {
   106  
   107  	result, err := a.transport.Submit(&runtime.ClientOperation{
   108  		ID:                 "createProject",
   109  		Method:             "POST",
   110  		PathPattern:        "/projects",
   111  		ProducesMediaTypes: []string{"application/json"},
   112  		ConsumesMediaTypes: []string{"application/json"},
   113  		Schemes:            []string{"http", "https"},
   114  		Params:             params,
   115  		Reader:             &CreateProjectReader{formats: a.formats},
   116  		AuthInfo:           a.authInfo,
   117  		Context:            ctx,
   118  		Client:             params.HTTPClient,
   119  	})
   120  	if err != nil {
   121  		return nil, err
   122  	}
   123  	return result.(*CreateProjectCreated), nil
   124  
   125  }
   126  
   127  /*
   128  DeleteProject deletes project by project ID
   129  
   130  This endpoint is aimed to delete project by project ID.
   131  */
   132  func (a *Client) DeleteProject(ctx context.Context, params *DeleteProjectParams) (*DeleteProjectOK, error) {
   133  
   134  	result, err := a.transport.Submit(&runtime.ClientOperation{
   135  		ID:                 "deleteProject",
   136  		Method:             "DELETE",
   137  		PathPattern:        "/projects/{project_name_or_id}",
   138  		ProducesMediaTypes: []string{"application/json"},
   139  		ConsumesMediaTypes: []string{"application/json"},
   140  		Schemes:            []string{"http", "https"},
   141  		Params:             params,
   142  		Reader:             &DeleteProjectReader{formats: a.formats},
   143  		AuthInfo:           a.authInfo,
   144  		Context:            ctx,
   145  		Client:             params.HTTPClient,
   146  	})
   147  	if err != nil {
   148  		return nil, err
   149  	}
   150  	return result.(*DeleteProjectOK), nil
   151  
   152  }
   153  
   154  /*
   155  GetLogs gets recent logs of the projects
   156  
   157  Get recent logs of the projects
   158  */
   159  func (a *Client) GetLogs(ctx context.Context, params *GetLogsParams) (*GetLogsOK, error) {
   160  
   161  	result, err := a.transport.Submit(&runtime.ClientOperation{
   162  		ID:                 "getLogs",
   163  		Method:             "GET",
   164  		PathPattern:        "/projects/{project_name}/logs",
   165  		ProducesMediaTypes: []string{"application/json"},
   166  		ConsumesMediaTypes: []string{"application/json"},
   167  		Schemes:            []string{"http", "https"},
   168  		Params:             params,
   169  		Reader:             &GetLogsReader{formats: a.formats},
   170  		AuthInfo:           a.authInfo,
   171  		Context:            ctx,
   172  		Client:             params.HTTPClient,
   173  	})
   174  	if err != nil {
   175  		return nil, err
   176  	}
   177  	return result.(*GetLogsOK), nil
   178  
   179  }
   180  
   181  /*
   182  GetProject returns specific project detail information
   183  
   184  This endpoint returns specific project information by project ID.
   185  */
   186  func (a *Client) GetProject(ctx context.Context, params *GetProjectParams) (*GetProjectOK, error) {
   187  
   188  	result, err := a.transport.Submit(&runtime.ClientOperation{
   189  		ID:                 "getProject",
   190  		Method:             "GET",
   191  		PathPattern:        "/projects/{project_name_or_id}",
   192  		ProducesMediaTypes: []string{"application/json"},
   193  		ConsumesMediaTypes: []string{"application/json"},
   194  		Schemes:            []string{"http", "https"},
   195  		Params:             params,
   196  		Reader:             &GetProjectReader{formats: a.formats},
   197  		AuthInfo:           a.authInfo,
   198  		Context:            ctx,
   199  		Client:             params.HTTPClient,
   200  	})
   201  	if err != nil {
   202  		return nil, err
   203  	}
   204  	return result.(*GetProjectOK), nil
   205  
   206  }
   207  
   208  /*
   209  GetProjectDeletable gets the deletable status of the project
   210  
   211  Get the deletable status of the project
   212  */
   213  func (a *Client) GetProjectDeletable(ctx context.Context, params *GetProjectDeletableParams) (*GetProjectDeletableOK, error) {
   214  
   215  	result, err := a.transport.Submit(&runtime.ClientOperation{
   216  		ID:                 "getProjectDeletable",
   217  		Method:             "GET",
   218  		PathPattern:        "/projects/{project_name_or_id}/_deletable",
   219  		ProducesMediaTypes: []string{"application/json"},
   220  		ConsumesMediaTypes: []string{"application/json"},
   221  		Schemes:            []string{"http", "https"},
   222  		Params:             params,
   223  		Reader:             &GetProjectDeletableReader{formats: a.formats},
   224  		AuthInfo:           a.authInfo,
   225  		Context:            ctx,
   226  		Client:             params.HTTPClient,
   227  	})
   228  	if err != nil {
   229  		return nil, err
   230  	}
   231  	return result.(*GetProjectDeletableOK), nil
   232  
   233  }
   234  
   235  /*
   236  GetProjectSummary gets summary of the project
   237  
   238  Get summary of the project.
   239  */
   240  func (a *Client) GetProjectSummary(ctx context.Context, params *GetProjectSummaryParams) (*GetProjectSummaryOK, error) {
   241  
   242  	result, err := a.transport.Submit(&runtime.ClientOperation{
   243  		ID:                 "getProjectSummary",
   244  		Method:             "GET",
   245  		PathPattern:        "/projects/{project_name_or_id}/summary",
   246  		ProducesMediaTypes: []string{"application/json"},
   247  		ConsumesMediaTypes: []string{"application/json"},
   248  		Schemes:            []string{"http", "https"},
   249  		Params:             params,
   250  		Reader:             &GetProjectSummaryReader{formats: a.formats},
   251  		AuthInfo:           a.authInfo,
   252  		Context:            ctx,
   253  		Client:             params.HTTPClient,
   254  	})
   255  	if err != nil {
   256  		return nil, err
   257  	}
   258  	return result.(*GetProjectSummaryOK), nil
   259  
   260  }
   261  
   262  /*
   263  GetScannerOfProject gets project level scanner
   264  
   265  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.
   266  */
   267  func (a *Client) GetScannerOfProject(ctx context.Context, params *GetScannerOfProjectParams) (*GetScannerOfProjectOK, error) {
   268  
   269  	result, err := a.transport.Submit(&runtime.ClientOperation{
   270  		ID:                 "getScannerOfProject",
   271  		Method:             "GET",
   272  		PathPattern:        "/projects/{project_name_or_id}/scanner",
   273  		ProducesMediaTypes: []string{"application/json"},
   274  		ConsumesMediaTypes: []string{"application/json"},
   275  		Schemes:            []string{"http", "https"},
   276  		Params:             params,
   277  		Reader:             &GetScannerOfProjectReader{formats: a.formats},
   278  		AuthInfo:           a.authInfo,
   279  		Context:            ctx,
   280  		Client:             params.HTTPClient,
   281  	})
   282  	if err != nil {
   283  		return nil, err
   284  	}
   285  	return result.(*GetScannerOfProjectOK), nil
   286  
   287  }
   288  
   289  /*
   290  HeadProject checks if the project name user provided already exists
   291  
   292  This endpoint is used to check if the project name provided already exist.
   293  */
   294  func (a *Client) HeadProject(ctx context.Context, params *HeadProjectParams) (*HeadProjectOK, error) {
   295  
   296  	result, err := a.transport.Submit(&runtime.ClientOperation{
   297  		ID:                 "headProject",
   298  		Method:             "HEAD",
   299  		PathPattern:        "/projects",
   300  		ProducesMediaTypes: []string{"application/json"},
   301  		ConsumesMediaTypes: []string{"application/json"},
   302  		Schemes:            []string{"http", "https"},
   303  		Params:             params,
   304  		Reader:             &HeadProjectReader{formats: a.formats},
   305  		AuthInfo:           a.authInfo,
   306  		Context:            ctx,
   307  		Client:             params.HTTPClient,
   308  	})
   309  	if err != nil {
   310  		return nil, err
   311  	}
   312  	return result.(*HeadProjectOK), nil
   313  
   314  }
   315  
   316  /*
   317  ListProjects lists projects
   318  
   319  This endpoint returns projects created by Harbor.
   320  */
   321  func (a *Client) ListProjects(ctx context.Context, params *ListProjectsParams) (*ListProjectsOK, error) {
   322  
   323  	result, err := a.transport.Submit(&runtime.ClientOperation{
   324  		ID:                 "listProjects",
   325  		Method:             "GET",
   326  		PathPattern:        "/projects",
   327  		ProducesMediaTypes: []string{"application/json"},
   328  		ConsumesMediaTypes: []string{"application/json"},
   329  		Schemes:            []string{"http", "https"},
   330  		Params:             params,
   331  		Reader:             &ListProjectsReader{formats: a.formats},
   332  		AuthInfo:           a.authInfo,
   333  		Context:            ctx,
   334  		Client:             params.HTTPClient,
   335  	})
   336  	if err != nil {
   337  		return nil, err
   338  	}
   339  	return result.(*ListProjectsOK), nil
   340  
   341  }
   342  
   343  /*
   344  ListScannerCandidatesOfProject gets scanner registration candidates for configurating project level scanner
   345  
   346  Retrieve the system configured scanner registrations as candidates of setting project level scanner.
   347  */
   348  func (a *Client) ListScannerCandidatesOfProject(ctx context.Context, params *ListScannerCandidatesOfProjectParams) (*ListScannerCandidatesOfProjectOK, error) {
   349  
   350  	result, err := a.transport.Submit(&runtime.ClientOperation{
   351  		ID:                 "listScannerCandidatesOfProject",
   352  		Method:             "GET",
   353  		PathPattern:        "/projects/{project_name_or_id}/scanner/candidates",
   354  		ProducesMediaTypes: []string{"application/json"},
   355  		ConsumesMediaTypes: []string{"application/json"},
   356  		Schemes:            []string{"http", "https"},
   357  		Params:             params,
   358  		Reader:             &ListScannerCandidatesOfProjectReader{formats: a.formats},
   359  		AuthInfo:           a.authInfo,
   360  		Context:            ctx,
   361  		Client:             params.HTTPClient,
   362  	})
   363  	if err != nil {
   364  		return nil, err
   365  	}
   366  	return result.(*ListScannerCandidatesOfProjectOK), nil
   367  
   368  }
   369  
   370  /*
   371  SetScannerOfProject configures scanner for the specified project
   372  
   373  Set one of the system configured scanner registration as the indepndent scanner of the specified project.
   374  */
   375  func (a *Client) SetScannerOfProject(ctx context.Context, params *SetScannerOfProjectParams) (*SetScannerOfProjectOK, error) {
   376  
   377  	result, err := a.transport.Submit(&runtime.ClientOperation{
   378  		ID:                 "setScannerOfProject",
   379  		Method:             "PUT",
   380  		PathPattern:        "/projects/{project_name_or_id}/scanner",
   381  		ProducesMediaTypes: []string{"application/json"},
   382  		ConsumesMediaTypes: []string{"application/json"},
   383  		Schemes:            []string{"http", "https"},
   384  		Params:             params,
   385  		Reader:             &SetScannerOfProjectReader{formats: a.formats},
   386  		AuthInfo:           a.authInfo,
   387  		Context:            ctx,
   388  		Client:             params.HTTPClient,
   389  	})
   390  	if err != nil {
   391  		return nil, err
   392  	}
   393  	return result.(*SetScannerOfProjectOK), nil
   394  
   395  }
   396  
   397  /*
   398  UpdateProject updates properties for a selected project
   399  
   400  This endpoint is aimed to update the properties of a project.
   401  */
   402  func (a *Client) UpdateProject(ctx context.Context, params *UpdateProjectParams) (*UpdateProjectOK, error) {
   403  
   404  	result, err := a.transport.Submit(&runtime.ClientOperation{
   405  		ID:                 "updateProject",
   406  		Method:             "PUT",
   407  		PathPattern:        "/projects/{project_name_or_id}",
   408  		ProducesMediaTypes: []string{"application/json"},
   409  		ConsumesMediaTypes: []string{"application/json"},
   410  		Schemes:            []string{"http", "https"},
   411  		Params:             params,
   412  		Reader:             &UpdateProjectReader{formats: a.formats},
   413  		AuthInfo:           a.authInfo,
   414  		Context:            ctx,
   415  		Client:             params.HTTPClient,
   416  	})
   417  	if err != nil {
   418  		return nil, err
   419  	}
   420  	return result.(*UpdateProjectOK), nil
   421  
   422  }