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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package usergroup
     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 usergroup client
    19  type API interface {
    20  	/*
    21  	   CreateUserGroup creates user group
    22  
    23  	   Create user group information*/
    24  	CreateUserGroup(ctx context.Context, params *CreateUserGroupParams) (*CreateUserGroupCreated, error)
    25  	/*
    26  	   DeleteUserGroup deletes user group
    27  
    28  	   Delete user group*/
    29  	DeleteUserGroup(ctx context.Context, params *DeleteUserGroupParams) (*DeleteUserGroupOK, error)
    30  	/*
    31  	   GetUserGroup gets user group information
    32  
    33  	   Get user group information*/
    34  	GetUserGroup(ctx context.Context, params *GetUserGroupParams) (*GetUserGroupOK, error)
    35  	/*
    36  	   ListUserGroups gets all user groups information
    37  
    38  	   Get all user groups information, it is open for system admin*/
    39  	ListUserGroups(ctx context.Context, params *ListUserGroupsParams) (*ListUserGroupsOK, error)
    40  	/*
    41  	   SearchUserGroups searches groups by groupname
    42  
    43  	   This endpoint is to search groups by group name.  It's open for all authenticated requests.
    44  	*/
    45  	SearchUserGroups(ctx context.Context, params *SearchUserGroupsParams) (*SearchUserGroupsOK, error)
    46  	/*
    47  	   UpdateUserGroup updates group information
    48  
    49  	   Update user group information*/
    50  	UpdateUserGroup(ctx context.Context, params *UpdateUserGroupParams) (*UpdateUserGroupOK, error)
    51  }
    52  
    53  // New creates a new usergroup API client.
    54  func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
    55  	return &Client{
    56  		transport: transport,
    57  		formats:   formats,
    58  		authInfo:  authInfo,
    59  	}
    60  }
    61  
    62  /*
    63  Client for usergroup API
    64  */
    65  type Client struct {
    66  	transport runtime.ClientTransport
    67  	formats   strfmt.Registry
    68  	authInfo  runtime.ClientAuthInfoWriter
    69  }
    70  
    71  /*
    72  CreateUserGroup creates user group
    73  
    74  Create user group information
    75  */
    76  func (a *Client) CreateUserGroup(ctx context.Context, params *CreateUserGroupParams) (*CreateUserGroupCreated, error) {
    77  
    78  	result, err := a.transport.Submit(&runtime.ClientOperation{
    79  		ID:                 "createUserGroup",
    80  		Method:             "POST",
    81  		PathPattern:        "/usergroups",
    82  		ProducesMediaTypes: []string{"application/json"},
    83  		ConsumesMediaTypes: []string{"application/json"},
    84  		Schemes:            []string{"http", "https"},
    85  		Params:             params,
    86  		Reader:             &CreateUserGroupReader{formats: a.formats},
    87  		AuthInfo:           a.authInfo,
    88  		Context:            ctx,
    89  		Client:             params.HTTPClient,
    90  	})
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return result.(*CreateUserGroupCreated), nil
    95  
    96  }
    97  
    98  /*
    99  DeleteUserGroup deletes user group
   100  
   101  Delete user group
   102  */
   103  func (a *Client) DeleteUserGroup(ctx context.Context, params *DeleteUserGroupParams) (*DeleteUserGroupOK, error) {
   104  
   105  	result, err := a.transport.Submit(&runtime.ClientOperation{
   106  		ID:                 "deleteUserGroup",
   107  		Method:             "DELETE",
   108  		PathPattern:        "/usergroups/{group_id}",
   109  		ProducesMediaTypes: []string{"application/json"},
   110  		ConsumesMediaTypes: []string{"application/json"},
   111  		Schemes:            []string{"http", "https"},
   112  		Params:             params,
   113  		Reader:             &DeleteUserGroupReader{formats: a.formats},
   114  		AuthInfo:           a.authInfo,
   115  		Context:            ctx,
   116  		Client:             params.HTTPClient,
   117  	})
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	return result.(*DeleteUserGroupOK), nil
   122  
   123  }
   124  
   125  /*
   126  GetUserGroup gets user group information
   127  
   128  Get user group information
   129  */
   130  func (a *Client) GetUserGroup(ctx context.Context, params *GetUserGroupParams) (*GetUserGroupOK, error) {
   131  
   132  	result, err := a.transport.Submit(&runtime.ClientOperation{
   133  		ID:                 "getUserGroup",
   134  		Method:             "GET",
   135  		PathPattern:        "/usergroups/{group_id}",
   136  		ProducesMediaTypes: []string{"application/json"},
   137  		ConsumesMediaTypes: []string{"application/json"},
   138  		Schemes:            []string{"http", "https"},
   139  		Params:             params,
   140  		Reader:             &GetUserGroupReader{formats: a.formats},
   141  		AuthInfo:           a.authInfo,
   142  		Context:            ctx,
   143  		Client:             params.HTTPClient,
   144  	})
   145  	if err != nil {
   146  		return nil, err
   147  	}
   148  	return result.(*GetUserGroupOK), nil
   149  
   150  }
   151  
   152  /*
   153  ListUserGroups gets all user groups information
   154  
   155  Get all user groups information, it is open for system admin
   156  */
   157  func (a *Client) ListUserGroups(ctx context.Context, params *ListUserGroupsParams) (*ListUserGroupsOK, error) {
   158  
   159  	result, err := a.transport.Submit(&runtime.ClientOperation{
   160  		ID:                 "listUserGroups",
   161  		Method:             "GET",
   162  		PathPattern:        "/usergroups",
   163  		ProducesMediaTypes: []string{"application/json"},
   164  		ConsumesMediaTypes: []string{"application/json"},
   165  		Schemes:            []string{"http", "https"},
   166  		Params:             params,
   167  		Reader:             &ListUserGroupsReader{formats: a.formats},
   168  		AuthInfo:           a.authInfo,
   169  		Context:            ctx,
   170  		Client:             params.HTTPClient,
   171  	})
   172  	if err != nil {
   173  		return nil, err
   174  	}
   175  	return result.(*ListUserGroupsOK), nil
   176  
   177  }
   178  
   179  /*
   180  SearchUserGroups searches groups by groupname
   181  
   182  This endpoint is to search groups by group name.  It's open for all authenticated requests.
   183  */
   184  func (a *Client) SearchUserGroups(ctx context.Context, params *SearchUserGroupsParams) (*SearchUserGroupsOK, error) {
   185  
   186  	result, err := a.transport.Submit(&runtime.ClientOperation{
   187  		ID:                 "searchUserGroups",
   188  		Method:             "GET",
   189  		PathPattern:        "/usergroups/search",
   190  		ProducesMediaTypes: []string{"application/json"},
   191  		ConsumesMediaTypes: []string{"application/json"},
   192  		Schemes:            []string{"http", "https"},
   193  		Params:             params,
   194  		Reader:             &SearchUserGroupsReader{formats: a.formats},
   195  		AuthInfo:           a.authInfo,
   196  		Context:            ctx,
   197  		Client:             params.HTTPClient,
   198  	})
   199  	if err != nil {
   200  		return nil, err
   201  	}
   202  	return result.(*SearchUserGroupsOK), nil
   203  
   204  }
   205  
   206  /*
   207  UpdateUserGroup updates group information
   208  
   209  Update user group information
   210  */
   211  func (a *Client) UpdateUserGroup(ctx context.Context, params *UpdateUserGroupParams) (*UpdateUserGroupOK, error) {
   212  
   213  	result, err := a.transport.Submit(&runtime.ClientOperation{
   214  		ID:                 "updateUserGroup",
   215  		Method:             "PUT",
   216  		PathPattern:        "/usergroups/{group_id}",
   217  		ProducesMediaTypes: []string{"application/json"},
   218  		ConsumesMediaTypes: []string{"application/json"},
   219  		Schemes:            []string{"http", "https"},
   220  		Params:             params,
   221  		Reader:             &UpdateUserGroupReader{formats: a.formats},
   222  		AuthInfo:           a.authInfo,
   223  		Context:            ctx,
   224  		Client:             params.HTTPClient,
   225  	})
   226  	if err != nil {
   227  		return nil, err
   228  	}
   229  	return result.(*UpdateUserGroupOK), nil
   230  
   231  }