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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package quota
     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 quota client
    19  type API interface {
    20  	/*
    21  	   GetQuota gets the specified quota
    22  
    23  	   Get the specified quota*/
    24  	GetQuota(ctx context.Context, params *GetQuotaParams) (*GetQuotaOK, error)
    25  	/*
    26  	   ListQuotas lists quotas
    27  
    28  	   List quotas*/
    29  	ListQuotas(ctx context.Context, params *ListQuotasParams) (*ListQuotasOK, error)
    30  	/*
    31  	   UpdateQuota updates the specified quota
    32  
    33  	   Update hard limits of the specified quota*/
    34  	UpdateQuota(ctx context.Context, params *UpdateQuotaParams) (*UpdateQuotaOK, error)
    35  }
    36  
    37  // New creates a new quota API client.
    38  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    39  	return &Client{
    40  		transport: transport,
    41  		formats:   formats,
    42  		authInfo:  authInfo,
    43  	}
    44  }
    45  
    46  /*
    47  Client for quota API
    48  */
    49  type Client struct {
    50  	transport runtime.ClientTransport
    51  	formats   strfmt.Registry
    52  	authInfo  runtime.ClientAuthInfoWriter
    53  }
    54  
    55  /*
    56  GetQuota gets the specified quota
    57  
    58  Get the specified quota
    59  */
    60  func (a *Client) GetQuota(ctx context.Context, params *GetQuotaParams) (*GetQuotaOK, error) {
    61  
    62  	result, err := a.transport.Submit(&runtime.ClientOperation{
    63  		ID:                 "getQuota",
    64  		Method:             "GET",
    65  		PathPattern:        "/quotas/{id}",
    66  		ProducesMediaTypes: []string{"application/json"},
    67  		ConsumesMediaTypes: []string{"application/json"},
    68  		Schemes:            []string{"http", "https"},
    69  		Params:             params,
    70  		Reader:             &GetQuotaReader{formats: a.formats},
    71  		AuthInfo:           a.authInfo,
    72  		Context:            ctx,
    73  		Client:             params.HTTPClient,
    74  	})
    75  	if err != nil {
    76  		return nil, err
    77  	}
    78  	return result.(*GetQuotaOK), nil
    79  
    80  }
    81  
    82  /*
    83  ListQuotas lists quotas
    84  
    85  List quotas
    86  */
    87  func (a *Client) ListQuotas(ctx context.Context, params *ListQuotasParams) (*ListQuotasOK, error) {
    88  
    89  	result, err := a.transport.Submit(&runtime.ClientOperation{
    90  		ID:                 "listQuotas",
    91  		Method:             "GET",
    92  		PathPattern:        "/quotas",
    93  		ProducesMediaTypes: []string{"application/json"},
    94  		ConsumesMediaTypes: []string{"application/json"},
    95  		Schemes:            []string{"http", "https"},
    96  		Params:             params,
    97  		Reader:             &ListQuotasReader{formats: a.formats},
    98  		AuthInfo:           a.authInfo,
    99  		Context:            ctx,
   100  		Client:             params.HTTPClient,
   101  	})
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return result.(*ListQuotasOK), nil
   106  
   107  }
   108  
   109  /*
   110  UpdateQuota updates the specified quota
   111  
   112  Update hard limits of the specified quota
   113  */
   114  func (a *Client) UpdateQuota(ctx context.Context, params *UpdateQuotaParams) (*UpdateQuotaOK, error) {
   115  
   116  	result, err := a.transport.Submit(&runtime.ClientOperation{
   117  		ID:                 "updateQuota",
   118  		Method:             "PUT",
   119  		PathPattern:        "/quotas/{id}",
   120  		ProducesMediaTypes: []string{"application/json"},
   121  		ConsumesMediaTypes: []string{"application/json"},
   122  		Schemes:            []string{"http", "https"},
   123  		Params:             params,
   124  		Reader:             &UpdateQuotaReader{formats: a.formats},
   125  		AuthInfo:           a.authInfo,
   126  		Context:            ctx,
   127  		Client:             params.HTTPClient,
   128  	})
   129  	if err != nil {
   130  		return nil, err
   131  	}
   132  	return result.(*UpdateQuotaOK), nil
   133  
   134  }