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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package artifact
     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 artifact client
    19  type API interface {
    20  	/*
    21  	   CopyArtifact copies artifact
    22  
    23  	   Copy the artifact specified in the "from" parameter to the repository.*/
    24  	CopyArtifact(ctx context.Context, params *CopyArtifactParams) (*CopyArtifactCreated, error)
    25  	/*
    26  	   AddLabel adds label to artifact
    27  
    28  	   Add label to the specified artiact.*/
    29  	AddLabel(ctx context.Context, params *AddLabelParams) (*AddLabelOK, error)
    30  	/*
    31  	   CreateTag creates tag
    32  
    33  	   Create a tag for the specified artifact*/
    34  	CreateTag(ctx context.Context, params *CreateTagParams) (*CreateTagCreated, error)
    35  	/*
    36  	   DeleteArtifact deletes the specific artifact
    37  
    38  	   Delete the artifact specified by the reference under the project and repository. The reference can be digest or tag*/
    39  	DeleteArtifact(ctx context.Context, params *DeleteArtifactParams) (*DeleteArtifactOK, error)
    40  	/*
    41  	   DeleteTag deletes tag
    42  
    43  	   Delete the tag of the specified artifact*/
    44  	DeleteTag(ctx context.Context, params *DeleteTagParams) (*DeleteTagOK, error)
    45  	/*
    46  	   GetAddition gets the addition of the specific artifact
    47  
    48  	   Get the addition of the artifact specified by the reference under the project and repository.*/
    49  	GetAddition(ctx context.Context, params *GetAdditionParams) (*GetAdditionOK, error)
    50  	/*
    51  	   GetArtifact gets the specific artifact
    52  
    53  	   Get the artifact specified by the reference under the project and repository. The reference can be digest or tag.*/
    54  	GetArtifact(ctx context.Context, params *GetArtifactParams) (*GetArtifactOK, error)
    55  	/*
    56  	   GetVulnerabilitiesAddition gets the vulnerabilities addition of the specific artifact
    57  
    58  	   Get the vulnerabilities addition of the artifact specified by the reference under the project and repository.*/
    59  	GetVulnerabilitiesAddition(ctx context.Context, params *GetVulnerabilitiesAdditionParams) (*GetVulnerabilitiesAdditionOK, error)
    60  	/*
    61  	   ListAccessories lists accessories
    62  
    63  	   List accessories of the specific artifact*/
    64  	ListAccessories(ctx context.Context, params *ListAccessoriesParams) (*ListAccessoriesOK, error)
    65  	/*
    66  	   ListArtifacts lists artifacts
    67  
    68  	   List artifacts under the specific project and repository. Except the basic properties, the other supported queries in "q" includes "tags=*" to list only tagged artifacts, "tags=nil" to list only untagged artifacts, "tags=~v" to list artifacts whose tag fuzzy matches "v", "tags=v" to list artifact whose tag exactly matches "v", "labels=(id1, id2)" to list artifacts that both labels with id1 and id2 are added to*/
    69  	ListArtifacts(ctx context.Context, params *ListArtifactsParams) (*ListArtifactsOK, error)
    70  	/*
    71  	   ListTags lists tags
    72  
    73  	   List tags of the specific artifact*/
    74  	ListTags(ctx context.Context, params *ListTagsParams) (*ListTagsOK, error)
    75  	/*
    76  	   RemoveLabel removes label from artifact
    77  
    78  	   Remove the label from the specified artiact.*/
    79  	RemoveLabel(ctx context.Context, params *RemoveLabelParams) (*RemoveLabelOK, error)
    80  }
    81  
    82  // New creates a new artifact 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 artifact API
    93  */
    94  type Client struct {
    95  	transport runtime.ClientTransport
    96  	formats   strfmt.Registry
    97  	authInfo  runtime.ClientAuthInfoWriter
    98  }
    99  
   100  /*
   101  CopyArtifact copies artifact
   102  
   103  Copy the artifact specified in the "from" parameter to the repository.
   104  */
   105  func (a *Client) CopyArtifact(ctx context.Context, params *CopyArtifactParams) (*CopyArtifactCreated, error) {
   106  
   107  	result, err := a.transport.Submit(&runtime.ClientOperation{
   108  		ID:                 "CopyArtifact",
   109  		Method:             "POST",
   110  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts",
   111  		ProducesMediaTypes: []string{"application/json"},
   112  		ConsumesMediaTypes: []string{"application/json"},
   113  		Schemes:            []string{"http", "https"},
   114  		Params:             params,
   115  		Reader:             &CopyArtifactReader{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.(*CopyArtifactCreated), nil
   124  
   125  }
   126  
   127  /*
   128  AddLabel adds label to artifact
   129  
   130  Add label to the specified artiact.
   131  */
   132  func (a *Client) AddLabel(ctx context.Context, params *AddLabelParams) (*AddLabelOK, error) {
   133  
   134  	result, err := a.transport.Submit(&runtime.ClientOperation{
   135  		ID:                 "addLabel",
   136  		Method:             "POST",
   137  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels",
   138  		ProducesMediaTypes: []string{"application/json"},
   139  		ConsumesMediaTypes: []string{"application/json"},
   140  		Schemes:            []string{"http", "https"},
   141  		Params:             params,
   142  		Reader:             &AddLabelReader{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.(*AddLabelOK), nil
   151  
   152  }
   153  
   154  /*
   155  CreateTag creates tag
   156  
   157  Create a tag for the specified artifact
   158  */
   159  func (a *Client) CreateTag(ctx context.Context, params *CreateTagParams) (*CreateTagCreated, error) {
   160  
   161  	result, err := a.transport.Submit(&runtime.ClientOperation{
   162  		ID:                 "createTag",
   163  		Method:             "POST",
   164  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags",
   165  		ProducesMediaTypes: []string{"application/json"},
   166  		ConsumesMediaTypes: []string{"application/json"},
   167  		Schemes:            []string{"http", "https"},
   168  		Params:             params,
   169  		Reader:             &CreateTagReader{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.(*CreateTagCreated), nil
   178  
   179  }
   180  
   181  /*
   182  DeleteArtifact deletes the specific artifact
   183  
   184  Delete the artifact specified by the reference under the project and repository. The reference can be digest or tag
   185  */
   186  func (a *Client) DeleteArtifact(ctx context.Context, params *DeleteArtifactParams) (*DeleteArtifactOK, error) {
   187  
   188  	result, err := a.transport.Submit(&runtime.ClientOperation{
   189  		ID:                 "deleteArtifact",
   190  		Method:             "DELETE",
   191  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}",
   192  		ProducesMediaTypes: []string{"application/json"},
   193  		ConsumesMediaTypes: []string{"application/json"},
   194  		Schemes:            []string{"http", "https"},
   195  		Params:             params,
   196  		Reader:             &DeleteArtifactReader{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.(*DeleteArtifactOK), nil
   205  
   206  }
   207  
   208  /*
   209  DeleteTag deletes tag
   210  
   211  Delete the tag of the specified artifact
   212  */
   213  func (a *Client) DeleteTag(ctx context.Context, params *DeleteTagParams) (*DeleteTagOK, error) {
   214  
   215  	result, err := a.transport.Submit(&runtime.ClientOperation{
   216  		ID:                 "deleteTag",
   217  		Method:             "DELETE",
   218  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags/{tag_name}",
   219  		ProducesMediaTypes: []string{"application/json"},
   220  		ConsumesMediaTypes: []string{"application/json"},
   221  		Schemes:            []string{"http", "https"},
   222  		Params:             params,
   223  		Reader:             &DeleteTagReader{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.(*DeleteTagOK), nil
   232  
   233  }
   234  
   235  /*
   236  GetAddition gets the addition of the specific artifact
   237  
   238  Get the addition of the artifact specified by the reference under the project and repository.
   239  */
   240  func (a *Client) GetAddition(ctx context.Context, params *GetAdditionParams) (*GetAdditionOK, error) {
   241  
   242  	result, err := a.transport.Submit(&runtime.ClientOperation{
   243  		ID:                 "getAddition",
   244  		Method:             "GET",
   245  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/{addition}",
   246  		ProducesMediaTypes: []string{"application/json"},
   247  		ConsumesMediaTypes: []string{"application/json"},
   248  		Schemes:            []string{"http", "https"},
   249  		Params:             params,
   250  		Reader:             &GetAdditionReader{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.(*GetAdditionOK), nil
   259  
   260  }
   261  
   262  /*
   263  GetArtifact gets the specific artifact
   264  
   265  Get the artifact specified by the reference under the project and repository. The reference can be digest or tag.
   266  */
   267  func (a *Client) GetArtifact(ctx context.Context, params *GetArtifactParams) (*GetArtifactOK, error) {
   268  
   269  	result, err := a.transport.Submit(&runtime.ClientOperation{
   270  		ID:                 "getArtifact",
   271  		Method:             "GET",
   272  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}",
   273  		ProducesMediaTypes: []string{"application/json"},
   274  		ConsumesMediaTypes: []string{"application/json"},
   275  		Schemes:            []string{"http", "https"},
   276  		Params:             params,
   277  		Reader:             &GetArtifactReader{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.(*GetArtifactOK), nil
   286  
   287  }
   288  
   289  /*
   290  GetVulnerabilitiesAddition gets the vulnerabilities addition of the specific artifact
   291  
   292  Get the vulnerabilities addition of the artifact specified by the reference under the project and repository.
   293  */
   294  func (a *Client) GetVulnerabilitiesAddition(ctx context.Context, params *GetVulnerabilitiesAdditionParams) (*GetVulnerabilitiesAdditionOK, error) {
   295  
   296  	result, err := a.transport.Submit(&runtime.ClientOperation{
   297  		ID:                 "getVulnerabilitiesAddition",
   298  		Method:             "GET",
   299  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/additions/vulnerabilities",
   300  		ProducesMediaTypes: []string{"application/json"},
   301  		ConsumesMediaTypes: []string{"application/json"},
   302  		Schemes:            []string{"http", "https"},
   303  		Params:             params,
   304  		Reader:             &GetVulnerabilitiesAdditionReader{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.(*GetVulnerabilitiesAdditionOK), nil
   313  
   314  }
   315  
   316  /*
   317  ListAccessories lists accessories
   318  
   319  List accessories of the specific artifact
   320  */
   321  func (a *Client) ListAccessories(ctx context.Context, params *ListAccessoriesParams) (*ListAccessoriesOK, error) {
   322  
   323  	result, err := a.transport.Submit(&runtime.ClientOperation{
   324  		ID:                 "listAccessories",
   325  		Method:             "GET",
   326  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/accessories",
   327  		ProducesMediaTypes: []string{"application/json"},
   328  		ConsumesMediaTypes: []string{"application/json"},
   329  		Schemes:            []string{"http", "https"},
   330  		Params:             params,
   331  		Reader:             &ListAccessoriesReader{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.(*ListAccessoriesOK), nil
   340  
   341  }
   342  
   343  /*
   344  ListArtifacts lists artifacts
   345  
   346  List artifacts under the specific project and repository. Except the basic properties, the other supported queries in "q" includes "tags=*" to list only tagged artifacts, "tags=nil" to list only untagged artifacts, "tags=~v" to list artifacts whose tag fuzzy matches "v", "tags=v" to list artifact whose tag exactly matches "v", "labels=(id1, id2)" to list artifacts that both labels with id1 and id2 are added to
   347  */
   348  func (a *Client) ListArtifacts(ctx context.Context, params *ListArtifactsParams) (*ListArtifactsOK, error) {
   349  
   350  	result, err := a.transport.Submit(&runtime.ClientOperation{
   351  		ID:                 "listArtifacts",
   352  		Method:             "GET",
   353  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts",
   354  		ProducesMediaTypes: []string{"application/json"},
   355  		ConsumesMediaTypes: []string{"application/json"},
   356  		Schemes:            []string{"http", "https"},
   357  		Params:             params,
   358  		Reader:             &ListArtifactsReader{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.(*ListArtifactsOK), nil
   367  
   368  }
   369  
   370  /*
   371  ListTags lists tags
   372  
   373  List tags of the specific artifact
   374  */
   375  func (a *Client) ListTags(ctx context.Context, params *ListTagsParams) (*ListTagsOK, error) {
   376  
   377  	result, err := a.transport.Submit(&runtime.ClientOperation{
   378  		ID:                 "listTags",
   379  		Method:             "GET",
   380  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/tags",
   381  		ProducesMediaTypes: []string{"application/json"},
   382  		ConsumesMediaTypes: []string{"application/json"},
   383  		Schemes:            []string{"http", "https"},
   384  		Params:             params,
   385  		Reader:             &ListTagsReader{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.(*ListTagsOK), nil
   394  
   395  }
   396  
   397  /*
   398  RemoveLabel removes label from artifact
   399  
   400  Remove the label from the specified artiact.
   401  */
   402  func (a *Client) RemoveLabel(ctx context.Context, params *RemoveLabelParams) (*RemoveLabelOK, error) {
   403  
   404  	result, err := a.transport.Submit(&runtime.ClientOperation{
   405  		ID:                 "removeLabel",
   406  		Method:             "DELETE",
   407  		PathPattern:        "/projects/{project_name}/repositories/{repository_name}/artifacts/{reference}/labels/{label_id}",
   408  		ProducesMediaTypes: []string{"application/json"},
   409  		ConsumesMediaTypes: []string{"application/json"},
   410  		Schemes:            []string{"http", "https"},
   411  		Params:             params,
   412  		Reader:             &RemoveLabelReader{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.(*RemoveLabelOK), nil
   421  
   422  }