358 lines
15 KiB
Go
358 lines
15 KiB
Go
/*
|
|
Pulp 3 API
|
|
|
|
Fetch, Upload, Organize, and Distribute Software Packages
|
|
|
|
API version: v3
|
|
Contact: pulp-list@redhat.com
|
|
*/
|
|
|
|
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
|
|
|
package pulpclient
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"io"
|
|
"net/http"
|
|
"net/url"
|
|
"time"
|
|
"reflect"
|
|
)
|
|
|
|
|
|
// RemotesAPIService RemotesAPI service
|
|
type RemotesAPIService service
|
|
|
|
type RemotesAPIRemotesListRequest struct {
|
|
ctx context.Context
|
|
ApiService *RemotesAPIService
|
|
limit *int32
|
|
name *string
|
|
nameContains *string
|
|
nameIcontains *string
|
|
nameIn *[]string
|
|
nameStartswith *string
|
|
offset *int32
|
|
ordering *[]string
|
|
pulpHrefIn *[]string
|
|
pulpIdIn *[]string
|
|
pulpLabelSelect *string
|
|
pulpLastUpdated *time.Time
|
|
pulpLastUpdatedGt *time.Time
|
|
pulpLastUpdatedGte *time.Time
|
|
pulpLastUpdatedLt *time.Time
|
|
pulpLastUpdatedLte *time.Time
|
|
pulpLastUpdatedRange *[]time.Time
|
|
pulpTypeIn *[]string
|
|
fields *[]string
|
|
excludeFields *[]string
|
|
}
|
|
|
|
// Number of results to return per page.
|
|
func (r RemotesAPIRemotesListRequest) Limit(limit int32) RemotesAPIRemotesListRequest {
|
|
r.limit = &limit
|
|
return r
|
|
}
|
|
|
|
// Filter results where name matches value
|
|
func (r RemotesAPIRemotesListRequest) Name(name string) RemotesAPIRemotesListRequest {
|
|
r.name = &name
|
|
return r
|
|
}
|
|
|
|
// Filter results where name contains value
|
|
func (r RemotesAPIRemotesListRequest) NameContains(nameContains string) RemotesAPIRemotesListRequest {
|
|
r.nameContains = &nameContains
|
|
return r
|
|
}
|
|
|
|
// Filter results where name contains value
|
|
func (r RemotesAPIRemotesListRequest) NameIcontains(nameIcontains string) RemotesAPIRemotesListRequest {
|
|
r.nameIcontains = &nameIcontains
|
|
return r
|
|
}
|
|
|
|
// Filter results where name is in a comma-separated list of values
|
|
func (r RemotesAPIRemotesListRequest) NameIn(nameIn []string) RemotesAPIRemotesListRequest {
|
|
r.nameIn = &nameIn
|
|
return r
|
|
}
|
|
|
|
// Filter results where name starts with value
|
|
func (r RemotesAPIRemotesListRequest) NameStartswith(nameStartswith string) RemotesAPIRemotesListRequest {
|
|
r.nameStartswith = &nameStartswith
|
|
return r
|
|
}
|
|
|
|
// The initial index from which to return the results.
|
|
func (r RemotesAPIRemotesListRequest) Offset(offset int32) RemotesAPIRemotesListRequest {
|
|
r.offset = &offset
|
|
return r
|
|
}
|
|
|
|
// Ordering * `pulp_id` - Pulp id * `-pulp_id` - Pulp id (descending) * `pulp_created` - Pulp created * `-pulp_created` - Pulp created (descending) * `pulp_last_updated` - Pulp last updated * `-pulp_last_updated` - Pulp last updated (descending) * `pulp_type` - Pulp type * `-pulp_type` - Pulp type (descending) * `name` - Name * `-name` - Name (descending) * `pulp_labels` - Pulp labels * `-pulp_labels` - Pulp labels (descending) * `url` - Url * `-url` - Url (descending) * `ca_cert` - Ca cert * `-ca_cert` - Ca cert (descending) * `client_cert` - Client cert * `-client_cert` - Client cert (descending) * `client_key` - Client key * `-client_key` - Client key (descending) * `tls_validation` - Tls validation * `-tls_validation` - Tls validation (descending) * `username` - Username * `-username` - Username (descending) * `password` - Password * `-password` - Password (descending) * `proxy_url` - Proxy url * `-proxy_url` - Proxy url (descending) * `proxy_username` - Proxy username * `-proxy_username` - Proxy username (descending) * `proxy_password` - Proxy password * `-proxy_password` - Proxy password (descending) * `download_concurrency` - Download concurrency * `-download_concurrency` - Download concurrency (descending) * `max_retries` - Max retries * `-max_retries` - Max retries (descending) * `policy` - Policy * `-policy` - Policy (descending) * `total_timeout` - Total timeout * `-total_timeout` - Total timeout (descending) * `connect_timeout` - Connect timeout * `-connect_timeout` - Connect timeout (descending) * `sock_connect_timeout` - Sock connect timeout * `-sock_connect_timeout` - Sock connect timeout (descending) * `sock_read_timeout` - Sock read timeout * `-sock_read_timeout` - Sock read timeout (descending) * `headers` - Headers * `-headers` - Headers (descending) * `rate_limit` - Rate limit * `-rate_limit` - Rate limit (descending) * `pk` - Pk * `-pk` - Pk (descending)
|
|
func (r RemotesAPIRemotesListRequest) Ordering(ordering []string) RemotesAPIRemotesListRequest {
|
|
r.ordering = &ordering
|
|
return r
|
|
}
|
|
|
|
// Multiple values may be separated by commas.
|
|
func (r RemotesAPIRemotesListRequest) PulpHrefIn(pulpHrefIn []string) RemotesAPIRemotesListRequest {
|
|
r.pulpHrefIn = &pulpHrefIn
|
|
return r
|
|
}
|
|
|
|
// Multiple values may be separated by commas.
|
|
func (r RemotesAPIRemotesListRequest) PulpIdIn(pulpIdIn []string) RemotesAPIRemotesListRequest {
|
|
r.pulpIdIn = &pulpIdIn
|
|
return r
|
|
}
|
|
|
|
// Filter labels by search string
|
|
func (r RemotesAPIRemotesListRequest) PulpLabelSelect(pulpLabelSelect string) RemotesAPIRemotesListRequest {
|
|
r.pulpLabelSelect = &pulpLabelSelect
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated matches value
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdated(pulpLastUpdated time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdated = &pulpLastUpdated
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated is greater than value
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdatedGt(pulpLastUpdatedGt time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdatedGt = &pulpLastUpdatedGt
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated is greater than or equal to value
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdatedGte(pulpLastUpdatedGte time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdatedGte = &pulpLastUpdatedGte
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated is less than value
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdatedLt(pulpLastUpdatedLt time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdatedLt = &pulpLastUpdatedLt
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated is less than or equal to value
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdatedLte(pulpLastUpdatedLte time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdatedLte = &pulpLastUpdatedLte
|
|
return r
|
|
}
|
|
|
|
// Filter results where pulp_last_updated is between two comma separated values
|
|
func (r RemotesAPIRemotesListRequest) PulpLastUpdatedRange(pulpLastUpdatedRange []time.Time) RemotesAPIRemotesListRequest {
|
|
r.pulpLastUpdatedRange = &pulpLastUpdatedRange
|
|
return r
|
|
}
|
|
|
|
// Pulp type is in * `ansible.role` - ansible.role * `ansible.collection` - ansible.collection * `ansible.git` - ansible.git * `container.container` - container.container * `deb.apt-remote` - deb.apt-remote * `file.file` - file.file * `gem.gem` - gem.gem * `maven.maven` - maven.maven * `ostree.ostree` - ostree.ostree * `python.python` - python.python * `rpm.rpm` - rpm.rpm * `rpm.uln` - rpm.uln
|
|
func (r RemotesAPIRemotesListRequest) PulpTypeIn(pulpTypeIn []string) RemotesAPIRemotesListRequest {
|
|
r.pulpTypeIn = &pulpTypeIn
|
|
return r
|
|
}
|
|
|
|
// A list of fields to include in the response.
|
|
func (r RemotesAPIRemotesListRequest) Fields(fields []string) RemotesAPIRemotesListRequest {
|
|
r.fields = &fields
|
|
return r
|
|
}
|
|
|
|
// A list of fields to exclude from the response.
|
|
func (r RemotesAPIRemotesListRequest) ExcludeFields(excludeFields []string) RemotesAPIRemotesListRequest {
|
|
r.excludeFields = &excludeFields
|
|
return r
|
|
}
|
|
|
|
func (r RemotesAPIRemotesListRequest) Execute() (*PaginatedRemoteResponseList, *http.Response, error) {
|
|
return r.ApiService.RemotesListExecute(r)
|
|
}
|
|
|
|
/*
|
|
RemotesList List remotes
|
|
|
|
A customized named ModelViewSet that knows how to register itself with the Pulp API router.
|
|
|
|
This viewset is discoverable by its name.
|
|
"Normal" Django Models and Master/Detail models are supported by the ``register_with`` method.
|
|
|
|
Attributes:
|
|
lookup_field (str): The name of the field by which an object should be looked up, in
|
|
addition to any parent lookups if this ViewSet is nested. Defaults to 'pk'
|
|
endpoint_name (str): The name of the final path segment that should identify the ViewSet's
|
|
collection endpoint.
|
|
nest_prefix (str): Optional prefix under which this ViewSet should be nested. This must
|
|
correspond to the "parent_prefix" of a router with rest_framework_nested.NestedMixin.
|
|
None indicates this ViewSet should not be nested.
|
|
parent_lookup_kwargs (dict): Optional mapping of key names that would appear in self.kwargs
|
|
to django model filter expressions that can be used with the corresponding value from
|
|
self.kwargs, used only by a nested ViewSet to filter based on the parent object's
|
|
identity.
|
|
schema (DefaultSchema): The schema class to use by default in a viewset.
|
|
|
|
@param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
|
@return RemotesAPIRemotesListRequest
|
|
*/
|
|
func (a *RemotesAPIService) RemotesList(ctx context.Context) RemotesAPIRemotesListRequest {
|
|
return RemotesAPIRemotesListRequest{
|
|
ApiService: a,
|
|
ctx: ctx,
|
|
}
|
|
}
|
|
|
|
// Execute executes the request
|
|
// @return PaginatedRemoteResponseList
|
|
func (a *RemotesAPIService) RemotesListExecute(r RemotesAPIRemotesListRequest) (*PaginatedRemoteResponseList, *http.Response, error) {
|
|
var (
|
|
localVarHTTPMethod = http.MethodGet
|
|
localVarPostBody interface{}
|
|
formFiles []formFile
|
|
localVarReturnValue *PaginatedRemoteResponseList
|
|
)
|
|
|
|
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RemotesAPIService.RemotesList")
|
|
if err != nil {
|
|
return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}
|
|
}
|
|
|
|
localVarPath := localBasePath + "/pulp/api/v3/remotes/"
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
localVarQueryParams := url.Values{}
|
|
localVarFormParams := url.Values{}
|
|
|
|
if r.limit != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "limit", r.limit, "")
|
|
}
|
|
if r.name != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "name", r.name, "")
|
|
}
|
|
if r.nameContains != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "name__contains", r.nameContains, "")
|
|
}
|
|
if r.nameIcontains != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "name__icontains", r.nameIcontains, "")
|
|
}
|
|
if r.nameIn != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "name__in", r.nameIn, "csv")
|
|
}
|
|
if r.nameStartswith != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "name__startswith", r.nameStartswith, "")
|
|
}
|
|
if r.offset != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "offset", r.offset, "")
|
|
}
|
|
if r.ordering != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "ordering", r.ordering, "csv")
|
|
}
|
|
if r.pulpHrefIn != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_href__in", r.pulpHrefIn, "csv")
|
|
}
|
|
if r.pulpIdIn != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_id__in", r.pulpIdIn, "csv")
|
|
}
|
|
if r.pulpLabelSelect != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_label_select", r.pulpLabelSelect, "")
|
|
}
|
|
if r.pulpLastUpdated != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated", r.pulpLastUpdated, "")
|
|
}
|
|
if r.pulpLastUpdatedGt != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated__gt", r.pulpLastUpdatedGt, "")
|
|
}
|
|
if r.pulpLastUpdatedGte != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated__gte", r.pulpLastUpdatedGte, "")
|
|
}
|
|
if r.pulpLastUpdatedLt != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated__lt", r.pulpLastUpdatedLt, "")
|
|
}
|
|
if r.pulpLastUpdatedLte != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated__lte", r.pulpLastUpdatedLte, "")
|
|
}
|
|
if r.pulpLastUpdatedRange != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_last_updated__range", r.pulpLastUpdatedRange, "csv")
|
|
}
|
|
if r.pulpTypeIn != nil {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "pulp_type__in", r.pulpTypeIn, "csv")
|
|
}
|
|
if r.fields != nil {
|
|
t := *r.fields
|
|
if reflect.TypeOf(t).Kind() == reflect.Slice {
|
|
s := reflect.ValueOf(t)
|
|
for i := 0; i < s.Len(); i++ {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", s.Index(i), "multi")
|
|
}
|
|
} else {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "fields", t, "multi")
|
|
}
|
|
}
|
|
if r.excludeFields != nil {
|
|
t := *r.excludeFields
|
|
if reflect.TypeOf(t).Kind() == reflect.Slice {
|
|
s := reflect.ValueOf(t)
|
|
for i := 0; i < s.Len(); i++ {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_fields", s.Index(i), "multi")
|
|
}
|
|
} else {
|
|
parameterAddToHeaderOrQuery(localVarQueryParams, "exclude_fields", t, "multi")
|
|
}
|
|
}
|
|
// to determine the Content-Type header
|
|
localVarHTTPContentTypes := []string{}
|
|
|
|
// set Content-Type header
|
|
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
|
|
if localVarHTTPContentType != "" {
|
|
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
|
|
}
|
|
|
|
// to determine the Accept header
|
|
localVarHTTPHeaderAccepts := []string{"application/json"}
|
|
|
|
// set Accept header
|
|
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
|
|
if localVarHTTPHeaderAccept != "" {
|
|
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
|
|
}
|
|
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, formFiles)
|
|
if err != nil {
|
|
return localVarReturnValue, nil, err
|
|
}
|
|
|
|
localVarHTTPResponse, err := a.client.callAPI(req)
|
|
if err != nil || localVarHTTPResponse == nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
localVarBody, err := io.ReadAll(localVarHTTPResponse.Body)
|
|
localVarHTTPResponse.Body.Close()
|
|
localVarHTTPResponse.Body = io.NopCloser(bytes.NewBuffer(localVarBody))
|
|
if err != nil {
|
|
return localVarReturnValue, localVarHTTPResponse, err
|
|
}
|
|
|
|
if localVarHTTPResponse.StatusCode >= 300 {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: localVarHTTPResponse.Status,
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
|
|
if err != nil {
|
|
newErr := &GenericOpenAPIError{
|
|
body: localVarBody,
|
|
error: err.Error(),
|
|
}
|
|
return localVarReturnValue, localVarHTTPResponse, newErr
|
|
}
|
|
|
|
return localVarReturnValue, localVarHTTPResponse, nil
|
|
}
|