diff --git a/CHANGELOG.md b/CHANGELOG.md index 6210018f..4771b1db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,20 @@ ## [unreleased] ### Features +- [#353](https://github.com/influxdata/influxdb-client-go/pull/353) Simplify generated code. +- [#353](https://github.com/influxdata/influxdb-client-go/pull/353) Regenerate code from swagger. - [#355](https://github.com/influxdata/influxdb-client-go/pull/355) Upgrade of lib gopkg.in/yaml from v2 to v3 ### Bug fixes - [#354](https://github.com/influxdata/influxdb-client-go/pull/354) More efficient synchronization in WriteAPIBlocking. +### Breaking change +- [#353](https://github.com/influxdata/influxdb-client-go/pull/353): + - Interface `Client` has been extended with `APIClient()` function. + - The generated client API changed: + - Function names are simplified (was `PostDBRPWithResponse`, now `PostDBRP`) + - All functions now accept a context and a single wrapper structure with request body and HTTP parameters + - The functions return deserialized response body or an error (it was a response wrapper with a status code that had to be then validated) + ## 2.10.0 [2022-08-25] ### Features - [#348](https://github.com/influxdata/influxdb-client-go/pull/348) Added `write.Options.Consitency` parameter to support InfluxDB Enterprise. diff --git a/api/authorizations.go b/api/authorizations.go index 692659fc..70c0caf1 100644 --- a/api/authorizations.go +++ b/api/authorizations.go @@ -38,11 +38,11 @@ type AuthorizationsAPI interface { // authorizationsAPI implements AuthorizationsAPI type authorizationsAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewAuthorizationsAPI creates new instance of AuthorizationsAPI -func NewAuthorizationsAPI(apiClient *domain.ClientWithResponses) AuthorizationsAPI { +func NewAuthorizationsAPI(apiClient *domain.Client) AuthorizationsAPI { return &authorizationsAPI{ apiClient: apiClient, } @@ -74,35 +74,23 @@ func (a *authorizationsAPI) FindAuthorizationsByOrgID(ctx context.Context, orgID } func (a *authorizationsAPI) listAuthorizations(ctx context.Context, query *domain.GetAuthorizationsParams) (*[]domain.Authorization, error) { - response, err := a.apiClient.GetAuthorizationsWithResponse(ctx, query) + response, err := a.apiClient.GetAuthorizations(ctx, query) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Authorizations, nil + return response.Authorizations, nil } func (a *authorizationsAPI) CreateAuthorization(ctx context.Context, authorization *domain.Authorization) (*domain.Authorization, error) { - params := &domain.PostAuthorizationsParams{} - req := domain.PostAuthorizationsJSONRequestBody{ - AuthorizationUpdateRequest: authorization.AuthorizationUpdateRequest, - OrgID: authorization.OrgID, - Permissions: authorization.Permissions, - UserID: authorization.UserID, - } - response, err := a.apiClient.PostAuthorizationsWithResponse(ctx, params, req) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON400 != nil { - return nil, domain.ErrorToHTTPError(response.JSON400, response.StatusCode()) + params := &domain.PostAuthorizationsAllParams{ + Body: domain.PostAuthorizationsJSONRequestBody{ + AuthorizationUpdateRequest: authorization.AuthorizationUpdateRequest, + OrgID: authorization.OrgID, + Permissions: authorization.Permissions, + UserID: authorization.UserID, + }, } - return response.JSON201, nil + return a.apiClient.PostAuthorizations(ctx, params) } func (a *authorizationsAPI) CreateAuthorizationWithOrgID(ctx context.Context, orgID string, permissions []domain.Permission) (*domain.Authorization, error) { @@ -116,16 +104,11 @@ func (a *authorizationsAPI) CreateAuthorizationWithOrgID(ctx context.Context, or } func (a *authorizationsAPI) UpdateAuthorizationStatusWithID(ctx context.Context, authID string, status domain.AuthorizationUpdateRequestStatus) (*domain.Authorization, error) { - params := &domain.PatchAuthorizationsIDParams{} - body := &domain.PatchAuthorizationsIDJSONRequestBody{Status: &status} - response, err := a.apiClient.PatchAuthorizationsIDWithResponse(ctx, authID, params, *body) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PatchAuthorizationsIDAllParams{ + Body: domain.PatchAuthorizationsIDJSONRequestBody{Status: &status}, + AuthID: authID, } - return response.JSON200, nil + return a.apiClient.PatchAuthorizationsID(ctx, params) } func (a *authorizationsAPI) UpdateAuthorizationStatus(ctx context.Context, authorization *domain.Authorization, status domain.AuthorizationUpdateRequestStatus) (*domain.Authorization, error) { @@ -137,13 +120,8 @@ func (a *authorizationsAPI) DeleteAuthorization(ctx context.Context, authorizati } func (a *authorizationsAPI) DeleteAuthorizationWithID(ctx context.Context, authID string) error { - params := &domain.DeleteAuthorizationsIDParams{} - response, err := a.apiClient.DeleteAuthorizationsIDWithResponse(ctx, authID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteAuthorizationsIDAllParams{ + AuthID: authID, } - return nil + return a.apiClient.DeleteAuthorizationsID(ctx, params) } diff --git a/api/buckets.go b/api/buckets.go index 1befc37d..4fb09484 100644 --- a/api/buckets.go +++ b/api/buckets.go @@ -64,11 +64,11 @@ type BucketsAPI interface { // bucketsAPI implements BucketsAPI type bucketsAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewBucketsAPI creates new instance of BucketsAPI -func NewBucketsAPI(apiClient *domain.ClientWithResponses) BucketsAPI { +func NewBucketsAPI(apiClient *domain.Client) BucketsAPI { return &bucketsAPI{ apiClient: apiClient, } @@ -91,41 +91,30 @@ func (b *bucketsAPI) getBuckets(ctx context.Context, params *domain.GetBucketsPa } params.Offset = &options.offset - response, err := b.apiClient.GetBucketsWithResponse(ctx, params) + response, err := b.apiClient.GetBuckets(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Buckets, nil + return response.Buckets, nil } func (b *bucketsAPI) FindBucketByName(ctx context.Context, bucketName string) (*domain.Bucket, error) { params := &domain.GetBucketsParams{Name: &bucketName} - response, err := b.apiClient.GetBucketsWithResponse(ctx, params) + response, err := b.apiClient.GetBuckets(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Buckets != nil && len(*response.JSON200.Buckets) > 0 { - return &(*response.JSON200.Buckets)[0], nil + if response.Buckets != nil && len(*response.Buckets) > 0 { + return &(*response.Buckets)[0], nil } return nil, fmt.Errorf("bucket '%s' not found", bucketName) } func (b *bucketsAPI) FindBucketByID(ctx context.Context, bucketID string) (*domain.Bucket, error) { - params := &domain.GetBucketsIDParams{} - response, err := b.apiClient.GetBucketsIDWithResponse(ctx, bucketID, params) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.GetBucketsIDAllParams{ + BucketID: bucketID, } - return response.JSON200, nil + return b.apiClient.GetBucketsID(ctx, params) } func (b *bucketsAPI) FindBucketsByOrgID(ctx context.Context, orgID string, pagingOptions ...PagingOption) (*[]domain.Bucket, error) { @@ -139,18 +128,10 @@ func (b *bucketsAPI) FindBucketsByOrgName(ctx context.Context, orgName string, p } func (b *bucketsAPI) createBucket(ctx context.Context, bucketReq *domain.PostBucketRequest) (*domain.Bucket, error) { - params := &domain.PostBucketsParams{} - response, err := b.apiClient.PostBucketsWithResponse(ctx, params, domain.PostBucketsJSONRequestBody(*bucketReq)) - if err != nil { - return nil, err - } - if response.JSON422 != nil { - return nil, domain.ErrorToHTTPError(response.JSON422, response.StatusCode()) - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostBucketsAllParams{ + Body: domain.PostBucketsJSONRequestBody(*bucketReq), } - return response.JSON201, nil + return b.apiClient.PostBuckets(ctx, params) } func (b *bucketsAPI) CreateBucket(ctx context.Context, bucket *domain.Bucket) (*domain.Bucket, error) { @@ -158,14 +139,15 @@ func (b *bucketsAPI) CreateBucket(ctx context.Context, bucket *domain.Bucket) (* Description: bucket.Description, Name: bucket.Name, OrgID: *bucket.OrgID, - RetentionRules: bucket.RetentionRules, + RetentionRules: &bucket.RetentionRules, Rp: bucket.Rp, } return b.createBucket(ctx, bucketReq) } func (b *bucketsAPI) CreateBucketWithNameWithID(ctx context.Context, orgID, bucketName string, rules ...domain.RetentionRule) (*domain.Bucket, error) { - bucket := &domain.PostBucketRequest{Name: bucketName, OrgID: orgID, RetentionRules: rules} + rs := domain.RetentionRules(rules) + bucket := &domain.PostBucketRequest{Name: bucketName, OrgID: orgID, RetentionRules: &rs} return b.createBucket(ctx, bucket) } func (b *bucketsAPI) CreateBucketWithName(ctx context.Context, org *domain.Organization, bucketName string, rules ...domain.RetentionRule) (*domain.Bucket, error) { @@ -177,35 +159,22 @@ func (b *bucketsAPI) DeleteBucket(ctx context.Context, bucket *domain.Bucket) er } func (b *bucketsAPI) DeleteBucketWithID(ctx context.Context, bucketID string) error { - params := &domain.DeleteBucketsIDParams{} - response, err := b.apiClient.DeleteBucketsIDWithResponse(ctx, bucketID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteBucketsIDAllParams{ + BucketID: bucketID, } - if response.JSON404 != nil { - return domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - return nil + return b.apiClient.DeleteBucketsID(ctx, params) } func (b *bucketsAPI) UpdateBucket(ctx context.Context, bucket *domain.Bucket) (*domain.Bucket, error) { - params := &domain.PatchBucketsIDParams{} - req := domain.PatchBucketsIDJSONRequestBody{ - Description: bucket.Description, - Name: &bucket.Name, - RetentionRules: retentionRulesToPatchRetentionRules(&bucket.RetentionRules), - } - response, err := b.apiClient.PatchBucketsIDWithResponse(ctx, *bucket.Id, params, req) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200, nil + params := &domain.PatchBucketsIDAllParams{ + Body: domain.PatchBucketsIDJSONRequestBody{ + Description: bucket.Description, + Name: &bucket.Name, + RetentionRules: retentionRulesToPatchRetentionRules(&bucket.RetentionRules), + }, + BucketID: *bucket.Id, + } + return b.apiClient.PatchBucketsID(ctx, params) } func (b *bucketsAPI) GetMembers(ctx context.Context, bucket *domain.Bucket) (*[]domain.ResourceMember, error) { @@ -213,15 +182,14 @@ func (b *bucketsAPI) GetMembers(ctx context.Context, bucket *domain.Bucket) (*[] } func (b *bucketsAPI) GetMembersWithID(ctx context.Context, bucketID string) (*[]domain.ResourceMember, error) { - params := &domain.GetBucketsIDMembersParams{} - response, err := b.apiClient.GetBucketsIDMembersWithResponse(ctx, bucketID, params) + params := &domain.GetBucketsIDMembersAllParams{ + BucketID: bucketID, + } + response, err := b.apiClient.GetBucketsIDMembers(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Users, nil + return response.Users, nil } func (b *bucketsAPI) AddMember(ctx context.Context, bucket *domain.Bucket, user *domain.User) (*domain.ResourceMember, error) { @@ -229,16 +197,11 @@ func (b *bucketsAPI) AddMember(ctx context.Context, bucket *domain.Bucket, user } func (b *bucketsAPI) AddMemberWithID(ctx context.Context, bucketID, memberID string) (*domain.ResourceMember, error) { - params := &domain.PostBucketsIDMembersParams{} - body := &domain.PostBucketsIDMembersJSONRequestBody{Id: memberID} - response, err := b.apiClient.PostBucketsIDMembersWithResponse(ctx, bucketID, params, *body) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostBucketsIDMembersAllParams{ + BucketID: bucketID, + Body: domain.PostBucketsIDMembersJSONRequestBody{Id: memberID}, } - return response.JSON201, nil + return b.apiClient.PostBucketsIDMembers(ctx, params) } func (b *bucketsAPI) RemoveMember(ctx context.Context, bucket *domain.Bucket, user *domain.User) error { @@ -246,15 +209,11 @@ func (b *bucketsAPI) RemoveMember(ctx context.Context, bucket *domain.Bucket, us } func (b *bucketsAPI) RemoveMemberWithID(ctx context.Context, bucketID, memberID string) error { - params := &domain.DeleteBucketsIDMembersIDParams{} - response, err := b.apiClient.DeleteBucketsIDMembersIDWithResponse(ctx, bucketID, memberID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteBucketsIDMembersIDAllParams{ + BucketID: bucketID, + UserID: memberID, } - return nil + return b.apiClient.DeleteBucketsIDMembersID(ctx, params) } func (b *bucketsAPI) GetOwners(ctx context.Context, bucket *domain.Bucket) (*[]domain.ResourceOwner, error) { @@ -262,15 +221,14 @@ func (b *bucketsAPI) GetOwners(ctx context.Context, bucket *domain.Bucket) (*[]d } func (b *bucketsAPI) GetOwnersWithID(ctx context.Context, bucketID string) (*[]domain.ResourceOwner, error) { - params := &domain.GetBucketsIDOwnersParams{} - response, err := b.apiClient.GetBucketsIDOwnersWithResponse(ctx, bucketID, params) + params := &domain.GetBucketsIDOwnersAllParams{ + BucketID: bucketID, + } + response, err := b.apiClient.GetBucketsIDOwners(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Users, nil + return response.Users, nil } func (b *bucketsAPI) AddOwner(ctx context.Context, bucket *domain.Bucket, user *domain.User) (*domain.ResourceOwner, error) { @@ -278,16 +236,11 @@ func (b *bucketsAPI) AddOwner(ctx context.Context, bucket *domain.Bucket, user * } func (b *bucketsAPI) AddOwnerWithID(ctx context.Context, bucketID, memberID string) (*domain.ResourceOwner, error) { - params := &domain.PostBucketsIDOwnersParams{} - body := &domain.PostBucketsIDOwnersJSONRequestBody{Id: memberID} - response, err := b.apiClient.PostBucketsIDOwnersWithResponse(ctx, bucketID, params, *body) - if err != nil { - return nil, err + params := &domain.PostBucketsIDOwnersAllParams{ + BucketID: bucketID, + Body: domain.PostBucketsIDOwnersJSONRequestBody{Id: memberID}, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201, nil + return b.apiClient.PostBucketsIDOwners(ctx, params) } func (b *bucketsAPI) RemoveOwner(ctx context.Context, bucket *domain.Bucket, user *domain.User) error { @@ -295,15 +248,11 @@ func (b *bucketsAPI) RemoveOwner(ctx context.Context, bucket *domain.Bucket, use } func (b *bucketsAPI) RemoveOwnerWithID(ctx context.Context, bucketID, memberID string) error { - params := &domain.DeleteBucketsIDOwnersIDParams{} - response, err := b.apiClient.DeleteBucketsIDOwnersIDWithResponse(ctx, bucketID, memberID, params) - if err != nil { - return err + params := &domain.DeleteBucketsIDOwnersIDAllParams{ + BucketID: bucketID, + UserID: memberID, } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return b.apiClient.DeleteBucketsIDOwnersID(ctx, params) } func retentionRulesToPatchRetentionRules(rrs *domain.RetentionRules) *domain.PatchRetentionRules { @@ -313,9 +262,12 @@ func retentionRulesToPatchRetentionRules(rrs *domain.RetentionRules) *domain.Pat prrs := make([]domain.PatchRetentionRule, len(*rrs)) for i, rr := range *rrs { prrs[i] = domain.PatchRetentionRule{ - EverySeconds: &rr.EverySeconds, + EverySeconds: rr.EverySeconds, ShardGroupDurationSeconds: rr.ShardGroupDurationSeconds, - Type: domain.PatchRetentionRuleType(rr.Type), + } + if rr.Type != nil { + rrt := domain.PatchRetentionRuleType(*rr.Type) + prrs[i].Type = &rrt } } dprrs := domain.PatchRetentionRules(prrs) diff --git a/api/buckets_e2e_test.go b/api/buckets_e2e_test.go index adc6936b..1b3916d0 100644 --- a/api/buckets_e2e_test.go +++ b/api/buckets_e2e_test.go @@ -1,3 +1,4 @@ +//go:build e2e // +build e2e // Copyright 2020-2021 InfluxData, Inc. All rights reserved. diff --git a/api/delete.go b/api/delete.go index f40b5717..820ad86c 100644 --- a/api/delete.go +++ b/api/delete.go @@ -16,44 +16,32 @@ import ( // Empty predicate string means all data from the given time range will be deleted. See https://v2.docs.influxdata.com/v2.0/reference/syntax/delete-predicate/ // for more info about predicate syntax. type DeleteAPI interface { - // Delete deletes series selected by by the time range specified by start and stop arguments and optional predicate string from the bucket bucket belonging to the organization org. + // Delete deletes series selected by the time range specified by start and stop arguments and optional predicate string from the bucket bucket belonging to the organization org. Delete(ctx context.Context, org *domain.Organization, bucket *domain.Bucket, start, stop time.Time, predicate string) error - // Delete deletes series selected by by the time range specified by start and stop arguments and optional predicate string from the bucket with ID bucketID belonging to the organization with ID orgID. + // DeleteWithID deletes series selected by the time range specified by start and stop arguments and optional predicate string from the bucket with ID bucketID belonging to the organization with ID orgID. DeleteWithID(ctx context.Context, orgID, bucketID string, start, stop time.Time, predicate string) error - // Delete deletes series selected by by the time range specified by start and stop arguments and optional predicate string from the bucket with name bucketName belonging to the organization with name orgName. + // DeleteWithName deletes series selected by the time range specified by start and stop arguments and optional predicate string from the bucket with name bucketName belonging to the organization with name orgName. DeleteWithName(ctx context.Context, orgName, bucketName string, start, stop time.Time, predicate string) error } // deleteAPI implements DeleteAPI type deleteAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewDeleteAPI creates new instance of DeleteAPI -func NewDeleteAPI(apiClient *domain.ClientWithResponses) DeleteAPI { +func NewDeleteAPI(apiClient *domain.Client) DeleteAPI { return &deleteAPI{ apiClient: apiClient, } } func (d *deleteAPI) delete(ctx context.Context, params *domain.PostDeleteParams, conditions *domain.DeletePredicateRequest) error { - resp, err := d.apiClient.PostDeleteWithResponse(ctx, params, domain.PostDeleteJSONRequestBody(*conditions)) - if err != nil { - return err + allParams := &domain.PostDeleteAllParams{ + PostDeleteParams: *params, + Body: domain.PostDeleteJSONRequestBody(*conditions), } - if resp.JSON404 != nil { - return domain.ErrorToHTTPError(resp.JSON404, resp.StatusCode()) - } - if resp.JSON403 != nil { - return domain.ErrorToHTTPError(resp.JSON403, resp.StatusCode()) - } - if resp.JSON400 != nil { - return domain.ErrorToHTTPError(resp.JSON400, resp.StatusCode()) - } - if resp.JSONDefault != nil { - return domain.ErrorToHTTPError(resp.JSONDefault, resp.StatusCode()) - } - return nil + return d.apiClient.PostDelete(ctx, allParams) } func (d *deleteAPI) Delete(ctx context.Context, org *domain.Organization, bucket *domain.Bucket, start, stop time.Time, predicate string) error { diff --git a/api/labels.go b/api/labels.go index ee577481..ce0f8245 100644 --- a/api/labels.go +++ b/api/labels.go @@ -28,7 +28,7 @@ type LabelsAPI interface { // CreateLabelWithName creates a new label with label labelName and properties, under the organization org. // Properties example: {"color": "ffb3b3", "description": "this is a description"}. CreateLabelWithName(ctx context.Context, org *domain.Organization, labelName string, properties map[string]string) (*domain.Label, error) - // CreateLabelWithName creates a new label with label labelName and properties, under the organization with id orgID. + // CreateLabelWithNameWithID creates a new label with label labelName and properties, under the organization with id orgID. // Properties example: {"color": "ffb3b3", "description": "this is a description"}. CreateLabelWithNameWithID(ctx context.Context, orgID, labelName string, properties map[string]string) (*domain.Label, error) // UpdateLabel updates the label. @@ -42,11 +42,11 @@ type LabelsAPI interface { // labelsAPI implements LabelsAPI type labelsAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewLabelsAPI creates new instance of LabelsAPI -func NewLabelsAPI(apiClient *domain.ClientWithResponses) LabelsAPI { +func NewLabelsAPI(apiClient *domain.Client) LabelsAPI { return &labelsAPI{ apiClient: apiClient, } @@ -58,14 +58,11 @@ func (u *labelsAPI) GetLabels(ctx context.Context) (*[]domain.Label, error) { } func (u *labelsAPI) getLabels(ctx context.Context, params *domain.GetLabelsParams) (*[]domain.Label, error) { - response, err := u.apiClient.GetLabelsWithResponse(ctx, params) + response, err := u.apiClient.GetLabels(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return (*[]domain.Label)(response.JSON200.Labels), nil + return (*[]domain.Label)(response.Labels), nil } func (u *labelsAPI) FindLabelsByOrg(ctx context.Context, org *domain.Organization) (*[]domain.Label, error) { @@ -78,15 +75,14 @@ func (u *labelsAPI) FindLabelsByOrgID(ctx context.Context, orgID string) (*[]dom } func (u *labelsAPI) FindLabelByID(ctx context.Context, labelID string) (*domain.Label, error) { - params := &domain.GetLabelsIDParams{} - response, err := u.apiClient.GetLabelsIDWithResponse(ctx, labelID, params) + params := &domain.GetLabelsIDAllParams{ + LabelID: labelID, + } + response, err := u.apiClient.GetLabelsID(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Label, nil + return response.Label, nil } func (u *labelsAPI) FindLabelByName(ctx context.Context, orgID, labelName string) (*domain.Label, error) { @@ -118,37 +114,33 @@ func (u *labelsAPI) CreateLabelWithNameWithID(ctx context.Context, orgID, labelN } func (u *labelsAPI) CreateLabel(ctx context.Context, label *domain.LabelCreateRequest) (*domain.Label, error) { - response, err := u.apiClient.PostLabelsWithResponse(ctx, domain.PostLabelsJSONRequestBody(*label)) + params := &domain.PostLabelsAllParams{ + Body: domain.PostLabelsJSONRequestBody(*label), + } + response, err := u.apiClient.PostLabels(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201.Label, nil + return response.Label, nil } func (u *labelsAPI) UpdateLabel(ctx context.Context, label *domain.Label) (*domain.Label, error) { var props *domain.LabelUpdate_Properties - params := &domain.PatchLabelsIDParams{} if label.Properties != nil { props = &domain.LabelUpdate_Properties{AdditionalProperties: label.Properties.AdditionalProperties} } - body := &domain.LabelUpdate{ - Name: label.Name, - Properties: props, + params := &domain.PatchLabelsIDAllParams{ + Body: domain.PatchLabelsIDJSONRequestBody(domain.LabelUpdate{ + Name: label.Name, + Properties: props, + }), + LabelID: *label.Id, } - response, err := u.apiClient.PatchLabelsIDWithResponse(ctx, *label.Id, params, domain.PatchLabelsIDJSONRequestBody(*body)) + response, err := u.apiClient.PatchLabelsID(ctx, params) if err != nil { return nil, err } - if response.JSON404 != nil { - return nil, domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Label, nil + return response.Label, nil } func (u *labelsAPI) DeleteLabel(ctx context.Context, label *domain.Label) error { @@ -156,16 +148,8 @@ func (u *labelsAPI) DeleteLabel(ctx context.Context, label *domain.Label) error } func (u *labelsAPI) DeleteLabelWithID(ctx context.Context, labelID string) error { - params := &domain.DeleteLabelsIDParams{} - response, err := u.apiClient.DeleteLabelsIDWithResponse(ctx, labelID, params) - if err != nil { - return err - } - if response.JSON404 != nil { - return domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteLabelsIDAllParams{ + LabelID: labelID, } - return nil + return u.apiClient.DeleteLabelsID(ctx, params) } diff --git a/api/organizations.go b/api/organizations.go index 75bc8471..a54f3154 100644 --- a/api/organizations.go +++ b/api/organizations.go @@ -61,11 +61,11 @@ type OrganizationsAPI interface { // organizationsAPI implements OrganizationsAPI type organizationsAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewOrganizationsAPI creates new instance of OrganizationsAPI -func NewOrganizationsAPI(apiClient *domain.ClientWithResponses) OrganizationsAPI { +func NewOrganizationsAPI(apiClient *domain.Client) OrganizationsAPI { return &organizationsAPI{ apiClient: apiClient, } @@ -81,14 +81,11 @@ func (o *organizationsAPI) getOrganizations(ctx context.Context, params *domain. } params.Offset = &options.offset params.Descending = &options.descending - response, err := o.apiClient.GetOrgsWithResponse(ctx, params) + response, err := o.apiClient.GetOrgs(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200.Orgs, nil + return response.Orgs, nil } func (o *organizationsAPI) GetOrganizations(ctx context.Context, pagingOptions ...PagingOption) (*[]domain.Organization, error) { params := &domain.GetOrgsParams{} @@ -108,15 +105,10 @@ func (o *organizationsAPI) FindOrganizationByName(ctx context.Context, orgName s } func (o *organizationsAPI) FindOrganizationByID(ctx context.Context, orgID string) (*domain.Organization, error) { - params := &domain.GetOrgsIDParams{} - response, err := o.apiClient.GetOrgsIDWithResponse(ctx, orgID, params) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.GetOrgsIDAllParams{ + OrgID: orgID, } - return response.JSON200, nil + return o.apiClient.GetOrgsID(ctx, params) } func (o *organizationsAPI) FindOrganizationsByUserID(ctx context.Context, userID string, pagingOptions ...PagingOption) (*[]domain.Organization, error) { @@ -125,19 +117,13 @@ func (o *organizationsAPI) FindOrganizationsByUserID(ctx context.Context, userID } func (o *organizationsAPI) CreateOrganization(ctx context.Context, org *domain.Organization) (*domain.Organization, error) { - params := &domain.PostOrgsParams{} - req := domain.PostOrgsJSONRequestBody{ - Name: org.Name, - Description: org.Description, - } - response, err := o.apiClient.PostOrgsWithResponse(ctx, params, req) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostOrgsAllParams{ + Body: domain.PostOrgsJSONRequestBody{ + Name: org.Name, + Description: org.Description, + }, } - return response.JSON201, nil + return o.apiClient.PostOrgs(ctx, params) } func (o *organizationsAPI) CreateOrganizationWithName(ctx context.Context, orgName string) (*domain.Organization, error) { @@ -151,34 +137,21 @@ func (o *organizationsAPI) DeleteOrganization(ctx context.Context, org *domain.O } func (o *organizationsAPI) DeleteOrganizationWithID(ctx context.Context, orgID string) error { - params := &domain.DeleteOrgsIDParams{} - response, err := o.apiClient.DeleteOrgsIDWithResponse(ctx, orgID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteOrgsIDAllParams{ + OrgID: orgID, } - if response.JSON404 != nil { - return domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - return nil + return o.apiClient.DeleteOrgsID(ctx, params) } func (o *organizationsAPI) UpdateOrganization(ctx context.Context, org *domain.Organization) (*domain.Organization, error) { - params := &domain.PatchOrgsIDParams{} - req := domain.PatchOrgsIDJSONRequestBody{ - Name: &org.Name, - Description: org.Description, - } - response, err := o.apiClient.PatchOrgsIDWithResponse(ctx, *org.Id, params, req) - if err != nil { - return nil, err + params := &domain.PatchOrgsIDAllParams{ + Body: domain.PatchOrgsIDJSONRequestBody{ + Name: &org.Name, + Description: org.Description, + }, + OrgID: *org.Id, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200, nil + return o.apiClient.PatchOrgsID(ctx, params) } func (o *organizationsAPI) GetMembers(ctx context.Context, org *domain.Organization) (*[]domain.ResourceMember, error) { @@ -186,18 +159,14 @@ func (o *organizationsAPI) GetMembers(ctx context.Context, org *domain.Organizat } func (o *organizationsAPI) GetMembersWithID(ctx context.Context, orgID string) (*[]domain.ResourceMember, error) { - params := &domain.GetOrgsIDMembersParams{} - response, err := o.apiClient.GetOrgsIDMembersWithResponse(ctx, orgID, params) + params := &domain.GetOrgsIDMembersAllParams{ + OrgID: orgID, + } + response, err := o.apiClient.GetOrgsIDMembers(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON404 != nil { - return nil, domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - return response.JSON200.Users, nil + return response.Users, nil } func (o *organizationsAPI) AddMember(ctx context.Context, org *domain.Organization, user *domain.User) (*domain.ResourceMember, error) { @@ -205,16 +174,11 @@ func (o *organizationsAPI) AddMember(ctx context.Context, org *domain.Organizati } func (o *organizationsAPI) AddMemberWithID(ctx context.Context, orgID, memberID string) (*domain.ResourceMember, error) { - params := &domain.PostOrgsIDMembersParams{} - body := &domain.PostOrgsIDMembersJSONRequestBody{Id: memberID} - response, err := o.apiClient.PostOrgsIDMembersWithResponse(ctx, orgID, params, *body) - if err != nil { - return nil, err + params := &domain.PostOrgsIDMembersAllParams{ + Body: domain.PostOrgsIDMembersJSONRequestBody{Id: memberID}, + OrgID: orgID, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201, nil + return o.apiClient.PostOrgsIDMembers(ctx, params) } func (o *organizationsAPI) RemoveMember(ctx context.Context, org *domain.Organization, user *domain.User) error { @@ -222,15 +186,11 @@ func (o *organizationsAPI) RemoveMember(ctx context.Context, org *domain.Organiz } func (o *organizationsAPI) RemoveMemberWithID(ctx context.Context, orgID, memberID string) error { - params := &domain.DeleteOrgsIDMembersIDParams{} - response, err := o.apiClient.DeleteOrgsIDMembersIDWithResponse(ctx, orgID, memberID, params) - if err != nil { - return err + params := &domain.DeleteOrgsIDMembersIDAllParams{ + OrgID: orgID, + UserID: memberID, } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return o.apiClient.DeleteOrgsIDMembersID(ctx, params) } func (o *organizationsAPI) GetOwners(ctx context.Context, org *domain.Organization) (*[]domain.ResourceOwner, error) { @@ -238,18 +198,14 @@ func (o *organizationsAPI) GetOwners(ctx context.Context, org *domain.Organizati } func (o *organizationsAPI) GetOwnersWithID(ctx context.Context, orgID string) (*[]domain.ResourceOwner, error) { - params := &domain.GetOrgsIDOwnersParams{} - response, err := o.apiClient.GetOrgsIDOwnersWithResponse(ctx, orgID, params) + params := &domain.GetOrgsIDOwnersAllParams{ + OrgID: orgID, + } + response, err := o.apiClient.GetOrgsIDOwners(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON404 != nil { - return nil, domain.ErrorToHTTPError(response.JSON404, response.StatusCode()) - } - return response.JSON200.Users, nil + return response.Users, nil } func (o *organizationsAPI) AddOwner(ctx context.Context, org *domain.Organization, user *domain.User) (*domain.ResourceOwner, error) { @@ -257,16 +213,11 @@ func (o *organizationsAPI) AddOwner(ctx context.Context, org *domain.Organizatio } func (o *organizationsAPI) AddOwnerWithID(ctx context.Context, orgID, memberID string) (*domain.ResourceOwner, error) { - params := &domain.PostOrgsIDOwnersParams{} - body := &domain.PostOrgsIDOwnersJSONRequestBody{Id: memberID} - response, err := o.apiClient.PostOrgsIDOwnersWithResponse(ctx, orgID, params, *body) - if err != nil { - return nil, err + params := &domain.PostOrgsIDOwnersAllParams{ + Body: domain.PostOrgsIDOwnersJSONRequestBody{Id: memberID}, + OrgID: orgID, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201, nil + return o.apiClient.PostOrgsIDOwners(ctx, params) } func (o *organizationsAPI) RemoveOwner(ctx context.Context, org *domain.Organization, user *domain.User) error { @@ -274,13 +225,9 @@ func (o *organizationsAPI) RemoveOwner(ctx context.Context, org *domain.Organiza } func (o *organizationsAPI) RemoveOwnerWithID(ctx context.Context, orgID, memberID string) error { - params := &domain.DeleteOrgsIDOwnersIDParams{} - response, err := o.apiClient.DeleteOrgsIDOwnersIDWithResponse(ctx, orgID, memberID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteOrgsIDOwnersIDAllParams{ + OrgID: orgID, + UserID: memberID, } - return nil + return o.apiClient.DeleteOrgsIDOwnersID(ctx, params) } diff --git a/api/tasks.go b/api/tasks.go index e584fa3b..f2a21982 100644 --- a/api/tasks.go +++ b/api/tasks.go @@ -6,7 +6,6 @@ package api import ( "context" - "errors" "fmt" "time" @@ -58,7 +57,7 @@ type TasksAPI interface { // Every has higher priority. CreateTask(ctx context.Context, task *domain.Task) (*domain.Task, error) // CreateTaskWithEvery creates a new task with the name, flux script and every repetition setting, in the org orgID. - // Every holds duration values. + // Every means duration values. CreateTaskWithEvery(ctx context.Context, name, flux, every, orgID string) (*domain.Task, error) // CreateTaskWithCron creates a new task with the name, flux script and cron repetition setting, in the org orgID // Cron holds cron-like setting, e.g. once an hour at beginning of the hour "0 * * * *". @@ -127,7 +126,7 @@ type TasksAPI interface { FindLogsWithID(ctx context.Context, taskID string) ([]domain.LogEvent, error) // FindLabels retrieves labels of a task. FindLabels(ctx context.Context, task *domain.Task) ([]domain.Label, error) - // FindLabelsWithID retrieves labels of an task with taskID. + // FindLabelsWithID retrieves labels of a task with taskID. FindLabelsWithID(ctx context.Context, taskID string) ([]domain.Label, error) // AddLabel adds a label to a task. AddLabel(ctx context.Context, task *domain.Task, label *domain.Label) (*domain.Label, error) @@ -141,11 +140,11 @@ type TasksAPI interface { // tasksAPI implements TasksAPI type tasksAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client } // NewTasksAPI creates new instance of TasksAPI -func NewTasksAPI(apiClient *domain.ClientWithResponses) TasksAPI { +func NewTasksAPI(apiClient *domain.Client) TasksAPI { return &tasksAPI{ apiClient: apiClient, } @@ -178,17 +177,11 @@ func (t *tasksAPI) FindTasks(ctx context.Context, filter *TaskFilter) ([]domain. } } - response, err := t.apiClient.GetTasksWithResponse(ctx, params) + response, err := t.apiClient.GetTasks(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Tasks == nil { - return nil, errors.New("tasks not found") - } - return *response.JSON200.Tasks, nil + return *response.Tasks, nil } func (t *tasksAPI) GetTask(ctx context.Context, task *domain.Task) (*domain.Task, error) { @@ -196,27 +189,17 @@ func (t *tasksAPI) GetTask(ctx context.Context, task *domain.Task) (*domain.Task } func (t *tasksAPI) GetTaskByID(ctx context.Context, taskID string) (*domain.Task, error) { - params := &domain.GetTasksIDParams{} - response, err := t.apiClient.GetTasksIDWithResponse(ctx, taskID, params) - if err != nil { - return nil, err + params := &domain.GetTasksIDAllParams{ + TaskID: taskID, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON200, nil + return t.apiClient.GetTasksID(ctx, params) } func (t *tasksAPI) createTask(ctx context.Context, taskReq *domain.TaskCreateRequest) (*domain.Task, error) { - params := &domain.PostTasksParams{} - response, err := t.apiClient.PostTasksWithResponse(ctx, params, domain.PostTasksJSONRequestBody(*taskReq)) - if err != nil { - return nil, err + params := &domain.PostTasksAllParams{ + Body: domain.PostTasksJSONRequestBody(*taskReq), } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201, nil + return t.apiClient.PostTasks(ctx, params) } func createTaskReqDetailed(name, flux string, every, cron *string, orgID string) *domain.TaskCreateRequest { @@ -267,39 +250,29 @@ func (t *tasksAPI) DeleteTask(ctx context.Context, task *domain.Task) error { } func (t *tasksAPI) DeleteTaskWithID(ctx context.Context, taskID string) error { - params := &domain.DeleteTasksIDParams{} - response, err := t.apiClient.DeleteTasksIDWithResponse(ctx, taskID, params) - if err != nil { - return err + params := &domain.DeleteTasksIDAllParams{ + TaskID: taskID, } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return t.apiClient.DeleteTasksID(ctx, params) } func (t *tasksAPI) UpdateTask(ctx context.Context, task *domain.Task) (*domain.Task, error) { - params := &domain.PatchTasksIDParams{} - updateReq := &domain.TaskUpdateRequest{ - Description: task.Description, - Flux: &task.Flux, - Name: &task.Name, - Offset: task.Offset, - Status: task.Status, + params := &domain.PatchTasksIDAllParams{ + Body: domain.PatchTasksIDJSONRequestBody(domain.TaskUpdateRequest{ + Description: task.Description, + Flux: &task.Flux, + Name: &task.Name, + Offset: task.Offset, + Status: task.Status, + }), + TaskID: task.Id, } if task.Every != nil { - updateReq.Every = task.Every + params.Body.Every = task.Every } else { - updateReq.Cron = task.Cron - } - response, err := t.apiClient.PatchTasksIDWithResponse(ctx, task.Id, params, domain.PatchTasksIDJSONRequestBody(*updateReq)) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params.Body.Cron = task.Cron } - return response.JSON200, nil + return t.apiClient.PatchTasksID(ctx, params) } func (t *tasksAPI) FindMembers(ctx context.Context, task *domain.Task) ([]domain.ResourceMember, error) { @@ -307,18 +280,14 @@ func (t *tasksAPI) FindMembers(ctx context.Context, task *domain.Task) ([]domain } func (t *tasksAPI) FindMembersWithID(ctx context.Context, taskID string) ([]domain.ResourceMember, error) { - params := &domain.GetTasksIDMembersParams{} - response, err := t.apiClient.GetTasksIDMembersWithResponse(ctx, taskID, params) + params := &domain.GetTasksIDMembersAllParams{ + TaskID: taskID, + } + response, err := t.apiClient.GetTasksIDMembers(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Users == nil { - return nil, fmt.Errorf("members for task '%s' not found", taskID) - } - return *response.JSON200.Users, nil + return *response.Users, nil } func (t *tasksAPI) AddMember(ctx context.Context, task *domain.Task, user *domain.User) (*domain.ResourceMember, error) { @@ -326,16 +295,12 @@ func (t *tasksAPI) AddMember(ctx context.Context, task *domain.Task, user *domai } func (t *tasksAPI) AddMemberWithID(ctx context.Context, taskID, memberID string) (*domain.ResourceMember, error) { - params := &domain.PostTasksIDMembersParams{} - body := &domain.PostTasksIDMembersJSONRequestBody{Id: memberID} - response, err := t.apiClient.PostTasksIDMembersWithResponse(ctx, taskID, params, *body) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostTasksIDMembersAllParams{ + TaskID: taskID, + Body: domain.PostTasksIDMembersJSONRequestBody{Id: memberID}, } - return response.JSON201, nil + + return t.apiClient.PostTasksIDMembers(ctx, params) } func (t *tasksAPI) RemoveMember(ctx context.Context, task *domain.Task, user *domain.User) error { @@ -343,15 +308,11 @@ func (t *tasksAPI) RemoveMember(ctx context.Context, task *domain.Task, user *do } func (t *tasksAPI) RemoveMemberWithID(ctx context.Context, taskID, memberID string) error { - params := &domain.DeleteTasksIDMembersIDParams{} - response, err := t.apiClient.DeleteTasksIDMembersIDWithResponse(ctx, taskID, memberID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteTasksIDMembersIDAllParams{ + TaskID: taskID, + UserID: memberID, } - return nil + return t.apiClient.DeleteTasksIDMembersID(ctx, params) } func (t *tasksAPI) FindOwners(ctx context.Context, task *domain.Task) ([]domain.ResourceOwner, error) { @@ -359,18 +320,14 @@ func (t *tasksAPI) FindOwners(ctx context.Context, task *domain.Task) ([]domain. } func (t *tasksAPI) FindOwnersWithID(ctx context.Context, taskID string) ([]domain.ResourceOwner, error) { - params := &domain.GetTasksIDOwnersParams{} - response, err := t.apiClient.GetTasksIDOwnersWithResponse(ctx, taskID, params) + params := &domain.GetTasksIDOwnersAllParams{ + TaskID: taskID, + } + response, err := t.apiClient.GetTasksIDOwners(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Users == nil { - return nil, fmt.Errorf("owners for task '%s' not found", taskID) - } - return *response.JSON200.Users, nil + return *response.Users, nil } func (t *tasksAPI) AddOwner(ctx context.Context, task *domain.Task, user *domain.User) (*domain.ResourceOwner, error) { @@ -378,16 +335,11 @@ func (t *tasksAPI) AddOwner(ctx context.Context, task *domain.Task, user *domain } func (t *tasksAPI) AddOwnerWithID(ctx context.Context, taskID, memberID string) (*domain.ResourceOwner, error) { - params := &domain.PostTasksIDOwnersParams{} - body := &domain.PostTasksIDOwnersJSONRequestBody{Id: memberID} - response, err := t.apiClient.PostTasksIDOwnersWithResponse(ctx, taskID, params, *body) - if err != nil { - return nil, err + params := &domain.PostTasksIDOwnersAllParams{ + Body: domain.PostTasksIDOwnersJSONRequestBody{Id: memberID}, + TaskID: taskID, } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201, nil + return t.apiClient.PostTasksIDOwners(ctx, params) } func (t *tasksAPI) RemoveOwner(ctx context.Context, task *domain.Task, user *domain.User) error { @@ -395,15 +347,11 @@ func (t *tasksAPI) RemoveOwner(ctx context.Context, task *domain.Task, user *dom } func (t *tasksAPI) RemoveOwnerWithID(ctx context.Context, taskID, memberID string) error { - params := &domain.DeleteTasksIDOwnersIDParams{} - response, err := t.apiClient.DeleteTasksIDOwnersIDWithResponse(ctx, taskID, memberID, params) - if err != nil { - return err + params := &domain.DeleteTasksIDOwnersIDAllParams{ + TaskID: taskID, + UserID: memberID, } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return t.apiClient.DeleteTasksIDOwnersID(ctx, params) } func (t *tasksAPI) FindRuns(ctx context.Context, task *domain.Task, filter *RunFilter) ([]domain.Run, error) { @@ -411,7 +359,7 @@ func (t *tasksAPI) FindRuns(ctx context.Context, task *domain.Task, filter *RunF } func (t *tasksAPI) FindRunsWithID(ctx context.Context, taskID string, filter *RunFilter) ([]domain.Run, error) { - params := &domain.GetTasksIDRunsParams{} + params := &domain.GetTasksIDRunsAllParams{TaskID: taskID} if filter != nil { if !filter.AfterTime.IsZero() { params.AfterTime = &filter.AfterTime @@ -426,14 +374,11 @@ func (t *tasksAPI) FindRunsWithID(ctx context.Context, taskID string, filter *Ru params.After = &filter.After } } - response, err := t.apiClient.GetTasksIDRunsWithResponse(ctx, taskID, params) + response, err := t.apiClient.GetTasksIDRuns(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return *response.JSON200.Runs, nil + return *response.Runs, nil } func (t *tasksAPI) GetRun(ctx context.Context, run *domain.Run) (*domain.Run, error) { @@ -441,34 +386,29 @@ func (t *tasksAPI) GetRun(ctx context.Context, run *domain.Run) (*domain.Run, er } func (t *tasksAPI) GetRunByID(ctx context.Context, taskID, runID string) (*domain.Run, error) { - params := &domain.GetTasksIDRunsIDParams{} - response, err := t.apiClient.GetTasksIDRunsIDWithResponse(ctx, taskID, runID, params) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.GetTasksIDRunsIDAllParams{ + TaskID: taskID, + RunID: runID, } - return response.JSON200, nil + return t.apiClient.GetTasksIDRunsID(ctx, params) } func (t *tasksAPI) FindRunLogs(ctx context.Context, run *domain.Run) ([]domain.LogEvent, error) { return t.FindRunLogsWithID(ctx, *run.TaskID, *run.Id) } func (t *tasksAPI) FindRunLogsWithID(ctx context.Context, taskID, runID string) ([]domain.LogEvent, error) { - params := &domain.GetTasksIDRunsIDLogsParams{} - - response, err := t.apiClient.GetTasksIDRunsIDLogsWithResponse(ctx, taskID, runID, params) + params := &domain.GetTasksIDRunsIDLogsAllParams{ + TaskID: taskID, + RunID: runID, + } + response, err := t.apiClient.GetTasksIDRunsIDLogs(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Events == nil { + if response.Events == nil { return nil, fmt.Errorf("logs for task '%s' run '%s 'not found", taskID, runID) } - return *response.JSON200.Events, nil + return *response.Events, nil } func (t *tasksAPI) RunManually(ctx context.Context, task *domain.Task) (*domain.Run, error) { @@ -476,15 +416,10 @@ func (t *tasksAPI) RunManually(ctx context.Context, task *domain.Task) (*domain. } func (t *tasksAPI) RunManuallyWithID(ctx context.Context, taskID string) (*domain.Run, error) { - params := domain.PostTasksIDRunsParams{} - response, err := t.apiClient.PostTasksIDRunsWithResponse(ctx, taskID, ¶ms, domain.PostTasksIDRunsJSONRequestBody{}) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostTasksIDRunsAllParams{ + TaskID: taskID, } - return response.JSON201, nil + return t.apiClient.PostTasksIDRuns(ctx, params) } func (t *tasksAPI) RetryRun(ctx context.Context, run *domain.Run) (*domain.Run, error) { @@ -492,15 +427,11 @@ func (t *tasksAPI) RetryRun(ctx context.Context, run *domain.Run) (*domain.Run, } func (t *tasksAPI) RetryRunWithID(ctx context.Context, taskID, runID string) (*domain.Run, error) { - params := &domain.PostTasksIDRunsIDRetryParams{} - response, err := t.apiClient.PostTasksIDRunsIDRetryWithBodyWithResponse(ctx, taskID, runID, params, "application/json; charset=utf-8", nil) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.PostTasksIDRunsIDRetryAllParams{ + TaskID: taskID, + RunID: runID, } - return response.JSON200, nil + return t.apiClient.PostTasksIDRunsIDRetry(ctx, params) } func (t *tasksAPI) CancelRun(ctx context.Context, run *domain.Run) error { @@ -508,15 +439,11 @@ func (t *tasksAPI) CancelRun(ctx context.Context, run *domain.Run) error { } func (t *tasksAPI) CancelRunWithID(ctx context.Context, taskID, runID string) error { - params := &domain.DeleteTasksIDRunsIDParams{} - response, err := t.apiClient.DeleteTasksIDRunsIDWithResponse(ctx, taskID, runID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteTasksIDRunsIDAllParams{ + TaskID: taskID, + RunID: runID, } - return nil + return t.apiClient.DeleteTasksIDRunsID(ctx, params) } func (t *tasksAPI) FindLogs(ctx context.Context, task *domain.Task) ([]domain.LogEvent, error) { @@ -524,19 +451,17 @@ func (t *tasksAPI) FindLogs(ctx context.Context, task *domain.Task) ([]domain.Lo } func (t *tasksAPI) FindLogsWithID(ctx context.Context, taskID string) ([]domain.LogEvent, error) { - params := &domain.GetTasksIDLogsParams{} - - response, err := t.apiClient.GetTasksIDLogsWithResponse(ctx, taskID, params) + params := &domain.GetTasksIDLogsAllParams{ + TaskID: taskID, + } + response, err := t.apiClient.GetTasksIDLogs(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Events == nil { + if response.Events == nil { return nil, fmt.Errorf("logs for task '%s' not found", taskID) } - return *response.JSON200.Events, nil + return *response.Events, nil } func (t *tasksAPI) FindLabels(ctx context.Context, task *domain.Task) ([]domain.Label, error) { @@ -544,18 +469,17 @@ func (t *tasksAPI) FindLabels(ctx context.Context, task *domain.Task) ([]domain. } func (t *tasksAPI) FindLabelsWithID(ctx context.Context, taskID string) ([]domain.Label, error) { - params := &domain.GetTasksIDLabelsParams{} - response, err := t.apiClient.GetTasksIDLabelsWithResponse(ctx, taskID, params) + params := &domain.GetTasksIDLabelsAllParams{ + TaskID: taskID, + } + response, err := t.apiClient.GetTasksIDLabels(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200.Labels == nil { + if response.Labels == nil { return nil, fmt.Errorf("lables for task '%s' not found", taskID) } - return *response.JSON200.Labels, nil + return *response.Labels, nil } func (t *tasksAPI) AddLabel(ctx context.Context, task *domain.Task, label *domain.Label) (*domain.Label, error) { @@ -563,30 +487,25 @@ func (t *tasksAPI) AddLabel(ctx context.Context, task *domain.Task, label *domai } func (t *tasksAPI) AddLabelWithID(ctx context.Context, taskID, labelID string) (*domain.Label, error) { - params := &domain.PostTasksIDLabelsParams{} - body := &domain.PostTasksIDLabelsJSONRequestBody{LabelID: &labelID} - response, err := t.apiClient.PostTasksIDLabelsWithResponse(ctx, taskID, params, *body) + params := &domain.PostTasksIDLabelsAllParams{ + Body: domain.PostTasksIDLabelsJSONRequestBody{LabelID: &labelID}, + TaskID: taskID, + } + response, err := t.apiClient.PostTasksIDLabels(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return response.JSON201.Label, nil + return response.Label, nil } func (t *tasksAPI) RemoveLabel(ctx context.Context, task *domain.Task, label *domain.Label) error { return t.RemoveLabelWithID(ctx, task.Id, *label.Id) } -func (t *tasksAPI) RemoveLabelWithID(ctx context.Context, taskID, memberID string) error { - params := &domain.DeleteTasksIDLabelsIDParams{} - response, err := t.apiClient.DeleteTasksIDLabelsIDWithResponse(ctx, taskID, memberID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) +func (t *tasksAPI) RemoveLabelWithID(ctx context.Context, taskID, labelID string) error { + params := &domain.DeleteTasksIDLabelsIDAllParams{ + TaskID: taskID, + LabelID: labelID, } - return nil + return t.apiClient.DeleteTasksIDLabelsID(ctx, params) } diff --git a/api/users.go b/api/users.go index 11d54ead..566b326e 100644 --- a/api/users.go +++ b/api/users.go @@ -31,9 +31,9 @@ type UsersAPI interface { CreateUserWithName(ctx context.Context, userName string) (*domain.User, error) // UpdateUser updates user UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error) - // UpdateUserPassword sets password for an user + // UpdateUserPassword sets password for a user UpdateUserPassword(ctx context.Context, user *domain.User, password string) error - // UpdateUserPasswordWithID sets password for an user with userID + // UpdateUserPasswordWithID sets password for a user with userID UpdateUserPasswordWithID(ctx context.Context, userID string, password string) error // DeleteUserWithID deletes an user with userID DeleteUserWithID(ctx context.Context, userID string) error @@ -45,13 +45,13 @@ type UsersAPI interface { MeUpdatePassword(ctx context.Context, oldPassword, newPassword string) error // SignIn exchanges username and password credentials to establish an authenticated session with the InfluxDB server. The Client's authentication token is then ignored, it can be empty. SignIn(ctx context.Context, username, password string) error - // SignOut signs out previously signed in user + // SignOut signs out previously signed-in user SignOut(ctx context.Context) error } // usersAPI implements UsersAPI type usersAPI struct { - apiClient *domain.ClientWithResponses + apiClient *domain.Client httpService http.Service httpClient *nethttp.Client deleteCookieJar bool @@ -59,7 +59,7 @@ type usersAPI struct { } // NewUsersAPI creates new instance of UsersAPI -func NewUsersAPI(apiClient *domain.ClientWithResponses, httpService http.Service, httpClient *nethttp.Client) UsersAPI { +func NewUsersAPI(apiClient *domain.Client, httpService http.Service, httpClient *nethttp.Client) UsersAPI { return &usersAPI{ apiClient: apiClient, httpService: httpService, @@ -69,26 +69,22 @@ func NewUsersAPI(apiClient *domain.ClientWithResponses, httpService http.Service func (u *usersAPI) GetUsers(ctx context.Context) (*[]domain.User, error) { params := &domain.GetUsersParams{} - response, err := u.apiClient.GetUsersWithResponse(ctx, params) + response, err := u.apiClient.GetUsers(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return userResponsesToUsers(response.JSON200.Users), nil + return userResponsesToUsers(response.Users), nil } func (u *usersAPI) FindUserByID(ctx context.Context, userID string) (*domain.User, error) { - params := &domain.GetUsersIDParams{} - response, err := u.apiClient.GetUsersIDWithResponse(ctx, userID, params) + params := &domain.GetUsersIDAllParams{ + UserID: userID, + } + response, err := u.apiClient.GetUsersID(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return userResponseToUser(response.JSON200), nil + return userResponseToUser(response), nil } func (u *usersAPI) FindUserByName(ctx context.Context, userName string) (*domain.User, error) { @@ -115,27 +111,26 @@ func (u *usersAPI) CreateUserWithName(ctx context.Context, userName string) (*do } func (u *usersAPI) CreateUser(ctx context.Context, user *domain.User) (*domain.User, error) { - params := &domain.PostUsersParams{} - response, err := u.apiClient.PostUsersWithResponse(ctx, params, domain.PostUsersJSONRequestBody(*user)) + params := &domain.PostUsersAllParams{ + Body: domain.PostUsersJSONRequestBody(*user), + } + response, err := u.apiClient.PostUsers(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return userResponseToUser(response.JSON201), nil + return userResponseToUser(response), nil } func (u *usersAPI) UpdateUser(ctx context.Context, user *domain.User) (*domain.User, error) { - params := &domain.PatchUsersIDParams{} - response, err := u.apiClient.PatchUsersIDWithResponse(ctx, *user.Id, params, domain.PatchUsersIDJSONRequestBody(*user)) + params := &domain.PatchUsersIDAllParams{ + Body: domain.PatchUsersIDJSONRequestBody(*user), + UserID: *user.Id, + } + response, err := u.apiClient.PatchUsersID(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return userResponseToUser(response.JSON200), nil + return userResponseToUser(response), nil } func (u *usersAPI) UpdateUserPassword(ctx context.Context, user *domain.User, password string) error { @@ -143,16 +138,11 @@ func (u *usersAPI) UpdateUserPassword(ctx context.Context, user *domain.User, pa } func (u *usersAPI) UpdateUserPasswordWithID(ctx context.Context, userID string, password string) error { - params := &domain.PostUsersIDPasswordParams{} - body := &domain.PasswordResetBody{Password: password} - response, err := u.apiClient.PostUsersIDPasswordWithResponse(ctx, userID, params, domain.PostUsersIDPasswordJSONRequestBody(*body)) - if err != nil { - return err + params := &domain.PostUsersIDPasswordAllParams{ + UserID: userID, + Body: domain.PostUsersIDPasswordJSONRequestBody(domain.PasswordResetBody{Password: password}), } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return u.apiClient.PostUsersIDPassword(ctx, params) } func (u *usersAPI) DeleteUser(ctx context.Context, user *domain.User) error { @@ -160,27 +150,19 @@ func (u *usersAPI) DeleteUser(ctx context.Context, user *domain.User) error { } func (u *usersAPI) DeleteUserWithID(ctx context.Context, userID string) error { - params := &domain.DeleteUsersIDParams{} - response, err := u.apiClient.DeleteUsersIDWithResponse(ctx, userID, params) - if err != nil { - return err - } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params := &domain.DeleteUsersIDAllParams{ + UserID: userID, } - return nil + return u.apiClient.DeleteUsersID(ctx, params) } func (u *usersAPI) Me(ctx context.Context) (*domain.User, error) { params := &domain.GetMeParams{} - response, err := u.apiClient.GetMeWithResponse(ctx, params) + response, err := u.apiClient.GetMe(ctx, params) if err != nil { return nil, err } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return userResponseToUser(response.JSON200), nil + return userResponseToUser(response), nil } func (u *usersAPI) MeUpdatePassword(ctx context.Context, oldPassword, newPassword string) error { @@ -194,16 +176,10 @@ func (u *usersAPI) MeUpdatePassword(ctx context.Context, oldPassword, newPasswor auth := u.httpService.Authorization() defer u.httpService.SetAuthorization(auth) u.httpService.SetAuthorization("Basic " + creds) - params := &domain.PutMePasswordParams{} - body := &domain.PasswordResetBody{Password: newPassword} - response, err := u.apiClient.PutMePasswordWithResponse(ctx, params, domain.PutMePasswordJSONRequestBody(*body)) - if err != nil { - return err + params := &domain.PutMePasswordAllParams{ + Body: domain.PutMePasswordJSONRequestBody(domain.PasswordResetBody{Password: newPassword}), } - if response.JSONDefault != nil { - return domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - return nil + return u.apiClient.PutMePassword(ctx, params) } func (u *usersAPI) SignIn(ctx context.Context, username, password string) error { @@ -220,39 +196,17 @@ func (u *usersAPI) SignIn(ctx context.Context, username, password string) error creds := base64.StdEncoding.EncodeToString([]byte(username + ":" + password)) u.httpService.SetAuthorization("Basic " + creds) defer u.httpService.SetAuthorization("") - resp, err := u.apiClient.PostSigninWithResponse(ctx, &domain.PostSigninParams{}) - if err != nil { - return err - } - if resp.JSONDefault != nil { - return domain.ErrorToHTTPError(resp.JSONDefault, resp.StatusCode()) - } - if resp.JSON401 != nil { - return domain.ErrorToHTTPError(resp.JSON401, resp.StatusCode()) - } - if resp.JSON403 != nil { - return domain.ErrorToHTTPError(resp.JSON403, resp.StatusCode()) - } - return nil + return u.apiClient.PostSignin(ctx, &domain.PostSigninParams{}) } func (u *usersAPI) SignOut(ctx context.Context) error { u.lock.Lock() defer u.lock.Unlock() - resp, err := u.apiClient.PostSignoutWithResponse(ctx, &domain.PostSignoutParams{}) - if err != nil { - return err - } - if resp.JSONDefault != nil { - return domain.ErrorToHTTPError(resp.JSONDefault, resp.StatusCode()) - } - if resp.JSON401 != nil { - return domain.ErrorToHTTPError(resp.JSON401, resp.StatusCode()) - } + err := u.apiClient.PostSignout(ctx, &domain.PostSignoutParams{}) if u.deleteCookieJar { u.httpClient.Jar = nil } - return nil + return err } func userResponseToUser(ur *domain.UserResponse) *domain.User { @@ -260,10 +214,9 @@ func userResponseToUser(ur *domain.UserResponse) *domain.User { return nil } user := &domain.User{ - Id: ur.Id, - Name: ur.Name, - OauthID: ur.OauthID, - Status: userResponseStatusToUserStatus(ur.Status), + Id: ur.Id, + Name: ur.Name, + Status: userResponseStatusToUserStatus(ur.Status), } return user } diff --git a/client.go b/client.go index 9ff6a621..c41fd1af 100644 --- a/client.go +++ b/client.go @@ -9,6 +9,7 @@ package influxdb2 import ( "context" "errors" + httpnet "net/http" "strings" "sync" "time" @@ -72,6 +73,8 @@ type Client interface { LabelsAPI() api.LabelsAPI // TasksAPI returns Tasks API client TasksAPI() api.TasksAPI + + APIClient() *domain.Client } // clientImpl implements Client interface @@ -82,7 +85,7 @@ type clientImpl struct { syncWriteAPIs map[string]api.WriteAPIBlocking lock sync.Mutex httpService http.Service - apiClient *domain.ClientWithResponses + apiClient *domain.Client authAPI api.AuthorizationsAPI orgAPI api.OrganizationsAPI usersAPI api.UsersAPI @@ -92,6 +95,10 @@ type clientImpl struct { tasksAPI api.TasksAPI } +type clientDoer struct { + service http.Service +} + // NewClient creates Client for connecting to given serverURL with provided authentication token, with the default options. // serverURL is the InfluxDB server base URL, e.g. http://localhost:8086, // authToken is an authentication token. It can be empty in case of connecting to newly installed InfluxDB server, which has not been set up yet. @@ -116,13 +123,17 @@ func NewClientWithOptions(serverURL string, authToken string, options *Options) authorization = "Token " + authToken } service := http.NewService(normServerURL, authorization, options.httpOptions) + doer := &clientDoer{service} + + apiClient, _ := domain.NewClient(service.ServerURL(), doer) + client := &clientImpl{ serverURL: serverURL, options: options, writeAPIs: make(map[string]api.WriteAPI, 5), syncWriteAPIs: make(map[string]api.WriteAPIBlocking, 5), httpService: service, - apiClient: domain.NewClientWithResponses(service), + apiClient: apiClient, } if log.Log != nil { log.Log.SetLogLevel(options.LogLevel()) @@ -136,6 +147,11 @@ func NewClientWithOptions(serverURL string, authToken string, options *Options) } return client } + +func (c *clientImpl) APIClient() *domain.Client { + return c.apiClient +} + func (c *clientImpl) Options() *Options { return c.options } @@ -148,20 +164,13 @@ func (c *clientImpl) HTTPService() http.Service { return c.httpService } +func (c *clientDoer) Do(req *httpnet.Request) (*httpnet.Response, error) { + return c.service.DoHTTPRequestWithResponse(req, nil) +} + func (c *clientImpl) Ready(ctx context.Context) (*domain.Ready, error) { params := &domain.GetReadyParams{} - response, err := c.apiClient.GetReadyWithResponse(ctx, params) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON200 == nil { //response with status 2xx, but not JSON - return nil, errors.New("cannot read Ready response") - - } - return response.JSON200, nil + return c.apiClient.GetReady(ctx, params) } func (c *clientImpl) Setup(ctx context.Context, username, password, org, bucket string, retentionPeriodHours int) (*domain.OnboardingResponse, error) { @@ -174,10 +183,10 @@ func (c *clientImpl) SetupWithToken(ctx context.Context, username, password, org } c.lock.Lock() defer c.lock.Unlock() - params := &domain.PostSetupParams{} + params := &domain.PostSetupAllParams{} retentionPeriodSeconds := int64(retentionPeriodHours * 3600) retentionPeriodHrs := int(time.Duration(retentionPeriodSeconds) * time.Second) - body := &domain.PostSetupJSONRequestBody{ + params.Body = domain.PostSetupJSONRequestBody{ Bucket: bucket, Org: org, Password: &password, @@ -186,45 +195,22 @@ func (c *clientImpl) SetupWithToken(ctx context.Context, username, password, org Username: username, } if token != "" { - body.Token = &token - } - response, err := c.apiClient.PostSetupWithResponse(ctx, params, *body) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) + params.Body.Token = &token } - c.httpService.SetAuthorization("Token " + *response.JSON201.Auth.Token) - return response.JSON201, nil + return c.apiClient.PostSetup(ctx, params) } func (c *clientImpl) Health(ctx context.Context) (*domain.HealthCheck, error) { params := &domain.GetHealthParams{} - response, err := c.apiClient.GetHealthWithResponse(ctx, params) - if err != nil { - return nil, err - } - if response.JSONDefault != nil { - return nil, domain.ErrorToHTTPError(response.JSONDefault, response.StatusCode()) - } - if response.JSON503 != nil { - //unhealthy server - return response.JSON503, nil - } - if response.JSON200 == nil { //response with status 2xx, but not JSON - return nil, errors.New("cannot read Health response") - } - - return response.JSON200, nil + return c.apiClient.GetHealth(ctx, params) } func (c *clientImpl) Ping(ctx context.Context) (bool, error) { - resp, err := c.apiClient.GetPingWithResponse(ctx) + err := c.apiClient.GetPing(ctx) if err != nil { return false, err } - return resp.StatusCode() == 204, nil + return true, nil } func createKey(org, bucket string) string { diff --git a/client_e2e_test.go b/client_e2e_test.go index 0c32ae8e..a604109a 100644 --- a/client_e2e_test.go +++ b/client_e2e_test.go @@ -293,7 +293,7 @@ func TestV2APIAgainstV1Server(t *testing.T) { func TestHTTPService(t *testing.T) { client := influxdb2.NewClient(serverURL, authToken) - apiClient := domain.NewClientWithResponses(client.HTTPService()) + apiClient := client.APIClient() org, err := client.OrganizationsAPI().FindOrganizationByName(context.Background(), "my-org") if err != nil { //return err @@ -314,17 +314,20 @@ from(bucket:"my-bucket") |> range(start: -1m) |> last()` Flux: taskFlux, Status: &taskStatus, } - resp, err := apiClient.PostTasksWithResponse(context.Background(), &domain.PostTasksParams{}, domain.PostTasksJSONRequestBody(taskRequest)) + params := &domain.PostTasksAllParams{ + Body: domain.PostTasksJSONRequestBody(taskRequest), + } + resp, err := apiClient.PostTasks(context.Background(), params) if err != nil { //return err t.Error(err) } - if resp.JSONDefault != nil { - t.Error(resp.JSONDefault.Message) - } - if assert.NotNil(t, resp.JSON201) { - assert.Equal(t, "My task", resp.JSON201.Name) - _, err := apiClient.DeleteTasksID(context.Background(), resp.JSON201.Id, &domain.DeleteTasksIDParams{}) + if assert.NotNil(t, resp) { + assert.Equal(t, "My task", resp.Name) + deleteParams := &domain.DeleteTasksIDAllParams{ + TaskID: resp.Id, + } + err := apiClient.DeleteTasksID(context.Background(), deleteParams) if err != nil { //return err t.Error(err) diff --git a/client_test.go b/client_test.go index cd0311ed..31cb611a 100644 --- a/client_test.go +++ b/client_test.go @@ -12,6 +12,7 @@ import ( "testing" "time" + "github.com/influxdata/influxdb-client-go/v2/domain" http2 "github.com/influxdata/influxdb-client-go/v2/internal/http" iwrite "github.com/influxdata/influxdb-client-go/v2/internal/write" "github.com/stretchr/testify/assert" @@ -136,9 +137,18 @@ func TestServerErrorNonJSON(t *testing.T) { defer server.Close() c := NewClient(server.URL, "x") + //Test non JSON error in custom code err := c.WriteAPIBlocking("o", "b").WriteRecord(context.Background(), "a,a=a a=1i") require.Error(t, err) assert.Equal(t, "500 Internal Server Error: internal server error", err.Error()) + + // Test non JSON error from generated code + params := &domain.GetBucketsParams{} + b, err := c.APIClient().GetBuckets(context.Background(), params) + assert.Nil(t, b) + require.Error(t, err) + assert.Equal(t, "500 Internal Server Error: internal server error", err.Error()) + } func TestServerErrorInflux1_8(t *testing.T) { diff --git a/domain/Readme.md b/domain/Readme.md index 42092182..8cc8a779 100644 --- a/domain/Readme.md +++ b/domain/Readme.md @@ -1,23 +1,23 @@ # Generated types and API client -`oss.yml` is copied from InfluxDB and customized, until changes are meged. Must be periodically sync with latest changes - and types and client must be re-generated +`oss.yml`must be periodically synced with latest changes and types and client must be re-generated +to maintain full compatibility with the latest InfluxDB release ## Install oapi generator `git clone git@github.com:bonitoo-io/oapi-codegen.git` `cd oapi-codegen` -`git checkout dev-master` +`git checkout feat/template_helpers` `go install ./cmd/oapi-codegen/oapi-codegen.go` -## Download and sync latest swagger + +## Download latest swagger `wget https://raw.githubusercontent.com/influxdata/openapi/master/contracts/oss.yml` - -## Generate `cd domain` - -Generate types -`oapi-codegen -generate types -o types.gen.go -package domain oss.yml` -Generate client +## Generate +### Generate types +`oapi-codegen -generate types -o types.gen.go -package domain -templates .\templates oss.yml` + +### Generate client `oapi-codegen -generate client -o client.gen.go -package domain -templates .\templates oss.yml` diff --git a/domain/client.gen.go b/domain/client.gen.go index 113c2ec1..dedeb333 100644 --- a/domain/client.gen.go +++ b/domain/client.gen.go @@ -1,6 +1,6 @@ // Package domain provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version (devel) DO NOT EDIT. +// Code generated by version DO NOT EDIT. package domain import ( @@ -10,14271 +10,543 @@ import ( "fmt" "io" "io/ioutil" + "mime" "net/http" "net/url" "strings" - "gopkg.in/yaml.v3" - "github.com/deepmap/oapi-codegen/pkg/runtime" - ihttp "github.com/influxdata/influxdb-client-go/v2/api/http" + "github.com/pkg/errors" ) +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HTTPRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + // Client which conforms to the OpenAPI3 specification for this service. type Client struct { - service ihttp.Service + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Server + /api/v2/ + APIEndpoint string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HTTPRequestDoer } // Creates a new Client, with reasonable defaults -func NewClient(service ihttp.Service) *Client { +func NewClient(server string, doer HTTPRequestDoer) (*Client, error) { // create a client with sane default values client := Client{ - service: service, + Server: server, + Client: doer, + } + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" + } + // API endpoint + client.APIEndpoint = client.Server + "api/v2/" + + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} } - return &client + return &client, nil } -// The interface specification for the client above. -type ClientInterface interface { - // GetRoutes request - GetRoutes(ctx context.Context, params *GetRoutesParams) (*http.Response, error) +func (e *Error) Error() error { + return fmt.Errorf("%s: %s", string(e.Code), *e.Message) +} - // GetAuthorizations request - GetAuthorizations(ctx context.Context, params *GetAuthorizationsParams) (*http.Response, error) +func unmarshalJSONResponse(bodyBytes []byte, obj interface{}) error { + if err := json.Unmarshal(bodyBytes, obj); err != nil { + return err + } + return nil +} - // PostAuthorizations request with any body - PostAuthorizationsWithBody(ctx context.Context, params *PostAuthorizationsParams, contentType string, body io.Reader) (*http.Response, error) +func isJSON(rsp *http.Response) bool { + ctype, _, _ := mime.ParseMediaType(rsp.Header.Get("Content-Type")) + return ctype == "application/json" +} - PostAuthorizations(ctx context.Context, params *PostAuthorizationsParams, body PostAuthorizationsJSONRequestBody) (*http.Response, error) +func decodeError(body []byte, rsp *http.Response) error { + if isJSON(rsp) { + var serverError Error + err := json.Unmarshal(body, &serverError) + if err != nil { + message := fmt.Sprintf("cannot decode error response: %v", err) + serverError.Message = &message + } + if serverError.Message == nil && serverError.Code == "" { + serverError.Message = &rsp.Status + } + return serverError.Error() + } else { + message := rsp.Status + if len(body) > 0 { + message = message + ": " + string(body) + } + return errors.New(message) + } +} - // DeleteAuthorizationsID request - DeleteAuthorizationsID(ctx context.Context, authID string, params *DeleteAuthorizationsIDParams) (*http.Response, error) +// GetAuthorizations calls the GET on /authorizations +// List authorizations +func (c *Client) GetAuthorizations(ctx context.Context, params *GetAuthorizationsParams) (*Authorizations, error) { + var err error - // GetAuthorizationsID request - GetAuthorizationsID(ctx context.Context, authID string, params *GetAuthorizationsIDParams) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // PatchAuthorizationsID request with any body - PatchAuthorizationsIDWithBody(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, contentType string, body io.Reader) (*http.Response, error) + operationPath := fmt.Sprintf("./authorizations") - PatchAuthorizationsID(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, body PatchAuthorizationsIDJSONRequestBody) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // GetBackupKV request - GetBackupKV(ctx context.Context, params *GetBackupKVParams) (*http.Response, error) + queryValues := queryURL.Query() - // GetBackupMetadata request - GetBackupMetadata(ctx context.Context, params *GetBackupMetadataParams) (*http.Response, error) + if params.UserID != nil { - // GetBackupShardId request - GetBackupShardId(ctx context.Context, shardID int64, params *GetBackupShardIdParams) (*http.Response, error) + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "userID", runtime.ParamLocationQuery, *params.UserID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - // GetBuckets request - GetBuckets(ctx context.Context, params *GetBucketsParams) (*http.Response, error) + } - // PostBuckets request with any body - PostBucketsWithBody(ctx context.Context, params *PostBucketsParams, contentType string, body io.Reader) (*http.Response, error) + if params.User != nil { - PostBuckets(ctx context.Context, params *PostBucketsParams, body PostBucketsJSONRequestBody) (*http.Response, error) + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user", runtime.ParamLocationQuery, *params.User); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - // DeleteBucketsID request - DeleteBucketsID(ctx context.Context, bucketID string, params *DeleteBucketsIDParams) (*http.Response, error) + } - // GetBucketsID request - GetBucketsID(ctx context.Context, bucketID string, params *GetBucketsIDParams) (*http.Response, error) + if params.OrgID != nil { - // PatchBucketsID request with any body - PatchBucketsIDWithBody(ctx context.Context, bucketID string, params *PatchBucketsIDParams, contentType string, body io.Reader) (*http.Response, error) + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - PatchBucketsID(ctx context.Context, bucketID string, params *PatchBucketsIDParams, body PatchBucketsIDJSONRequestBody) (*http.Response, error) + } - // GetBucketsIDLabels request - GetBucketsIDLabels(ctx context.Context, bucketID string, params *GetBucketsIDLabelsParams) (*http.Response, error) + if params.Org != nil { - // PostBucketsIDLabels request with any body - PostBucketsIDLabelsWithBody(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - PostBucketsIDLabels(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, body PostBucketsIDLabelsJSONRequestBody) (*http.Response, error) + } - // DeleteBucketsIDLabelsID request - DeleteBucketsIDLabelsID(ctx context.Context, bucketID string, labelID string, params *DeleteBucketsIDLabelsIDParams) (*http.Response, error) + queryURL.RawQuery = queryValues.Encode() - // GetBucketsIDMembers request - GetBucketsIDMembers(ctx context.Context, bucketID string, params *GetBucketsIDMembersParams) (*http.Response, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - // PostBucketsIDMembers request with any body - PostBucketsIDMembersWithBody(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - PostBucketsIDMembers(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, body PostBucketsIDMembersJSONRequestBody) (*http.Response, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // DeleteBucketsIDMembersID request - DeleteBucketsIDMembersID(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDMembersIDParams) (*http.Response, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // GetBucketsIDOwners request - GetBucketsIDOwners(ctx context.Context, bucketID string, params *GetBucketsIDOwnersParams) (*http.Response, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // PostBucketsIDOwners request with any body - PostBucketsIDOwnersWithBody(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - PostBucketsIDOwners(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, body PostBucketsIDOwnersJSONRequestBody) (*http.Response, error) + response := &Authorizations{} - // DeleteBucketsIDOwnersID request - DeleteBucketsIDOwnersID(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDOwnersIDParams) (*http.Response, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // GetChecks request - GetChecks(ctx context.Context, params *GetChecksParams) (*http.Response, error) +} - // CreateCheck request with any body - CreateCheckWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) +// PostAuthorizations calls the POST on /authorizations +// Create an authorization +func (c *Client) PostAuthorizations(ctx context.Context, params *PostAuthorizationsAllParams) (*Authorization, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - CreateCheck(ctx context.Context, body CreateCheckJSONRequestBody) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // DeleteChecksID request - DeleteChecksID(ctx context.Context, checkID string, params *DeleteChecksIDParams) (*http.Response, error) + operationPath := fmt.Sprintf("./authorizations") - // GetChecksID request - GetChecksID(ctx context.Context, checkID string, params *GetChecksIDParams) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // PatchChecksID request with any body - PatchChecksIDWithBody(ctx context.Context, checkID string, params *PatchChecksIDParams, contentType string, body io.Reader) (*http.Response, error) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - PatchChecksID(ctx context.Context, checkID string, params *PatchChecksIDParams, body PatchChecksIDJSONRequestBody) (*http.Response, error) + req.Header.Add("Content-Type", "application/json") - // PutChecksID request with any body - PutChecksIDWithBody(ctx context.Context, checkID string, params *PutChecksIDParams, contentType string, body io.Reader) (*http.Response, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - PutChecksID(ctx context.Context, checkID string, params *PutChecksIDParams, body PutChecksIDJSONRequestBody) (*http.Response, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // GetChecksIDLabels request - GetChecksIDLabels(ctx context.Context, checkID string, params *GetChecksIDLabelsParams) (*http.Response, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // PostChecksIDLabels request with any body - PostChecksIDLabelsWithBody(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - PostChecksIDLabels(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, body PostChecksIDLabelsJSONRequestBody) (*http.Response, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // DeleteChecksIDLabelsID request - DeleteChecksIDLabelsID(ctx context.Context, checkID string, labelID string, params *DeleteChecksIDLabelsIDParams) (*http.Response, error) + response := &Authorization{} - // GetChecksIDQuery request - GetChecksIDQuery(ctx context.Context, checkID string, params *GetChecksIDQueryParams) (*http.Response, error) + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // GetConfig request - GetConfig(ctx context.Context, params *GetConfigParams) (*http.Response, error) +} - // GetDashboards request - GetDashboards(ctx context.Context, params *GetDashboardsParams) (*http.Response, error) +// DeleteAuthorizationsID calls the DELETE on /authorizations/{authID} +// Delete an authorization +func (c *Client) DeleteAuthorizationsID(ctx context.Context, params *DeleteAuthorizationsIDAllParams) error { + var err error - // PostDashboards request with any body - PostDashboardsWithBody(ctx context.Context, params *PostDashboardsParams, contentType string, body io.Reader) (*http.Response, error) + var pathParam0 string - PostDashboards(ctx context.Context, params *PostDashboardsParams, body PostDashboardsJSONRequestBody) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, params.AuthID) + if err != nil { + return err + } - // DeleteDashboardsID request - DeleteDashboardsID(ctx context.Context, dashboardID string, params *DeleteDashboardsIDParams) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err + } - // GetDashboardsID request - GetDashboardsID(ctx context.Context, dashboardID string, params *GetDashboardsIDParams) (*http.Response, error) + operationPath := fmt.Sprintf("./authorizations/%s", pathParam0) - // PatchDashboardsID request with any body - PatchDashboardsIDWithBody(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, contentType string, body io.Reader) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - PatchDashboardsID(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, body PatchDashboardsIDJSONRequestBody) (*http.Response, error) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err + } - // PostDashboardsIDCells request with any body - PostDashboardsIDCellsWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Response, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - PostDashboardsIDCells(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, body PostDashboardsIDCellsJSONRequestBody) (*http.Response, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } - // PutDashboardsIDCells request with any body - PutDashboardsIDCellsWithBody(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Response, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PutDashboardsIDCells(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, body PutDashboardsIDCellsJSONRequestBody) (*http.Response, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - // DeleteDashboardsIDCellsID request - DeleteDashboardsIDCellsID(ctx context.Context, dashboardID string, cellID string, params *DeleteDashboardsIDCellsIDParams) (*http.Response, error) + defer func() { _ = rsp.Body.Close() }() - // PatchDashboardsIDCellsID request with any body - PatchDashboardsIDCellsIDWithBody(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, contentType string, body io.Reader) (*http.Response, error) + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil - PatchDashboardsIDCellsID(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, body PatchDashboardsIDCellsIDJSONRequestBody) (*http.Response, error) +} - // GetDashboardsIDCellsIDView request - GetDashboardsIDCellsIDView(ctx context.Context, dashboardID string, cellID string, params *GetDashboardsIDCellsIDViewParams) (*http.Response, error) +// GetAuthorizationsID calls the GET on /authorizations/{authID} +// Retrieve an authorization +func (c *Client) GetAuthorizationsID(ctx context.Context, params *GetAuthorizationsIDAllParams) (*Authorization, error) { + var err error - // PatchDashboardsIDCellsIDView request with any body - PatchDashboardsIDCellsIDViewWithBody(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, contentType string, body io.Reader) (*http.Response, error) + var pathParam0 string - PatchDashboardsIDCellsIDView(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, body PatchDashboardsIDCellsIDViewJSONRequestBody) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, params.AuthID) + if err != nil { + return nil, err + } - // GetDashboardsIDLabels request - GetDashboardsIDLabels(ctx context.Context, dashboardID string, params *GetDashboardsIDLabelsParams) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // PostDashboardsIDLabels request with any body - PostDashboardsIDLabelsWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) + operationPath := fmt.Sprintf("./authorizations/%s", pathParam0) - PostDashboardsIDLabels(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, body PostDashboardsIDLabelsJSONRequestBody) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // DeleteDashboardsIDLabelsID request - DeleteDashboardsIDLabelsID(ctx context.Context, dashboardID string, labelID string, params *DeleteDashboardsIDLabelsIDParams) (*http.Response, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - // GetDashboardsIDMembers request - GetDashboardsIDMembers(ctx context.Context, dashboardID string, params *GetDashboardsIDMembersParams) (*http.Response, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // PostDashboardsIDMembers request with any body - PostDashboardsIDMembersWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - PostDashboardsIDMembers(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, body PostDashboardsIDMembersJSONRequestBody) (*http.Response, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // DeleteDashboardsIDMembersID request - DeleteDashboardsIDMembersID(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDMembersIDParams) (*http.Response, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // GetDashboardsIDOwners request - GetDashboardsIDOwners(ctx context.Context, dashboardID string, params *GetDashboardsIDOwnersParams) (*http.Response, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // PostDashboardsIDOwners request with any body - PostDashboardsIDOwnersWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) + response := &Authorization{} - PostDashboardsIDOwners(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, body PostDashboardsIDOwnersJSONRequestBody) (*http.Response, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // DeleteDashboardsIDOwnersID request - DeleteDashboardsIDOwnersID(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDOwnersIDParams) (*http.Response, error) +} - // GetDBRPs request - GetDBRPs(ctx context.Context, params *GetDBRPsParams) (*http.Response, error) +// PatchAuthorizationsID calls the PATCH on /authorizations/{authID} +// Update an authorization to be active or inactive +func (c *Client) PatchAuthorizationsID(ctx context.Context, params *PatchAuthorizationsIDAllParams) (*Authorization, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // PostDBRP request with any body - PostDBRPWithBody(ctx context.Context, params *PostDBRPParams, contentType string, body io.Reader) (*http.Response, error) + var pathParam0 string - PostDBRP(ctx context.Context, params *PostDBRPParams, body PostDBRPJSONRequestBody) (*http.Response, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, params.AuthID) + if err != nil { + return nil, err + } - // DeleteDBRPID request - DeleteDBRPID(ctx context.Context, dbrpID string, params *DeleteDBRPIDParams) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // GetDBRPsID request - GetDBRPsID(ctx context.Context, dbrpID string, params *GetDBRPsIDParams) (*http.Response, error) + operationPath := fmt.Sprintf("./authorizations/%s", pathParam0) - // PatchDBRPID request with any body - PatchDBRPIDWithBody(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, contentType string, body io.Reader) (*http.Response, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - PatchDBRPID(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, body PatchDBRPIDJSONRequestBody) (*http.Response, error) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // PostDelete request with any body - PostDeleteWithBody(ctx context.Context, params *PostDeleteParams, contentType string, body io.Reader) (*http.Response, error) + req.Header.Add("Content-Type", "application/json") - PostDelete(ctx context.Context, params *PostDeleteParams, body PostDeleteJSONRequestBody) (*http.Response, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetFlags request - GetFlags(ctx context.Context, params *GetFlagsParams) (*http.Response, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // GetHealth request - GetHealth(ctx context.Context, params *GetHealthParams) (*http.Response, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // GetLabels request - GetLabels(ctx context.Context, params *GetLabelsParams) (*http.Response, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // PostLabels request with any body - PostLabelsWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - PostLabels(ctx context.Context, body PostLabelsJSONRequestBody) (*http.Response, error) + response := &Authorization{} - // DeleteLabelsID request - DeleteLabelsID(ctx context.Context, labelID string, params *DeleteLabelsIDParams) (*http.Response, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // GetLabelsID request - GetLabelsID(ctx context.Context, labelID string, params *GetLabelsIDParams) (*http.Response, error) +} - // PatchLabelsID request with any body - PatchLabelsIDWithBody(ctx context.Context, labelID string, params *PatchLabelsIDParams, contentType string, body io.Reader) (*http.Response, error) +// GetBuckets calls the GET on /buckets +// List buckets +func (c *Client) GetBuckets(ctx context.Context, params *GetBucketsParams) (*Buckets, error) { + var err error - PatchLabelsID(ctx context.Context, labelID string, params *PatchLabelsIDParams, body PatchLabelsIDJSONRequestBody) (*http.Response, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // GetLegacyAuthorizations request - GetLegacyAuthorizations(ctx context.Context, params *GetLegacyAuthorizationsParams) (*http.Response, error) - - // PostLegacyAuthorizations request with any body - PostLegacyAuthorizationsWithBody(ctx context.Context, params *PostLegacyAuthorizationsParams, contentType string, body io.Reader) (*http.Response, error) - - PostLegacyAuthorizations(ctx context.Context, params *PostLegacyAuthorizationsParams, body PostLegacyAuthorizationsJSONRequestBody) (*http.Response, error) - - // DeleteLegacyAuthorizationsID request - DeleteLegacyAuthorizationsID(ctx context.Context, authID string, params *DeleteLegacyAuthorizationsIDParams) (*http.Response, error) - - // GetLegacyAuthorizationsID request - GetLegacyAuthorizationsID(ctx context.Context, authID string, params *GetLegacyAuthorizationsIDParams) (*http.Response, error) - - // PatchLegacyAuthorizationsID request with any body - PatchLegacyAuthorizationsIDWithBody(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchLegacyAuthorizationsID(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, body PatchLegacyAuthorizationsIDJSONRequestBody) (*http.Response, error) - - // PostLegacyAuthorizationsIDPassword request with any body - PostLegacyAuthorizationsIDPasswordWithBody(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, contentType string, body io.Reader) (*http.Response, error) - - PostLegacyAuthorizationsIDPassword(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, body PostLegacyAuthorizationsIDPasswordJSONRequestBody) (*http.Response, error) - - // GetMe request - GetMe(ctx context.Context, params *GetMeParams) (*http.Response, error) - - // PutMePassword request with any body - PutMePasswordWithBody(ctx context.Context, params *PutMePasswordParams, contentType string, body io.Reader) (*http.Response, error) - - PutMePassword(ctx context.Context, params *PutMePasswordParams, body PutMePasswordJSONRequestBody) (*http.Response, error) - - // GetMetrics request - GetMetrics(ctx context.Context, params *GetMetricsParams) (*http.Response, error) - - // GetNotificationEndpoints request - GetNotificationEndpoints(ctx context.Context, params *GetNotificationEndpointsParams) (*http.Response, error) - - // CreateNotificationEndpoint request with any body - CreateNotificationEndpointWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - CreateNotificationEndpoint(ctx context.Context, body CreateNotificationEndpointJSONRequestBody) (*http.Response, error) - - // DeleteNotificationEndpointsID request - DeleteNotificationEndpointsID(ctx context.Context, endpointID string, params *DeleteNotificationEndpointsIDParams) (*http.Response, error) - - // GetNotificationEndpointsID request - GetNotificationEndpointsID(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDParams) (*http.Response, error) - - // PatchNotificationEndpointsID request with any body - PatchNotificationEndpointsIDWithBody(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchNotificationEndpointsID(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, body PatchNotificationEndpointsIDJSONRequestBody) (*http.Response, error) - - // PutNotificationEndpointsID request with any body - PutNotificationEndpointsIDWithBody(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Response, error) - - PutNotificationEndpointsID(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, body PutNotificationEndpointsIDJSONRequestBody) (*http.Response, error) - - // GetNotificationEndpointsIDLabels request - GetNotificationEndpointsIDLabels(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDLabelsParams) (*http.Response, error) - - // PostNotificationEndpointIDLabels request with any body - PostNotificationEndpointIDLabelsWithBody(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostNotificationEndpointIDLabels(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, body PostNotificationEndpointIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteNotificationEndpointsIDLabelsID request - DeleteNotificationEndpointsIDLabelsID(ctx context.Context, endpointID string, labelID string, params *DeleteNotificationEndpointsIDLabelsIDParams) (*http.Response, error) - - // GetNotificationRules request - GetNotificationRules(ctx context.Context, params *GetNotificationRulesParams) (*http.Response, error) - - // CreateNotificationRule request with any body - CreateNotificationRuleWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - CreateNotificationRule(ctx context.Context, body CreateNotificationRuleJSONRequestBody) (*http.Response, error) - - // DeleteNotificationRulesID request - DeleteNotificationRulesID(ctx context.Context, ruleID string, params *DeleteNotificationRulesIDParams) (*http.Response, error) - - // GetNotificationRulesID request - GetNotificationRulesID(ctx context.Context, ruleID string, params *GetNotificationRulesIDParams) (*http.Response, error) - - // PatchNotificationRulesID request with any body - PatchNotificationRulesIDWithBody(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchNotificationRulesID(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, body PatchNotificationRulesIDJSONRequestBody) (*http.Response, error) - - // PutNotificationRulesID request with any body - PutNotificationRulesIDWithBody(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, contentType string, body io.Reader) (*http.Response, error) - - PutNotificationRulesID(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, body PutNotificationRulesIDJSONRequestBody) (*http.Response, error) - - // GetNotificationRulesIDLabels request - GetNotificationRulesIDLabels(ctx context.Context, ruleID string, params *GetNotificationRulesIDLabelsParams) (*http.Response, error) - - // PostNotificationRuleIDLabels request with any body - PostNotificationRuleIDLabelsWithBody(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostNotificationRuleIDLabels(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, body PostNotificationRuleIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteNotificationRulesIDLabelsID request - DeleteNotificationRulesIDLabelsID(ctx context.Context, ruleID string, labelID string, params *DeleteNotificationRulesIDLabelsIDParams) (*http.Response, error) - - // GetNotificationRulesIDQuery request - GetNotificationRulesIDQuery(ctx context.Context, ruleID string, params *GetNotificationRulesIDQueryParams) (*http.Response, error) - - // GetOrgs request - GetOrgs(ctx context.Context, params *GetOrgsParams) (*http.Response, error) - - // PostOrgs request with any body - PostOrgsWithBody(ctx context.Context, params *PostOrgsParams, contentType string, body io.Reader) (*http.Response, error) - - PostOrgs(ctx context.Context, params *PostOrgsParams, body PostOrgsJSONRequestBody) (*http.Response, error) - - // DeleteOrgsID request - DeleteOrgsID(ctx context.Context, orgID string, params *DeleteOrgsIDParams) (*http.Response, error) - - // GetOrgsID request - GetOrgsID(ctx context.Context, orgID string, params *GetOrgsIDParams) (*http.Response, error) - - // PatchOrgsID request with any body - PatchOrgsIDWithBody(ctx context.Context, orgID string, params *PatchOrgsIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchOrgsID(ctx context.Context, orgID string, params *PatchOrgsIDParams, body PatchOrgsIDJSONRequestBody) (*http.Response, error) - - // GetOrgsIDMembers request - GetOrgsIDMembers(ctx context.Context, orgID string, params *GetOrgsIDMembersParams) (*http.Response, error) - - // PostOrgsIDMembers request with any body - PostOrgsIDMembersWithBody(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) - - PostOrgsIDMembers(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, body PostOrgsIDMembersJSONRequestBody) (*http.Response, error) - - // DeleteOrgsIDMembersID request - DeleteOrgsIDMembersID(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDMembersIDParams) (*http.Response, error) - - // GetOrgsIDOwners request - GetOrgsIDOwners(ctx context.Context, orgID string, params *GetOrgsIDOwnersParams) (*http.Response, error) - - // PostOrgsIDOwners request with any body - PostOrgsIDOwnersWithBody(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) - - PostOrgsIDOwners(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, body PostOrgsIDOwnersJSONRequestBody) (*http.Response, error) - - // DeleteOrgsIDOwnersID request - DeleteOrgsIDOwnersID(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDOwnersIDParams) (*http.Response, error) - - // GetOrgsIDSecrets request - GetOrgsIDSecrets(ctx context.Context, orgID string, params *GetOrgsIDSecretsParams) (*http.Response, error) - - // PatchOrgsIDSecrets request with any body - PatchOrgsIDSecretsWithBody(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Response, error) - - PatchOrgsIDSecrets(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, body PatchOrgsIDSecretsJSONRequestBody) (*http.Response, error) - - // PostOrgsIDSecrets request with any body - PostOrgsIDSecretsWithBody(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Response, error) - - PostOrgsIDSecrets(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, body PostOrgsIDSecretsJSONRequestBody) (*http.Response, error) - - // DeleteOrgsIDSecretsID request - DeleteOrgsIDSecretsID(ctx context.Context, orgID string, secretID string, params *DeleteOrgsIDSecretsIDParams) (*http.Response, error) - - // GetPing request - GetPing(ctx context.Context) (*http.Response, error) - - // HeadPing request - HeadPing(ctx context.Context) (*http.Response, error) - - // PostQuery request with any body - PostQueryWithBody(ctx context.Context, params *PostQueryParams, contentType string, body io.Reader) (*http.Response, error) - - PostQuery(ctx context.Context, params *PostQueryParams, body PostQueryJSONRequestBody) (*http.Response, error) - - // PostQueryAnalyze request with any body - PostQueryAnalyzeWithBody(ctx context.Context, params *PostQueryAnalyzeParams, contentType string, body io.Reader) (*http.Response, error) - - PostQueryAnalyze(ctx context.Context, params *PostQueryAnalyzeParams, body PostQueryAnalyzeJSONRequestBody) (*http.Response, error) - - // PostQueryAst request with any body - PostQueryAstWithBody(ctx context.Context, params *PostQueryAstParams, contentType string, body io.Reader) (*http.Response, error) - - PostQueryAst(ctx context.Context, params *PostQueryAstParams, body PostQueryAstJSONRequestBody) (*http.Response, error) - - // GetQuerySuggestions request - GetQuerySuggestions(ctx context.Context, params *GetQuerySuggestionsParams) (*http.Response, error) - - // GetQuerySuggestionsName request - GetQuerySuggestionsName(ctx context.Context, name string, params *GetQuerySuggestionsNameParams) (*http.Response, error) - - // GetReady request - GetReady(ctx context.Context, params *GetReadyParams) (*http.Response, error) - - // GetRemoteConnections request - GetRemoteConnections(ctx context.Context, params *GetRemoteConnectionsParams) (*http.Response, error) - - // PostRemoteConnection request with any body - PostRemoteConnectionWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - PostRemoteConnection(ctx context.Context, body PostRemoteConnectionJSONRequestBody) (*http.Response, error) - - // DeleteRemoteConnectionByID request - DeleteRemoteConnectionByID(ctx context.Context, remoteID string, params *DeleteRemoteConnectionByIDParams) (*http.Response, error) - - // GetRemoteConnectionByID request - GetRemoteConnectionByID(ctx context.Context, remoteID string, params *GetRemoteConnectionByIDParams) (*http.Response, error) - - // PatchRemoteConnectionByID request with any body - PatchRemoteConnectionByIDWithBody(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchRemoteConnectionByID(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, body PatchRemoteConnectionByIDJSONRequestBody) (*http.Response, error) - - // GetReplications request - GetReplications(ctx context.Context, params *GetReplicationsParams) (*http.Response, error) - - // PostReplication request with any body - PostReplicationWithBody(ctx context.Context, params *PostReplicationParams, contentType string, body io.Reader) (*http.Response, error) - - PostReplication(ctx context.Context, params *PostReplicationParams, body PostReplicationJSONRequestBody) (*http.Response, error) - - // DeleteReplicationByID request - DeleteReplicationByID(ctx context.Context, replicationID string, params *DeleteReplicationByIDParams) (*http.Response, error) - - // GetReplicationByID request - GetReplicationByID(ctx context.Context, replicationID string, params *GetReplicationByIDParams) (*http.Response, error) - - // PatchReplicationByID request with any body - PatchReplicationByIDWithBody(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchReplicationByID(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, body PatchReplicationByIDJSONRequestBody) (*http.Response, error) - - // PostValidateReplicationByID request - PostValidateReplicationByID(ctx context.Context, replicationID string, params *PostValidateReplicationByIDParams) (*http.Response, error) - - // GetResources request - GetResources(ctx context.Context, params *GetResourcesParams) (*http.Response, error) - - // PostRestoreBucketID request with any body - PostRestoreBucketIDWithBody(ctx context.Context, bucketID string, params *PostRestoreBucketIDParams, contentType string, body io.Reader) (*http.Response, error) - - // PostRestoreBucketMetadata request with any body - PostRestoreBucketMetadataWithBody(ctx context.Context, params *PostRestoreBucketMetadataParams, contentType string, body io.Reader) (*http.Response, error) - - PostRestoreBucketMetadata(ctx context.Context, params *PostRestoreBucketMetadataParams, body PostRestoreBucketMetadataJSONRequestBody) (*http.Response, error) - - // PostRestoreKV request with any body - PostRestoreKVWithBody(ctx context.Context, params *PostRestoreKVParams, contentType string, body io.Reader) (*http.Response, error) - - // PostRestoreShardId request with any body - PostRestoreShardIdWithBody(ctx context.Context, shardID string, params *PostRestoreShardIdParams, contentType string, body io.Reader) (*http.Response, error) - - // PostRestoreSQL request with any body - PostRestoreSQLWithBody(ctx context.Context, params *PostRestoreSQLParams, contentType string, body io.Reader) (*http.Response, error) - - // GetScrapers request - GetScrapers(ctx context.Context, params *GetScrapersParams) (*http.Response, error) - - // PostScrapers request with any body - PostScrapersWithBody(ctx context.Context, params *PostScrapersParams, contentType string, body io.Reader) (*http.Response, error) - - PostScrapers(ctx context.Context, params *PostScrapersParams, body PostScrapersJSONRequestBody) (*http.Response, error) - - // DeleteScrapersID request - DeleteScrapersID(ctx context.Context, scraperTargetID string, params *DeleteScrapersIDParams) (*http.Response, error) - - // GetScrapersID request - GetScrapersID(ctx context.Context, scraperTargetID string, params *GetScrapersIDParams) (*http.Response, error) - - // PatchScrapersID request with any body - PatchScrapersIDWithBody(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchScrapersID(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, body PatchScrapersIDJSONRequestBody) (*http.Response, error) - - // GetScrapersIDLabels request - GetScrapersIDLabels(ctx context.Context, scraperTargetID string, params *GetScrapersIDLabelsParams) (*http.Response, error) - - // PostScrapersIDLabels request with any body - PostScrapersIDLabelsWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostScrapersIDLabels(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, body PostScrapersIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteScrapersIDLabelsID request - DeleteScrapersIDLabelsID(ctx context.Context, scraperTargetID string, labelID string, params *DeleteScrapersIDLabelsIDParams) (*http.Response, error) - - // GetScrapersIDMembers request - GetScrapersIDMembers(ctx context.Context, scraperTargetID string, params *GetScrapersIDMembersParams) (*http.Response, error) - - // PostScrapersIDMembers request with any body - PostScrapersIDMembersWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, contentType string, body io.Reader) (*http.Response, error) - - PostScrapersIDMembers(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, body PostScrapersIDMembersJSONRequestBody) (*http.Response, error) - - // DeleteScrapersIDMembersID request - DeleteScrapersIDMembersID(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDMembersIDParams) (*http.Response, error) - - // GetScrapersIDOwners request - GetScrapersIDOwners(ctx context.Context, scraperTargetID string, params *GetScrapersIDOwnersParams) (*http.Response, error) - - // PostScrapersIDOwners request with any body - PostScrapersIDOwnersWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) - - PostScrapersIDOwners(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, body PostScrapersIDOwnersJSONRequestBody) (*http.Response, error) - - // DeleteScrapersIDOwnersID request - DeleteScrapersIDOwnersID(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDOwnersIDParams) (*http.Response, error) - - // GetSetup request - GetSetup(ctx context.Context, params *GetSetupParams) (*http.Response, error) - - // PostSetup request with any body - PostSetupWithBody(ctx context.Context, params *PostSetupParams, contentType string, body io.Reader) (*http.Response, error) - - PostSetup(ctx context.Context, params *PostSetupParams, body PostSetupJSONRequestBody) (*http.Response, error) - - // PostSignin request - PostSignin(ctx context.Context, params *PostSigninParams) (*http.Response, error) - - // PostSignout request - PostSignout(ctx context.Context, params *PostSignoutParams) (*http.Response, error) - - // GetSources request - GetSources(ctx context.Context, params *GetSourcesParams) (*http.Response, error) - - // PostSources request with any body - PostSourcesWithBody(ctx context.Context, params *PostSourcesParams, contentType string, body io.Reader) (*http.Response, error) - - PostSources(ctx context.Context, params *PostSourcesParams, body PostSourcesJSONRequestBody) (*http.Response, error) - - // DeleteSourcesID request - DeleteSourcesID(ctx context.Context, sourceID string, params *DeleteSourcesIDParams) (*http.Response, error) - - // GetSourcesID request - GetSourcesID(ctx context.Context, sourceID string, params *GetSourcesIDParams) (*http.Response, error) - - // PatchSourcesID request with any body - PatchSourcesIDWithBody(ctx context.Context, sourceID string, params *PatchSourcesIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchSourcesID(ctx context.Context, sourceID string, params *PatchSourcesIDParams, body PatchSourcesIDJSONRequestBody) (*http.Response, error) - - // GetSourcesIDBuckets request - GetSourcesIDBuckets(ctx context.Context, sourceID string, params *GetSourcesIDBucketsParams) (*http.Response, error) - - // GetSourcesIDHealth request - GetSourcesIDHealth(ctx context.Context, sourceID string, params *GetSourcesIDHealthParams) (*http.Response, error) - - // ListStacks request - ListStacks(ctx context.Context, params *ListStacksParams) (*http.Response, error) - - // CreateStack request with any body - CreateStackWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - CreateStack(ctx context.Context, body CreateStackJSONRequestBody) (*http.Response, error) - - // DeleteStack request - DeleteStack(ctx context.Context, stackId string, params *DeleteStackParams) (*http.Response, error) - - // ReadStack request - ReadStack(ctx context.Context, stackId string) (*http.Response, error) - - // UpdateStack request with any body - UpdateStackWithBody(ctx context.Context, stackId string, contentType string, body io.Reader) (*http.Response, error) - - UpdateStack(ctx context.Context, stackId string, body UpdateStackJSONRequestBody) (*http.Response, error) - - // UninstallStack request - UninstallStack(ctx context.Context, stackId string) (*http.Response, error) - - // GetTasks request - GetTasks(ctx context.Context, params *GetTasksParams) (*http.Response, error) - - // PostTasks request with any body - PostTasksWithBody(ctx context.Context, params *PostTasksParams, contentType string, body io.Reader) (*http.Response, error) - - PostTasks(ctx context.Context, params *PostTasksParams, body PostTasksJSONRequestBody) (*http.Response, error) - - // DeleteTasksID request - DeleteTasksID(ctx context.Context, taskID string, params *DeleteTasksIDParams) (*http.Response, error) - - // GetTasksID request - GetTasksID(ctx context.Context, taskID string, params *GetTasksIDParams) (*http.Response, error) - - // PatchTasksID request with any body - PatchTasksIDWithBody(ctx context.Context, taskID string, params *PatchTasksIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchTasksID(ctx context.Context, taskID string, params *PatchTasksIDParams, body PatchTasksIDJSONRequestBody) (*http.Response, error) - - // GetTasksIDLabels request - GetTasksIDLabels(ctx context.Context, taskID string, params *GetTasksIDLabelsParams) (*http.Response, error) - - // PostTasksIDLabels request with any body - PostTasksIDLabelsWithBody(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostTasksIDLabels(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, body PostTasksIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteTasksIDLabelsID request - DeleteTasksIDLabelsID(ctx context.Context, taskID string, labelID string, params *DeleteTasksIDLabelsIDParams) (*http.Response, error) - - // GetTasksIDLogs request - GetTasksIDLogs(ctx context.Context, taskID string, params *GetTasksIDLogsParams) (*http.Response, error) - - // GetTasksIDMembers request - GetTasksIDMembers(ctx context.Context, taskID string, params *GetTasksIDMembersParams) (*http.Response, error) - - // PostTasksIDMembers request with any body - PostTasksIDMembersWithBody(ctx context.Context, taskID string, params *PostTasksIDMembersParams, contentType string, body io.Reader) (*http.Response, error) - - PostTasksIDMembers(ctx context.Context, taskID string, params *PostTasksIDMembersParams, body PostTasksIDMembersJSONRequestBody) (*http.Response, error) - - // DeleteTasksIDMembersID request - DeleteTasksIDMembersID(ctx context.Context, taskID string, userID string, params *DeleteTasksIDMembersIDParams) (*http.Response, error) - - // GetTasksIDOwners request - GetTasksIDOwners(ctx context.Context, taskID string, params *GetTasksIDOwnersParams) (*http.Response, error) - - // PostTasksIDOwners request with any body - PostTasksIDOwnersWithBody(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) - - PostTasksIDOwners(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, body PostTasksIDOwnersJSONRequestBody) (*http.Response, error) - - // DeleteTasksIDOwnersID request - DeleteTasksIDOwnersID(ctx context.Context, taskID string, userID string, params *DeleteTasksIDOwnersIDParams) (*http.Response, error) - - // GetTasksIDRuns request - GetTasksIDRuns(ctx context.Context, taskID string, params *GetTasksIDRunsParams) (*http.Response, error) - - // PostTasksIDRuns request with any body - PostTasksIDRunsWithBody(ctx context.Context, taskID string, params *PostTasksIDRunsParams, contentType string, body io.Reader) (*http.Response, error) - - PostTasksIDRuns(ctx context.Context, taskID string, params *PostTasksIDRunsParams, body PostTasksIDRunsJSONRequestBody) (*http.Response, error) - - // DeleteTasksIDRunsID request - DeleteTasksIDRunsID(ctx context.Context, taskID string, runID string, params *DeleteTasksIDRunsIDParams) (*http.Response, error) - - // GetTasksIDRunsID request - GetTasksIDRunsID(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDParams) (*http.Response, error) - - // GetTasksIDRunsIDLogs request - GetTasksIDRunsIDLogs(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDLogsParams) (*http.Response, error) - - // PostTasksIDRunsIDRetry request with any body - PostTasksIDRunsIDRetryWithBody(ctx context.Context, taskID string, runID string, params *PostTasksIDRunsIDRetryParams, contentType string, body io.Reader) (*http.Response, error) - - // GetTelegrafPlugins request - GetTelegrafPlugins(ctx context.Context, params *GetTelegrafPluginsParams) (*http.Response, error) - - // GetTelegrafs request - GetTelegrafs(ctx context.Context, params *GetTelegrafsParams) (*http.Response, error) - - // PostTelegrafs request with any body - PostTelegrafsWithBody(ctx context.Context, params *PostTelegrafsParams, contentType string, body io.Reader) (*http.Response, error) - - PostTelegrafs(ctx context.Context, params *PostTelegrafsParams, body PostTelegrafsJSONRequestBody) (*http.Response, error) - - // DeleteTelegrafsID request - DeleteTelegrafsID(ctx context.Context, telegrafID string, params *DeleteTelegrafsIDParams) (*http.Response, error) - - // GetTelegrafsID request - GetTelegrafsID(ctx context.Context, telegrafID string, params *GetTelegrafsIDParams) (*http.Response, error) - - // PutTelegrafsID request with any body - PutTelegrafsIDWithBody(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, contentType string, body io.Reader) (*http.Response, error) - - PutTelegrafsID(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, body PutTelegrafsIDJSONRequestBody) (*http.Response, error) - - // GetTelegrafsIDLabels request - GetTelegrafsIDLabels(ctx context.Context, telegrafID string, params *GetTelegrafsIDLabelsParams) (*http.Response, error) - - // PostTelegrafsIDLabels request with any body - PostTelegrafsIDLabelsWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostTelegrafsIDLabels(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, body PostTelegrafsIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteTelegrafsIDLabelsID request - DeleteTelegrafsIDLabelsID(ctx context.Context, telegrafID string, labelID string, params *DeleteTelegrafsIDLabelsIDParams) (*http.Response, error) - - // GetTelegrafsIDMembers request - GetTelegrafsIDMembers(ctx context.Context, telegrafID string, params *GetTelegrafsIDMembersParams) (*http.Response, error) - - // PostTelegrafsIDMembers request with any body - PostTelegrafsIDMembersWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) - - PostTelegrafsIDMembers(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, body PostTelegrafsIDMembersJSONRequestBody) (*http.Response, error) - - // DeleteTelegrafsIDMembersID request - DeleteTelegrafsIDMembersID(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDMembersIDParams) (*http.Response, error) - - // GetTelegrafsIDOwners request - GetTelegrafsIDOwners(ctx context.Context, telegrafID string, params *GetTelegrafsIDOwnersParams) (*http.Response, error) - - // PostTelegrafsIDOwners request with any body - PostTelegrafsIDOwnersWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) - - PostTelegrafsIDOwners(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, body PostTelegrafsIDOwnersJSONRequestBody) (*http.Response, error) - - // DeleteTelegrafsIDOwnersID request - DeleteTelegrafsIDOwnersID(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDOwnersIDParams) (*http.Response, error) - - // ApplyTemplate request with any body - ApplyTemplateWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - ApplyTemplate(ctx context.Context, body ApplyTemplateJSONRequestBody) (*http.Response, error) - - // ExportTemplate request with any body - ExportTemplateWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) - - ExportTemplate(ctx context.Context, body ExportTemplateJSONRequestBody) (*http.Response, error) - - // GetUsers request - GetUsers(ctx context.Context, params *GetUsersParams) (*http.Response, error) - - // PostUsers request with any body - PostUsersWithBody(ctx context.Context, params *PostUsersParams, contentType string, body io.Reader) (*http.Response, error) - - PostUsers(ctx context.Context, params *PostUsersParams, body PostUsersJSONRequestBody) (*http.Response, error) - - // DeleteUsersID request - DeleteUsersID(ctx context.Context, userID string, params *DeleteUsersIDParams) (*http.Response, error) - - // GetUsersID request - GetUsersID(ctx context.Context, userID string, params *GetUsersIDParams) (*http.Response, error) - - // PatchUsersID request with any body - PatchUsersIDWithBody(ctx context.Context, userID string, params *PatchUsersIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchUsersID(ctx context.Context, userID string, params *PatchUsersIDParams, body PatchUsersIDJSONRequestBody) (*http.Response, error) - - // PostUsersIDPassword request with any body - PostUsersIDPasswordWithBody(ctx context.Context, userID string, params *PostUsersIDPasswordParams, contentType string, body io.Reader) (*http.Response, error) - - PostUsersIDPassword(ctx context.Context, userID string, params *PostUsersIDPasswordParams, body PostUsersIDPasswordJSONRequestBody) (*http.Response, error) - - // GetVariables request - GetVariables(ctx context.Context, params *GetVariablesParams) (*http.Response, error) - - // PostVariables request with any body - PostVariablesWithBody(ctx context.Context, params *PostVariablesParams, contentType string, body io.Reader) (*http.Response, error) - - PostVariables(ctx context.Context, params *PostVariablesParams, body PostVariablesJSONRequestBody) (*http.Response, error) - - // DeleteVariablesID request - DeleteVariablesID(ctx context.Context, variableID string, params *DeleteVariablesIDParams) (*http.Response, error) - - // GetVariablesID request - GetVariablesID(ctx context.Context, variableID string, params *GetVariablesIDParams) (*http.Response, error) - - // PatchVariablesID request with any body - PatchVariablesIDWithBody(ctx context.Context, variableID string, params *PatchVariablesIDParams, contentType string, body io.Reader) (*http.Response, error) - - PatchVariablesID(ctx context.Context, variableID string, params *PatchVariablesIDParams, body PatchVariablesIDJSONRequestBody) (*http.Response, error) - - // PutVariablesID request with any body - PutVariablesIDWithBody(ctx context.Context, variableID string, params *PutVariablesIDParams, contentType string, body io.Reader) (*http.Response, error) - - PutVariablesID(ctx context.Context, variableID string, params *PutVariablesIDParams, body PutVariablesIDJSONRequestBody) (*http.Response, error) - - // GetVariablesIDLabels request - GetVariablesIDLabels(ctx context.Context, variableID string, params *GetVariablesIDLabelsParams) (*http.Response, error) - - // PostVariablesIDLabels request with any body - PostVariablesIDLabelsWithBody(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) - - PostVariablesIDLabels(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, body PostVariablesIDLabelsJSONRequestBody) (*http.Response, error) - - // DeleteVariablesIDLabelsID request - DeleteVariablesIDLabelsID(ctx context.Context, variableID string, labelID string, params *DeleteVariablesIDLabelsIDParams) (*http.Response, error) - - // PostWrite request with any body - PostWriteWithBody(ctx context.Context, params *PostWriteParams, contentType string, body io.Reader) (*http.Response, error) -} - -func (c *Client) GetRoutes(ctx context.Context, params *GetRoutesParams) (*http.Response, error) { - req, err := NewGetRoutesRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetAuthorizations(ctx context.Context, params *GetAuthorizationsParams) (*http.Response, error) { - req, err := NewGetAuthorizationsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostAuthorizationsWithBody(ctx context.Context, params *PostAuthorizationsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostAuthorizationsRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostAuthorizations(ctx context.Context, params *PostAuthorizationsParams, body PostAuthorizationsJSONRequestBody) (*http.Response, error) { - req, err := NewPostAuthorizationsRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteAuthorizationsID(ctx context.Context, authID string, params *DeleteAuthorizationsIDParams) (*http.Response, error) { - req, err := NewDeleteAuthorizationsIDRequest(c.service.ServerAPIURL(), authID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetAuthorizationsID(ctx context.Context, authID string, params *GetAuthorizationsIDParams) (*http.Response, error) { - req, err := NewGetAuthorizationsIDRequest(c.service.ServerAPIURL(), authID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchAuthorizationsIDWithBody(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchAuthorizationsIDRequestWithBody(c.service.ServerAPIURL(), authID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchAuthorizationsID(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, body PatchAuthorizationsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchAuthorizationsIDRequest(c.service.ServerAPIURL(), authID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBackupKV(ctx context.Context, params *GetBackupKVParams) (*http.Response, error) { - req, err := NewGetBackupKVRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBackupMetadata(ctx context.Context, params *GetBackupMetadataParams) (*http.Response, error) { - req, err := NewGetBackupMetadataRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBackupShardId(ctx context.Context, shardID int64, params *GetBackupShardIdParams) (*http.Response, error) { - req, err := NewGetBackupShardIdRequest(c.service.ServerAPIURL(), shardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBuckets(ctx context.Context, params *GetBucketsParams) (*http.Response, error) { - req, err := NewGetBucketsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsWithBody(ctx context.Context, params *PostBucketsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostBucketsRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBuckets(ctx context.Context, params *PostBucketsParams, body PostBucketsJSONRequestBody) (*http.Response, error) { - req, err := NewPostBucketsRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteBucketsID(ctx context.Context, bucketID string, params *DeleteBucketsIDParams) (*http.Response, error) { - req, err := NewDeleteBucketsIDRequest(c.service.ServerAPIURL(), bucketID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBucketsID(ctx context.Context, bucketID string, params *GetBucketsIDParams) (*http.Response, error) { - req, err := NewGetBucketsIDRequest(c.service.ServerAPIURL(), bucketID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchBucketsIDWithBody(ctx context.Context, bucketID string, params *PatchBucketsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchBucketsIDRequestWithBody(c.service.ServerAPIURL(), bucketID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchBucketsID(ctx context.Context, bucketID string, params *PatchBucketsIDParams, body PatchBucketsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchBucketsIDRequest(c.service.ServerAPIURL(), bucketID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBucketsIDLabels(ctx context.Context, bucketID string, params *GetBucketsIDLabelsParams) (*http.Response, error) { - req, err := NewGetBucketsIDLabelsRequest(c.service.ServerAPIURL(), bucketID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDLabelsWithBody(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostBucketsIDLabelsRequestWithBody(c.service.ServerAPIURL(), bucketID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDLabels(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, body PostBucketsIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostBucketsIDLabelsRequest(c.service.ServerAPIURL(), bucketID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteBucketsIDLabelsID(ctx context.Context, bucketID string, labelID string, params *DeleteBucketsIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteBucketsIDLabelsIDRequest(c.service.ServerAPIURL(), bucketID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBucketsIDMembers(ctx context.Context, bucketID string, params *GetBucketsIDMembersParams) (*http.Response, error) { - req, err := NewGetBucketsIDMembersRequest(c.service.ServerAPIURL(), bucketID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDMembersWithBody(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostBucketsIDMembersRequestWithBody(c.service.ServerAPIURL(), bucketID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDMembers(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, body PostBucketsIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostBucketsIDMembersRequest(c.service.ServerAPIURL(), bucketID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteBucketsIDMembersID(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteBucketsIDMembersIDRequest(c.service.ServerAPIURL(), bucketID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetBucketsIDOwners(ctx context.Context, bucketID string, params *GetBucketsIDOwnersParams) (*http.Response, error) { - req, err := NewGetBucketsIDOwnersRequest(c.service.ServerAPIURL(), bucketID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDOwnersWithBody(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostBucketsIDOwnersRequestWithBody(c.service.ServerAPIURL(), bucketID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostBucketsIDOwners(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, body PostBucketsIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostBucketsIDOwnersRequest(c.service.ServerAPIURL(), bucketID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteBucketsIDOwnersID(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteBucketsIDOwnersIDRequest(c.service.ServerAPIURL(), bucketID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetChecks(ctx context.Context, params *GetChecksParams) (*http.Response, error) { - req, err := NewGetChecksRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateCheckWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewCreateCheckRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateCheck(ctx context.Context, body CreateCheckJSONRequestBody) (*http.Response, error) { - req, err := NewCreateCheckRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteChecksID(ctx context.Context, checkID string, params *DeleteChecksIDParams) (*http.Response, error) { - req, err := NewDeleteChecksIDRequest(c.service.ServerAPIURL(), checkID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetChecksID(ctx context.Context, checkID string, params *GetChecksIDParams) (*http.Response, error) { - req, err := NewGetChecksIDRequest(c.service.ServerAPIURL(), checkID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchChecksIDWithBody(ctx context.Context, checkID string, params *PatchChecksIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchChecksIDRequestWithBody(c.service.ServerAPIURL(), checkID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchChecksID(ctx context.Context, checkID string, params *PatchChecksIDParams, body PatchChecksIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchChecksIDRequest(c.service.ServerAPIURL(), checkID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutChecksIDWithBody(ctx context.Context, checkID string, params *PutChecksIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutChecksIDRequestWithBody(c.service.ServerAPIURL(), checkID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutChecksID(ctx context.Context, checkID string, params *PutChecksIDParams, body PutChecksIDJSONRequestBody) (*http.Response, error) { - req, err := NewPutChecksIDRequest(c.service.ServerAPIURL(), checkID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetChecksIDLabels(ctx context.Context, checkID string, params *GetChecksIDLabelsParams) (*http.Response, error) { - req, err := NewGetChecksIDLabelsRequest(c.service.ServerAPIURL(), checkID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostChecksIDLabelsWithBody(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostChecksIDLabelsRequestWithBody(c.service.ServerAPIURL(), checkID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostChecksIDLabels(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, body PostChecksIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostChecksIDLabelsRequest(c.service.ServerAPIURL(), checkID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteChecksIDLabelsID(ctx context.Context, checkID string, labelID string, params *DeleteChecksIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteChecksIDLabelsIDRequest(c.service.ServerAPIURL(), checkID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetChecksIDQuery(ctx context.Context, checkID string, params *GetChecksIDQueryParams) (*http.Response, error) { - req, err := NewGetChecksIDQueryRequest(c.service.ServerAPIURL(), checkID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetConfig(ctx context.Context, params *GetConfigParams) (*http.Response, error) { - req, err := NewGetConfigRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboards(ctx context.Context, params *GetDashboardsParams) (*http.Response, error) { - req, err := NewGetDashboardsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsWithBody(ctx context.Context, params *PostDashboardsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDashboardsRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboards(ctx context.Context, params *PostDashboardsParams, body PostDashboardsJSONRequestBody) (*http.Response, error) { - req, err := NewPostDashboardsRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDashboardsID(ctx context.Context, dashboardID string, params *DeleteDashboardsIDParams) (*http.Response, error) { - req, err := NewDeleteDashboardsIDRequest(c.service.ServerAPIURL(), dashboardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboardsID(ctx context.Context, dashboardID string, params *GetDashboardsIDParams) (*http.Response, error) { - req, err := NewGetDashboardsIDRequest(c.service.ServerAPIURL(), dashboardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsIDWithBody(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchDashboardsIDRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsID(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, body PatchDashboardsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchDashboardsIDRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDCellsWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDashboardsIDCellsRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDCells(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, body PostDashboardsIDCellsJSONRequestBody) (*http.Response, error) { - req, err := NewPostDashboardsIDCellsRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutDashboardsIDCellsWithBody(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutDashboardsIDCellsRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutDashboardsIDCells(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, body PutDashboardsIDCellsJSONRequestBody) (*http.Response, error) { - req, err := NewPutDashboardsIDCellsRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDashboardsIDCellsID(ctx context.Context, dashboardID string, cellID string, params *DeleteDashboardsIDCellsIDParams) (*http.Response, error) { - req, err := NewDeleteDashboardsIDCellsIDRequest(c.service.ServerAPIURL(), dashboardID, cellID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsIDCellsIDWithBody(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchDashboardsIDCellsIDRequestWithBody(c.service.ServerAPIURL(), dashboardID, cellID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsIDCellsID(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, body PatchDashboardsIDCellsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchDashboardsIDCellsIDRequest(c.service.ServerAPIURL(), dashboardID, cellID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboardsIDCellsIDView(ctx context.Context, dashboardID string, cellID string, params *GetDashboardsIDCellsIDViewParams) (*http.Response, error) { - req, err := NewGetDashboardsIDCellsIDViewRequest(c.service.ServerAPIURL(), dashboardID, cellID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsIDCellsIDViewWithBody(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchDashboardsIDCellsIDViewRequestWithBody(c.service.ServerAPIURL(), dashboardID, cellID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDashboardsIDCellsIDView(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, body PatchDashboardsIDCellsIDViewJSONRequestBody) (*http.Response, error) { - req, err := NewPatchDashboardsIDCellsIDViewRequest(c.service.ServerAPIURL(), dashboardID, cellID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboardsIDLabels(ctx context.Context, dashboardID string, params *GetDashboardsIDLabelsParams) (*http.Response, error) { - req, err := NewGetDashboardsIDLabelsRequest(c.service.ServerAPIURL(), dashboardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDLabelsWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDashboardsIDLabelsRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDLabels(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, body PostDashboardsIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostDashboardsIDLabelsRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDashboardsIDLabelsID(ctx context.Context, dashboardID string, labelID string, params *DeleteDashboardsIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteDashboardsIDLabelsIDRequest(c.service.ServerAPIURL(), dashboardID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboardsIDMembers(ctx context.Context, dashboardID string, params *GetDashboardsIDMembersParams) (*http.Response, error) { - req, err := NewGetDashboardsIDMembersRequest(c.service.ServerAPIURL(), dashboardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDMembersWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDashboardsIDMembersRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDMembers(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, body PostDashboardsIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostDashboardsIDMembersRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDashboardsIDMembersID(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteDashboardsIDMembersIDRequest(c.service.ServerAPIURL(), dashboardID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDashboardsIDOwners(ctx context.Context, dashboardID string, params *GetDashboardsIDOwnersParams) (*http.Response, error) { - req, err := NewGetDashboardsIDOwnersRequest(c.service.ServerAPIURL(), dashboardID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDOwnersWithBody(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDashboardsIDOwnersRequestWithBody(c.service.ServerAPIURL(), dashboardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDashboardsIDOwners(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, body PostDashboardsIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostDashboardsIDOwnersRequest(c.service.ServerAPIURL(), dashboardID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDashboardsIDOwnersID(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteDashboardsIDOwnersIDRequest(c.service.ServerAPIURL(), dashboardID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDBRPs(ctx context.Context, params *GetDBRPsParams) (*http.Response, error) { - req, err := NewGetDBRPsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDBRPWithBody(ctx context.Context, params *PostDBRPParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDBRPRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDBRP(ctx context.Context, params *PostDBRPParams, body PostDBRPJSONRequestBody) (*http.Response, error) { - req, err := NewPostDBRPRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteDBRPID(ctx context.Context, dbrpID string, params *DeleteDBRPIDParams) (*http.Response, error) { - req, err := NewDeleteDBRPIDRequest(c.service.ServerAPIURL(), dbrpID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetDBRPsID(ctx context.Context, dbrpID string, params *GetDBRPsIDParams) (*http.Response, error) { - req, err := NewGetDBRPsIDRequest(c.service.ServerAPIURL(), dbrpID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDBRPIDWithBody(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchDBRPIDRequestWithBody(c.service.ServerAPIURL(), dbrpID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchDBRPID(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, body PatchDBRPIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchDBRPIDRequest(c.service.ServerAPIURL(), dbrpID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDeleteWithBody(ctx context.Context, params *PostDeleteParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostDeleteRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostDelete(ctx context.Context, params *PostDeleteParams, body PostDeleteJSONRequestBody) (*http.Response, error) { - req, err := NewPostDeleteRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetFlags(ctx context.Context, params *GetFlagsParams) (*http.Response, error) { - req, err := NewGetFlagsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetHealth(ctx context.Context, params *GetHealthParams) (*http.Response, error) { - req, err := NewGetHealthRequest(c.service.ServerURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetLabels(ctx context.Context, params *GetLabelsParams) (*http.Response, error) { - req, err := NewGetLabelsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLabelsWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostLabelsRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLabels(ctx context.Context, body PostLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostLabelsRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteLabelsID(ctx context.Context, labelID string, params *DeleteLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteLabelsIDRequest(c.service.ServerAPIURL(), labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetLabelsID(ctx context.Context, labelID string, params *GetLabelsIDParams) (*http.Response, error) { - req, err := NewGetLabelsIDRequest(c.service.ServerAPIURL(), labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchLabelsIDWithBody(ctx context.Context, labelID string, params *PatchLabelsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchLabelsIDRequestWithBody(c.service.ServerAPIURL(), labelID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchLabelsID(ctx context.Context, labelID string, params *PatchLabelsIDParams, body PatchLabelsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchLabelsIDRequest(c.service.ServerAPIURL(), labelID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetLegacyAuthorizations(ctx context.Context, params *GetLegacyAuthorizationsParams) (*http.Response, error) { - req, err := NewGetLegacyAuthorizationsRequest(c.service.ServerURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLegacyAuthorizationsWithBody(ctx context.Context, params *PostLegacyAuthorizationsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostLegacyAuthorizationsRequestWithBody(c.service.ServerURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLegacyAuthorizations(ctx context.Context, params *PostLegacyAuthorizationsParams, body PostLegacyAuthorizationsJSONRequestBody) (*http.Response, error) { - req, err := NewPostLegacyAuthorizationsRequest(c.service.ServerURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteLegacyAuthorizationsID(ctx context.Context, authID string, params *DeleteLegacyAuthorizationsIDParams) (*http.Response, error) { - req, err := NewDeleteLegacyAuthorizationsIDRequest(c.service.ServerURL(), authID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetLegacyAuthorizationsID(ctx context.Context, authID string, params *GetLegacyAuthorizationsIDParams) (*http.Response, error) { - req, err := NewGetLegacyAuthorizationsIDRequest(c.service.ServerURL(), authID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchLegacyAuthorizationsIDWithBody(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchLegacyAuthorizationsIDRequestWithBody(c.service.ServerURL(), authID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchLegacyAuthorizationsID(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, body PatchLegacyAuthorizationsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchLegacyAuthorizationsIDRequest(c.service.ServerURL(), authID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLegacyAuthorizationsIDPasswordWithBody(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostLegacyAuthorizationsIDPasswordRequestWithBody(c.service.ServerURL(), authID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostLegacyAuthorizationsIDPassword(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, body PostLegacyAuthorizationsIDPasswordJSONRequestBody) (*http.Response, error) { - req, err := NewPostLegacyAuthorizationsIDPasswordRequest(c.service.ServerURL(), authID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetMe(ctx context.Context, params *GetMeParams) (*http.Response, error) { - req, err := NewGetMeRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutMePasswordWithBody(ctx context.Context, params *PutMePasswordParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutMePasswordRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutMePassword(ctx context.Context, params *PutMePasswordParams, body PutMePasswordJSONRequestBody) (*http.Response, error) { - req, err := NewPutMePasswordRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetMetrics(ctx context.Context, params *GetMetricsParams) (*http.Response, error) { - req, err := NewGetMetricsRequest(c.service.ServerURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationEndpoints(ctx context.Context, params *GetNotificationEndpointsParams) (*http.Response, error) { - req, err := NewGetNotificationEndpointsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateNotificationEndpointWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewCreateNotificationEndpointRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateNotificationEndpoint(ctx context.Context, body CreateNotificationEndpointJSONRequestBody) (*http.Response, error) { - req, err := NewCreateNotificationEndpointRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteNotificationEndpointsID(ctx context.Context, endpointID string, params *DeleteNotificationEndpointsIDParams) (*http.Response, error) { - req, err := NewDeleteNotificationEndpointsIDRequest(c.service.ServerAPIURL(), endpointID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationEndpointsID(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDParams) (*http.Response, error) { - req, err := NewGetNotificationEndpointsIDRequest(c.service.ServerAPIURL(), endpointID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchNotificationEndpointsIDWithBody(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchNotificationEndpointsIDRequestWithBody(c.service.ServerAPIURL(), endpointID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchNotificationEndpointsID(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, body PatchNotificationEndpointsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchNotificationEndpointsIDRequest(c.service.ServerAPIURL(), endpointID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutNotificationEndpointsIDWithBody(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutNotificationEndpointsIDRequestWithBody(c.service.ServerAPIURL(), endpointID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutNotificationEndpointsID(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, body PutNotificationEndpointsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPutNotificationEndpointsIDRequest(c.service.ServerAPIURL(), endpointID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationEndpointsIDLabels(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDLabelsParams) (*http.Response, error) { - req, err := NewGetNotificationEndpointsIDLabelsRequest(c.service.ServerAPIURL(), endpointID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostNotificationEndpointIDLabelsWithBody(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostNotificationEndpointIDLabelsRequestWithBody(c.service.ServerAPIURL(), endpointID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostNotificationEndpointIDLabels(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, body PostNotificationEndpointIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostNotificationEndpointIDLabelsRequest(c.service.ServerAPIURL(), endpointID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteNotificationEndpointsIDLabelsID(ctx context.Context, endpointID string, labelID string, params *DeleteNotificationEndpointsIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteNotificationEndpointsIDLabelsIDRequest(c.service.ServerAPIURL(), endpointID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationRules(ctx context.Context, params *GetNotificationRulesParams) (*http.Response, error) { - req, err := NewGetNotificationRulesRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateNotificationRuleWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewCreateNotificationRuleRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateNotificationRule(ctx context.Context, body CreateNotificationRuleJSONRequestBody) (*http.Response, error) { - req, err := NewCreateNotificationRuleRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteNotificationRulesID(ctx context.Context, ruleID string, params *DeleteNotificationRulesIDParams) (*http.Response, error) { - req, err := NewDeleteNotificationRulesIDRequest(c.service.ServerAPIURL(), ruleID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationRulesID(ctx context.Context, ruleID string, params *GetNotificationRulesIDParams) (*http.Response, error) { - req, err := NewGetNotificationRulesIDRequest(c.service.ServerAPIURL(), ruleID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchNotificationRulesIDWithBody(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchNotificationRulesIDRequestWithBody(c.service.ServerAPIURL(), ruleID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchNotificationRulesID(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, body PatchNotificationRulesIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchNotificationRulesIDRequest(c.service.ServerAPIURL(), ruleID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutNotificationRulesIDWithBody(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutNotificationRulesIDRequestWithBody(c.service.ServerAPIURL(), ruleID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutNotificationRulesID(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, body PutNotificationRulesIDJSONRequestBody) (*http.Response, error) { - req, err := NewPutNotificationRulesIDRequest(c.service.ServerAPIURL(), ruleID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationRulesIDLabels(ctx context.Context, ruleID string, params *GetNotificationRulesIDLabelsParams) (*http.Response, error) { - req, err := NewGetNotificationRulesIDLabelsRequest(c.service.ServerAPIURL(), ruleID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostNotificationRuleIDLabelsWithBody(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostNotificationRuleIDLabelsRequestWithBody(c.service.ServerAPIURL(), ruleID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostNotificationRuleIDLabels(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, body PostNotificationRuleIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostNotificationRuleIDLabelsRequest(c.service.ServerAPIURL(), ruleID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteNotificationRulesIDLabelsID(ctx context.Context, ruleID string, labelID string, params *DeleteNotificationRulesIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteNotificationRulesIDLabelsIDRequest(c.service.ServerAPIURL(), ruleID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetNotificationRulesIDQuery(ctx context.Context, ruleID string, params *GetNotificationRulesIDQueryParams) (*http.Response, error) { - req, err := NewGetNotificationRulesIDQueryRequest(c.service.ServerAPIURL(), ruleID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetOrgs(ctx context.Context, params *GetOrgsParams) (*http.Response, error) { - req, err := NewGetOrgsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsWithBody(ctx context.Context, params *PostOrgsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostOrgsRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgs(ctx context.Context, params *PostOrgsParams, body PostOrgsJSONRequestBody) (*http.Response, error) { - req, err := NewPostOrgsRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteOrgsID(ctx context.Context, orgID string, params *DeleteOrgsIDParams) (*http.Response, error) { - req, err := NewDeleteOrgsIDRequest(c.service.ServerAPIURL(), orgID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetOrgsID(ctx context.Context, orgID string, params *GetOrgsIDParams) (*http.Response, error) { - req, err := NewGetOrgsIDRequest(c.service.ServerAPIURL(), orgID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchOrgsIDWithBody(ctx context.Context, orgID string, params *PatchOrgsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchOrgsIDRequestWithBody(c.service.ServerAPIURL(), orgID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchOrgsID(ctx context.Context, orgID string, params *PatchOrgsIDParams, body PatchOrgsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchOrgsIDRequest(c.service.ServerAPIURL(), orgID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetOrgsIDMembers(ctx context.Context, orgID string, params *GetOrgsIDMembersParams) (*http.Response, error) { - req, err := NewGetOrgsIDMembersRequest(c.service.ServerAPIURL(), orgID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDMembersWithBody(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostOrgsIDMembersRequestWithBody(c.service.ServerAPIURL(), orgID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDMembers(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, body PostOrgsIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostOrgsIDMembersRequest(c.service.ServerAPIURL(), orgID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteOrgsIDMembersID(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteOrgsIDMembersIDRequest(c.service.ServerAPIURL(), orgID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetOrgsIDOwners(ctx context.Context, orgID string, params *GetOrgsIDOwnersParams) (*http.Response, error) { - req, err := NewGetOrgsIDOwnersRequest(c.service.ServerAPIURL(), orgID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDOwnersWithBody(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostOrgsIDOwnersRequestWithBody(c.service.ServerAPIURL(), orgID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDOwners(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, body PostOrgsIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostOrgsIDOwnersRequest(c.service.ServerAPIURL(), orgID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteOrgsIDOwnersID(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteOrgsIDOwnersIDRequest(c.service.ServerAPIURL(), orgID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetOrgsIDSecrets(ctx context.Context, orgID string, params *GetOrgsIDSecretsParams) (*http.Response, error) { - req, err := NewGetOrgsIDSecretsRequest(c.service.ServerAPIURL(), orgID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchOrgsIDSecretsWithBody(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchOrgsIDSecretsRequestWithBody(c.service.ServerAPIURL(), orgID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchOrgsIDSecrets(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, body PatchOrgsIDSecretsJSONRequestBody) (*http.Response, error) { - req, err := NewPatchOrgsIDSecretsRequest(c.service.ServerAPIURL(), orgID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDSecretsWithBody(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostOrgsIDSecretsRequestWithBody(c.service.ServerAPIURL(), orgID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostOrgsIDSecrets(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, body PostOrgsIDSecretsJSONRequestBody) (*http.Response, error) { - req, err := NewPostOrgsIDSecretsRequest(c.service.ServerAPIURL(), orgID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteOrgsIDSecretsID(ctx context.Context, orgID string, secretID string, params *DeleteOrgsIDSecretsIDParams) (*http.Response, error) { - req, err := NewDeleteOrgsIDSecretsIDRequest(c.service.ServerAPIURL(), orgID, secretID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetPing(ctx context.Context) (*http.Response, error) { - req, err := NewGetPingRequest(c.service.ServerURL()) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) HeadPing(ctx context.Context) (*http.Response, error) { - req, err := NewHeadPingRequest(c.service.ServerURL()) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQueryWithBody(ctx context.Context, params *PostQueryParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostQueryRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQuery(ctx context.Context, params *PostQueryParams, body PostQueryJSONRequestBody) (*http.Response, error) { - req, err := NewPostQueryRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQueryAnalyzeWithBody(ctx context.Context, params *PostQueryAnalyzeParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostQueryAnalyzeRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQueryAnalyze(ctx context.Context, params *PostQueryAnalyzeParams, body PostQueryAnalyzeJSONRequestBody) (*http.Response, error) { - req, err := NewPostQueryAnalyzeRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQueryAstWithBody(ctx context.Context, params *PostQueryAstParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostQueryAstRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostQueryAst(ctx context.Context, params *PostQueryAstParams, body PostQueryAstJSONRequestBody) (*http.Response, error) { - req, err := NewPostQueryAstRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetQuerySuggestions(ctx context.Context, params *GetQuerySuggestionsParams) (*http.Response, error) { - req, err := NewGetQuerySuggestionsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetQuerySuggestionsName(ctx context.Context, name string, params *GetQuerySuggestionsNameParams) (*http.Response, error) { - req, err := NewGetQuerySuggestionsNameRequest(c.service.ServerAPIURL(), name, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetReady(ctx context.Context, params *GetReadyParams) (*http.Response, error) { - req, err := NewGetReadyRequest(c.service.ServerURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetRemoteConnections(ctx context.Context, params *GetRemoteConnectionsParams) (*http.Response, error) { - req, err := NewGetRemoteConnectionsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRemoteConnectionWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRemoteConnectionRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRemoteConnection(ctx context.Context, body PostRemoteConnectionJSONRequestBody) (*http.Response, error) { - req, err := NewPostRemoteConnectionRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteRemoteConnectionByID(ctx context.Context, remoteID string, params *DeleteRemoteConnectionByIDParams) (*http.Response, error) { - req, err := NewDeleteRemoteConnectionByIDRequest(c.service.ServerAPIURL(), remoteID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetRemoteConnectionByID(ctx context.Context, remoteID string, params *GetRemoteConnectionByIDParams) (*http.Response, error) { - req, err := NewGetRemoteConnectionByIDRequest(c.service.ServerAPIURL(), remoteID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchRemoteConnectionByIDWithBody(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchRemoteConnectionByIDRequestWithBody(c.service.ServerAPIURL(), remoteID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchRemoteConnectionByID(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, body PatchRemoteConnectionByIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchRemoteConnectionByIDRequest(c.service.ServerAPIURL(), remoteID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetReplications(ctx context.Context, params *GetReplicationsParams) (*http.Response, error) { - req, err := NewGetReplicationsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostReplicationWithBody(ctx context.Context, params *PostReplicationParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostReplicationRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostReplication(ctx context.Context, params *PostReplicationParams, body PostReplicationJSONRequestBody) (*http.Response, error) { - req, err := NewPostReplicationRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteReplicationByID(ctx context.Context, replicationID string, params *DeleteReplicationByIDParams) (*http.Response, error) { - req, err := NewDeleteReplicationByIDRequest(c.service.ServerAPIURL(), replicationID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetReplicationByID(ctx context.Context, replicationID string, params *GetReplicationByIDParams) (*http.Response, error) { - req, err := NewGetReplicationByIDRequest(c.service.ServerAPIURL(), replicationID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchReplicationByIDWithBody(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchReplicationByIDRequestWithBody(c.service.ServerAPIURL(), replicationID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchReplicationByID(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, body PatchReplicationByIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchReplicationByIDRequest(c.service.ServerAPIURL(), replicationID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostValidateReplicationByID(ctx context.Context, replicationID string, params *PostValidateReplicationByIDParams) (*http.Response, error) { - req, err := NewPostValidateReplicationByIDRequest(c.service.ServerAPIURL(), replicationID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetResources(ctx context.Context, params *GetResourcesParams) (*http.Response, error) { - req, err := NewGetResourcesRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreBucketIDWithBody(ctx context.Context, bucketID string, params *PostRestoreBucketIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRestoreBucketIDRequestWithBody(c.service.ServerAPIURL(), bucketID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreBucketMetadataWithBody(ctx context.Context, params *PostRestoreBucketMetadataParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRestoreBucketMetadataRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreBucketMetadata(ctx context.Context, params *PostRestoreBucketMetadataParams, body PostRestoreBucketMetadataJSONRequestBody) (*http.Response, error) { - req, err := NewPostRestoreBucketMetadataRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreKVWithBody(ctx context.Context, params *PostRestoreKVParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRestoreKVRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreShardIdWithBody(ctx context.Context, shardID string, params *PostRestoreShardIdParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRestoreShardIdRequestWithBody(c.service.ServerAPIURL(), shardID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostRestoreSQLWithBody(ctx context.Context, params *PostRestoreSQLParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostRestoreSQLRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetScrapers(ctx context.Context, params *GetScrapersParams) (*http.Response, error) { - req, err := NewGetScrapersRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersWithBody(ctx context.Context, params *PostScrapersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostScrapersRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapers(ctx context.Context, params *PostScrapersParams, body PostScrapersJSONRequestBody) (*http.Response, error) { - req, err := NewPostScrapersRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteScrapersID(ctx context.Context, scraperTargetID string, params *DeleteScrapersIDParams) (*http.Response, error) { - req, err := NewDeleteScrapersIDRequest(c.service.ServerAPIURL(), scraperTargetID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetScrapersID(ctx context.Context, scraperTargetID string, params *GetScrapersIDParams) (*http.Response, error) { - req, err := NewGetScrapersIDRequest(c.service.ServerAPIURL(), scraperTargetID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchScrapersIDWithBody(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchScrapersIDRequestWithBody(c.service.ServerAPIURL(), scraperTargetID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchScrapersID(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, body PatchScrapersIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchScrapersIDRequest(c.service.ServerAPIURL(), scraperTargetID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetScrapersIDLabels(ctx context.Context, scraperTargetID string, params *GetScrapersIDLabelsParams) (*http.Response, error) { - req, err := NewGetScrapersIDLabelsRequest(c.service.ServerAPIURL(), scraperTargetID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDLabelsWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostScrapersIDLabelsRequestWithBody(c.service.ServerAPIURL(), scraperTargetID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDLabels(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, body PostScrapersIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostScrapersIDLabelsRequest(c.service.ServerAPIURL(), scraperTargetID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteScrapersIDLabelsID(ctx context.Context, scraperTargetID string, labelID string, params *DeleteScrapersIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteScrapersIDLabelsIDRequest(c.service.ServerAPIURL(), scraperTargetID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetScrapersIDMembers(ctx context.Context, scraperTargetID string, params *GetScrapersIDMembersParams) (*http.Response, error) { - req, err := NewGetScrapersIDMembersRequest(c.service.ServerAPIURL(), scraperTargetID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDMembersWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostScrapersIDMembersRequestWithBody(c.service.ServerAPIURL(), scraperTargetID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDMembers(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, body PostScrapersIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostScrapersIDMembersRequest(c.service.ServerAPIURL(), scraperTargetID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteScrapersIDMembersID(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteScrapersIDMembersIDRequest(c.service.ServerAPIURL(), scraperTargetID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetScrapersIDOwners(ctx context.Context, scraperTargetID string, params *GetScrapersIDOwnersParams) (*http.Response, error) { - req, err := NewGetScrapersIDOwnersRequest(c.service.ServerAPIURL(), scraperTargetID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDOwnersWithBody(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostScrapersIDOwnersRequestWithBody(c.service.ServerAPIURL(), scraperTargetID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostScrapersIDOwners(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, body PostScrapersIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostScrapersIDOwnersRequest(c.service.ServerAPIURL(), scraperTargetID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteScrapersIDOwnersID(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteScrapersIDOwnersIDRequest(c.service.ServerAPIURL(), scraperTargetID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetSetup(ctx context.Context, params *GetSetupParams) (*http.Response, error) { - req, err := NewGetSetupRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSetupWithBody(ctx context.Context, params *PostSetupParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostSetupRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSetup(ctx context.Context, params *PostSetupParams, body PostSetupJSONRequestBody) (*http.Response, error) { - req, err := NewPostSetupRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSignin(ctx context.Context, params *PostSigninParams) (*http.Response, error) { - req, err := NewPostSigninRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSignout(ctx context.Context, params *PostSignoutParams) (*http.Response, error) { - req, err := NewPostSignoutRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetSources(ctx context.Context, params *GetSourcesParams) (*http.Response, error) { - req, err := NewGetSourcesRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSourcesWithBody(ctx context.Context, params *PostSourcesParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostSourcesRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostSources(ctx context.Context, params *PostSourcesParams, body PostSourcesJSONRequestBody) (*http.Response, error) { - req, err := NewPostSourcesRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteSourcesID(ctx context.Context, sourceID string, params *DeleteSourcesIDParams) (*http.Response, error) { - req, err := NewDeleteSourcesIDRequest(c.service.ServerAPIURL(), sourceID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetSourcesID(ctx context.Context, sourceID string, params *GetSourcesIDParams) (*http.Response, error) { - req, err := NewGetSourcesIDRequest(c.service.ServerAPIURL(), sourceID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchSourcesIDWithBody(ctx context.Context, sourceID string, params *PatchSourcesIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchSourcesIDRequestWithBody(c.service.ServerAPIURL(), sourceID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchSourcesID(ctx context.Context, sourceID string, params *PatchSourcesIDParams, body PatchSourcesIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchSourcesIDRequest(c.service.ServerAPIURL(), sourceID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetSourcesIDBuckets(ctx context.Context, sourceID string, params *GetSourcesIDBucketsParams) (*http.Response, error) { - req, err := NewGetSourcesIDBucketsRequest(c.service.ServerAPIURL(), sourceID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetSourcesIDHealth(ctx context.Context, sourceID string, params *GetSourcesIDHealthParams) (*http.Response, error) { - req, err := NewGetSourcesIDHealthRequest(c.service.ServerAPIURL(), sourceID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ListStacks(ctx context.Context, params *ListStacksParams) (*http.Response, error) { - req, err := NewListStacksRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateStackWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewCreateStackRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) CreateStack(ctx context.Context, body CreateStackJSONRequestBody) (*http.Response, error) { - req, err := NewCreateStackRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteStack(ctx context.Context, stackId string, params *DeleteStackParams) (*http.Response, error) { - req, err := NewDeleteStackRequest(c.service.ServerAPIURL(), stackId, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ReadStack(ctx context.Context, stackId string) (*http.Response, error) { - req, err := NewReadStackRequest(c.service.ServerAPIURL(), stackId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) UpdateStackWithBody(ctx context.Context, stackId string, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewUpdateStackRequestWithBody(c.service.ServerAPIURL(), stackId, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) UpdateStack(ctx context.Context, stackId string, body UpdateStackJSONRequestBody) (*http.Response, error) { - req, err := NewUpdateStackRequest(c.service.ServerAPIURL(), stackId, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) UninstallStack(ctx context.Context, stackId string) (*http.Response, error) { - req, err := NewUninstallStackRequest(c.service.ServerAPIURL(), stackId) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasks(ctx context.Context, params *GetTasksParams) (*http.Response, error) { - req, err := NewGetTasksRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksWithBody(ctx context.Context, params *PostTasksParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasks(ctx context.Context, params *PostTasksParams, body PostTasksJSONRequestBody) (*http.Response, error) { - req, err := NewPostTasksRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTasksID(ctx context.Context, taskID string, params *DeleteTasksIDParams) (*http.Response, error) { - req, err := NewDeleteTasksIDRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksID(ctx context.Context, taskID string, params *GetTasksIDParams) (*http.Response, error) { - req, err := NewGetTasksIDRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchTasksIDWithBody(ctx context.Context, taskID string, params *PatchTasksIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchTasksIDRequestWithBody(c.service.ServerAPIURL(), taskID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchTasksID(ctx context.Context, taskID string, params *PatchTasksIDParams, body PatchTasksIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchTasksIDRequest(c.service.ServerAPIURL(), taskID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDLabels(ctx context.Context, taskID string, params *GetTasksIDLabelsParams) (*http.Response, error) { - req, err := NewGetTasksIDLabelsRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDLabelsWithBody(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksIDLabelsRequestWithBody(c.service.ServerAPIURL(), taskID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDLabels(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, body PostTasksIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostTasksIDLabelsRequest(c.service.ServerAPIURL(), taskID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTasksIDLabelsID(ctx context.Context, taskID string, labelID string, params *DeleteTasksIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteTasksIDLabelsIDRequest(c.service.ServerAPIURL(), taskID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDLogs(ctx context.Context, taskID string, params *GetTasksIDLogsParams) (*http.Response, error) { - req, err := NewGetTasksIDLogsRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDMembers(ctx context.Context, taskID string, params *GetTasksIDMembersParams) (*http.Response, error) { - req, err := NewGetTasksIDMembersRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDMembersWithBody(ctx context.Context, taskID string, params *PostTasksIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksIDMembersRequestWithBody(c.service.ServerAPIURL(), taskID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDMembers(ctx context.Context, taskID string, params *PostTasksIDMembersParams, body PostTasksIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostTasksIDMembersRequest(c.service.ServerAPIURL(), taskID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTasksIDMembersID(ctx context.Context, taskID string, userID string, params *DeleteTasksIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteTasksIDMembersIDRequest(c.service.ServerAPIURL(), taskID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDOwners(ctx context.Context, taskID string, params *GetTasksIDOwnersParams) (*http.Response, error) { - req, err := NewGetTasksIDOwnersRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDOwnersWithBody(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksIDOwnersRequestWithBody(c.service.ServerAPIURL(), taskID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDOwners(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, body PostTasksIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostTasksIDOwnersRequest(c.service.ServerAPIURL(), taskID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTasksIDOwnersID(ctx context.Context, taskID string, userID string, params *DeleteTasksIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteTasksIDOwnersIDRequest(c.service.ServerAPIURL(), taskID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDRuns(ctx context.Context, taskID string, params *GetTasksIDRunsParams) (*http.Response, error) { - req, err := NewGetTasksIDRunsRequest(c.service.ServerAPIURL(), taskID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDRunsWithBody(ctx context.Context, taskID string, params *PostTasksIDRunsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksIDRunsRequestWithBody(c.service.ServerAPIURL(), taskID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDRuns(ctx context.Context, taskID string, params *PostTasksIDRunsParams, body PostTasksIDRunsJSONRequestBody) (*http.Response, error) { - req, err := NewPostTasksIDRunsRequest(c.service.ServerAPIURL(), taskID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTasksIDRunsID(ctx context.Context, taskID string, runID string, params *DeleteTasksIDRunsIDParams) (*http.Response, error) { - req, err := NewDeleteTasksIDRunsIDRequest(c.service.ServerAPIURL(), taskID, runID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDRunsID(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDParams) (*http.Response, error) { - req, err := NewGetTasksIDRunsIDRequest(c.service.ServerAPIURL(), taskID, runID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTasksIDRunsIDLogs(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDLogsParams) (*http.Response, error) { - req, err := NewGetTasksIDRunsIDLogsRequest(c.service.ServerAPIURL(), taskID, runID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTasksIDRunsIDRetryWithBody(ctx context.Context, taskID string, runID string, params *PostTasksIDRunsIDRetryParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTasksIDRunsIDRetryRequestWithBody(c.service.ServerAPIURL(), taskID, runID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafPlugins(ctx context.Context, params *GetTelegrafPluginsParams) (*http.Response, error) { - req, err := NewGetTelegrafPluginsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafs(ctx context.Context, params *GetTelegrafsParams) (*http.Response, error) { - req, err := NewGetTelegrafsRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsWithBody(ctx context.Context, params *PostTelegrafsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTelegrafsRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafs(ctx context.Context, params *PostTelegrafsParams, body PostTelegrafsJSONRequestBody) (*http.Response, error) { - req, err := NewPostTelegrafsRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTelegrafsID(ctx context.Context, telegrafID string, params *DeleteTelegrafsIDParams) (*http.Response, error) { - req, err := NewDeleteTelegrafsIDRequest(c.service.ServerAPIURL(), telegrafID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafsID(ctx context.Context, telegrafID string, params *GetTelegrafsIDParams) (*http.Response, error) { - req, err := NewGetTelegrafsIDRequest(c.service.ServerAPIURL(), telegrafID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutTelegrafsIDWithBody(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutTelegrafsIDRequestWithBody(c.service.ServerAPIURL(), telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutTelegrafsID(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, body PutTelegrafsIDJSONRequestBody) (*http.Response, error) { - req, err := NewPutTelegrafsIDRequest(c.service.ServerAPIURL(), telegrafID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafsIDLabels(ctx context.Context, telegrafID string, params *GetTelegrafsIDLabelsParams) (*http.Response, error) { - req, err := NewGetTelegrafsIDLabelsRequest(c.service.ServerAPIURL(), telegrafID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDLabelsWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTelegrafsIDLabelsRequestWithBody(c.service.ServerAPIURL(), telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDLabels(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, body PostTelegrafsIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostTelegrafsIDLabelsRequest(c.service.ServerAPIURL(), telegrafID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTelegrafsIDLabelsID(ctx context.Context, telegrafID string, labelID string, params *DeleteTelegrafsIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteTelegrafsIDLabelsIDRequest(c.service.ServerAPIURL(), telegrafID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafsIDMembers(ctx context.Context, telegrafID string, params *GetTelegrafsIDMembersParams) (*http.Response, error) { - req, err := NewGetTelegrafsIDMembersRequest(c.service.ServerAPIURL(), telegrafID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDMembersWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTelegrafsIDMembersRequestWithBody(c.service.ServerAPIURL(), telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDMembers(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, body PostTelegrafsIDMembersJSONRequestBody) (*http.Response, error) { - req, err := NewPostTelegrafsIDMembersRequest(c.service.ServerAPIURL(), telegrafID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTelegrafsIDMembersID(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDMembersIDParams) (*http.Response, error) { - req, err := NewDeleteTelegrafsIDMembersIDRequest(c.service.ServerAPIURL(), telegrafID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetTelegrafsIDOwners(ctx context.Context, telegrafID string, params *GetTelegrafsIDOwnersParams) (*http.Response, error) { - req, err := NewGetTelegrafsIDOwnersRequest(c.service.ServerAPIURL(), telegrafID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDOwnersWithBody(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostTelegrafsIDOwnersRequestWithBody(c.service.ServerAPIURL(), telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostTelegrafsIDOwners(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, body PostTelegrafsIDOwnersJSONRequestBody) (*http.Response, error) { - req, err := NewPostTelegrafsIDOwnersRequest(c.service.ServerAPIURL(), telegrafID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteTelegrafsIDOwnersID(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDOwnersIDParams) (*http.Response, error) { - req, err := NewDeleteTelegrafsIDOwnersIDRequest(c.service.ServerAPIURL(), telegrafID, userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ApplyTemplateWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewApplyTemplateRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ApplyTemplate(ctx context.Context, body ApplyTemplateJSONRequestBody) (*http.Response, error) { - req, err := NewApplyTemplateRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ExportTemplateWithBody(ctx context.Context, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewExportTemplateRequestWithBody(c.service.ServerAPIURL(), contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) ExportTemplate(ctx context.Context, body ExportTemplateJSONRequestBody) (*http.Response, error) { - req, err := NewExportTemplateRequest(c.service.ServerAPIURL(), body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetUsers(ctx context.Context, params *GetUsersParams) (*http.Response, error) { - req, err := NewGetUsersRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostUsersWithBody(ctx context.Context, params *PostUsersParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostUsersRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostUsers(ctx context.Context, params *PostUsersParams, body PostUsersJSONRequestBody) (*http.Response, error) { - req, err := NewPostUsersRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteUsersID(ctx context.Context, userID string, params *DeleteUsersIDParams) (*http.Response, error) { - req, err := NewDeleteUsersIDRequest(c.service.ServerAPIURL(), userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetUsersID(ctx context.Context, userID string, params *GetUsersIDParams) (*http.Response, error) { - req, err := NewGetUsersIDRequest(c.service.ServerAPIURL(), userID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchUsersIDWithBody(ctx context.Context, userID string, params *PatchUsersIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchUsersIDRequestWithBody(c.service.ServerAPIURL(), userID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchUsersID(ctx context.Context, userID string, params *PatchUsersIDParams, body PatchUsersIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchUsersIDRequest(c.service.ServerAPIURL(), userID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostUsersIDPasswordWithBody(ctx context.Context, userID string, params *PostUsersIDPasswordParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostUsersIDPasswordRequestWithBody(c.service.ServerAPIURL(), userID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostUsersIDPassword(ctx context.Context, userID string, params *PostUsersIDPasswordParams, body PostUsersIDPasswordJSONRequestBody) (*http.Response, error) { - req, err := NewPostUsersIDPasswordRequest(c.service.ServerAPIURL(), userID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetVariables(ctx context.Context, params *GetVariablesParams) (*http.Response, error) { - req, err := NewGetVariablesRequest(c.service.ServerAPIURL(), params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostVariablesWithBody(ctx context.Context, params *PostVariablesParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostVariablesRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostVariables(ctx context.Context, params *PostVariablesParams, body PostVariablesJSONRequestBody) (*http.Response, error) { - req, err := NewPostVariablesRequest(c.service.ServerAPIURL(), params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteVariablesID(ctx context.Context, variableID string, params *DeleteVariablesIDParams) (*http.Response, error) { - req, err := NewDeleteVariablesIDRequest(c.service.ServerAPIURL(), variableID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetVariablesID(ctx context.Context, variableID string, params *GetVariablesIDParams) (*http.Response, error) { - req, err := NewGetVariablesIDRequest(c.service.ServerAPIURL(), variableID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchVariablesIDWithBody(ctx context.Context, variableID string, params *PatchVariablesIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPatchVariablesIDRequestWithBody(c.service.ServerAPIURL(), variableID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PatchVariablesID(ctx context.Context, variableID string, params *PatchVariablesIDParams, body PatchVariablesIDJSONRequestBody) (*http.Response, error) { - req, err := NewPatchVariablesIDRequest(c.service.ServerAPIURL(), variableID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutVariablesIDWithBody(ctx context.Context, variableID string, params *PutVariablesIDParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPutVariablesIDRequestWithBody(c.service.ServerAPIURL(), variableID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PutVariablesID(ctx context.Context, variableID string, params *PutVariablesIDParams, body PutVariablesIDJSONRequestBody) (*http.Response, error) { - req, err := NewPutVariablesIDRequest(c.service.ServerAPIURL(), variableID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) GetVariablesIDLabels(ctx context.Context, variableID string, params *GetVariablesIDLabelsParams) (*http.Response, error) { - req, err := NewGetVariablesIDLabelsRequest(c.service.ServerAPIURL(), variableID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostVariablesIDLabelsWithBody(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostVariablesIDLabelsRequestWithBody(c.service.ServerAPIURL(), variableID, params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostVariablesIDLabels(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, body PostVariablesIDLabelsJSONRequestBody) (*http.Response, error) { - req, err := NewPostVariablesIDLabelsRequest(c.service.ServerAPIURL(), variableID, params, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) DeleteVariablesIDLabelsID(ctx context.Context, variableID string, labelID string, params *DeleteVariablesIDLabelsIDParams) (*http.Response, error) { - req, err := NewDeleteVariablesIDLabelsIDRequest(c.service.ServerAPIURL(), variableID, labelID, params) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -func (c *Client) PostWriteWithBody(ctx context.Context, params *PostWriteParams, contentType string, body io.Reader) (*http.Response, error) { - req, err := NewPostWriteRequestWithBody(c.service.ServerAPIURL(), params, contentType, body) - if err != nil { - return nil, err - } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} - -// NewGetRoutesRequest generates requests for GetRoutes -func NewGetRoutesRequest(server string, params *GetRoutesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetAuthorizationsRequest generates requests for GetAuthorizations -func NewGetAuthorizationsRequest(server string, params *GetAuthorizationsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/authorizations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.UserID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "userID", runtime.ParamLocationQuery, *params.UserID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.User != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user", runtime.ParamLocationQuery, *params.User); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostAuthorizationsRequest calls the generic PostAuthorizations builder with application/json body -func NewPostAuthorizationsRequest(server string, params *PostAuthorizationsParams, body PostAuthorizationsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostAuthorizationsRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostAuthorizationsRequestWithBody generates requests for PostAuthorizations with any type of body -func NewPostAuthorizationsRequestWithBody(server string, params *PostAuthorizationsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/authorizations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteAuthorizationsIDRequest generates requests for DeleteAuthorizationsID -func NewDeleteAuthorizationsIDRequest(server string, authID string, params *DeleteAuthorizationsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetAuthorizationsIDRequest generates requests for GetAuthorizationsID -func NewGetAuthorizationsIDRequest(server string, authID string, params *GetAuthorizationsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchAuthorizationsIDRequest calls the generic PatchAuthorizationsID builder with application/json body -func NewPatchAuthorizationsIDRequest(server string, authID string, params *PatchAuthorizationsIDParams, body PatchAuthorizationsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchAuthorizationsIDRequestWithBody(server, authID, params, "application/json", bodyReader) -} - -// NewPatchAuthorizationsIDRequestWithBody generates requests for PatchAuthorizationsID with any type of body -func NewPatchAuthorizationsIDRequestWithBody(server string, authID string, params *PatchAuthorizationsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBackupKVRequest generates requests for GetBackupKV -func NewGetBackupKVRequest(server string, params *GetBackupKVParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/backup/kv") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBackupMetadataRequest generates requests for GetBackupMetadata -func NewGetBackupMetadataRequest(server string, params *GetBackupMetadataParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/backup/metadata") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.AcceptEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept-Encoding", runtime.ParamLocationHeader, *params.AcceptEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Accept-Encoding", headerParam1) - } - - return req, nil -} - -// NewGetBackupShardIdRequest generates requests for GetBackupShardId -func NewGetBackupShardIdRequest(server string, shardID int64, params *GetBackupShardIdParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "shardID", runtime.ParamLocationPath, shardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/backup/shards/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Since != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "since", runtime.ParamLocationQuery, *params.Since); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.AcceptEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept-Encoding", runtime.ParamLocationHeader, *params.AcceptEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Accept-Encoding", headerParam1) - } - - return req, nil -} - -// NewGetBucketsRequest generates requests for GetBuckets -func NewGetBucketsRequest(server string, params *GetBucketsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.After != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Id != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostBucketsRequest calls the generic PostBuckets builder with application/json body -func NewPostBucketsRequest(server string, params *PostBucketsParams, body PostBucketsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostBucketsRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostBucketsRequestWithBody generates requests for PostBuckets with any type of body -func NewPostBucketsRequestWithBody(server string, params *PostBucketsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteBucketsIDRequest generates requests for DeleteBucketsID -func NewDeleteBucketsIDRequest(server string, bucketID string, params *DeleteBucketsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBucketsIDRequest generates requests for GetBucketsID -func NewGetBucketsIDRequest(server string, bucketID string, params *GetBucketsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchBucketsIDRequest calls the generic PatchBucketsID builder with application/json body -func NewPatchBucketsIDRequest(server string, bucketID string, params *PatchBucketsIDParams, body PatchBucketsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchBucketsIDRequestWithBody(server, bucketID, params, "application/json", bodyReader) -} - -// NewPatchBucketsIDRequestWithBody generates requests for PatchBucketsID with any type of body -func NewPatchBucketsIDRequestWithBody(server string, bucketID string, params *PatchBucketsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBucketsIDLabelsRequest generates requests for GetBucketsIDLabels -func NewGetBucketsIDLabelsRequest(server string, bucketID string, params *GetBucketsIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostBucketsIDLabelsRequest calls the generic PostBucketsIDLabels builder with application/json body -func NewPostBucketsIDLabelsRequest(server string, bucketID string, params *PostBucketsIDLabelsParams, body PostBucketsIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostBucketsIDLabelsRequestWithBody(server, bucketID, params, "application/json", bodyReader) -} - -// NewPostBucketsIDLabelsRequestWithBody generates requests for PostBucketsIDLabels with any type of body -func NewPostBucketsIDLabelsRequestWithBody(server string, bucketID string, params *PostBucketsIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteBucketsIDLabelsIDRequest generates requests for DeleteBucketsIDLabelsID -func NewDeleteBucketsIDLabelsIDRequest(server string, bucketID string, labelID string, params *DeleteBucketsIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBucketsIDMembersRequest generates requests for GetBucketsIDMembers -func NewGetBucketsIDMembersRequest(server string, bucketID string, params *GetBucketsIDMembersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostBucketsIDMembersRequest calls the generic PostBucketsIDMembers builder with application/json body -func NewPostBucketsIDMembersRequest(server string, bucketID string, params *PostBucketsIDMembersParams, body PostBucketsIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostBucketsIDMembersRequestWithBody(server, bucketID, params, "application/json", bodyReader) -} - -// NewPostBucketsIDMembersRequestWithBody generates requests for PostBucketsIDMembers with any type of body -func NewPostBucketsIDMembersRequestWithBody(server string, bucketID string, params *PostBucketsIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteBucketsIDMembersIDRequest generates requests for DeleteBucketsIDMembersID -func NewDeleteBucketsIDMembersIDRequest(server string, bucketID string, userID string, params *DeleteBucketsIDMembersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetBucketsIDOwnersRequest generates requests for GetBucketsIDOwners -func NewGetBucketsIDOwnersRequest(server string, bucketID string, params *GetBucketsIDOwnersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostBucketsIDOwnersRequest calls the generic PostBucketsIDOwners builder with application/json body -func NewPostBucketsIDOwnersRequest(server string, bucketID string, params *PostBucketsIDOwnersParams, body PostBucketsIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostBucketsIDOwnersRequestWithBody(server, bucketID, params, "application/json", bodyReader) -} - -// NewPostBucketsIDOwnersRequestWithBody generates requests for PostBucketsIDOwners with any type of body -func NewPostBucketsIDOwnersRequestWithBody(server string, bucketID string, params *PostBucketsIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteBucketsIDOwnersIDRequest generates requests for DeleteBucketsIDOwnersID -func NewDeleteBucketsIDOwnersIDRequest(server string, bucketID string, userID string, params *DeleteBucketsIDOwnersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/buckets/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetChecksRequest generates requests for GetChecks -func NewGetChecksRequest(server string, params *GetChecksParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewCreateCheckRequest calls the generic CreateCheck builder with application/json body -func NewCreateCheckRequest(server string, body CreateCheckJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateCheckRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateCheckRequestWithBody generates requests for CreateCheck with any type of body -func NewCreateCheckRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteChecksIDRequest generates requests for DeleteChecksID -func NewDeleteChecksIDRequest(server string, checkID string, params *DeleteChecksIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetChecksIDRequest generates requests for GetChecksID -func NewGetChecksIDRequest(server string, checkID string, params *GetChecksIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchChecksIDRequest calls the generic PatchChecksID builder with application/json body -func NewPatchChecksIDRequest(server string, checkID string, params *PatchChecksIDParams, body PatchChecksIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchChecksIDRequestWithBody(server, checkID, params, "application/json", bodyReader) -} - -// NewPatchChecksIDRequestWithBody generates requests for PatchChecksID with any type of body -func NewPatchChecksIDRequestWithBody(server string, checkID string, params *PatchChecksIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPutChecksIDRequest calls the generic PutChecksID builder with application/json body -func NewPutChecksIDRequest(server string, checkID string, params *PutChecksIDParams, body PutChecksIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPutChecksIDRequestWithBody(server, checkID, params, "application/json", bodyReader) -} - -// NewPutChecksIDRequestWithBody generates requests for PutChecksID with any type of body -func NewPutChecksIDRequestWithBody(server string, checkID string, params *PutChecksIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetChecksIDLabelsRequest generates requests for GetChecksIDLabels -func NewGetChecksIDLabelsRequest(server string, checkID string, params *GetChecksIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostChecksIDLabelsRequest calls the generic PostChecksIDLabels builder with application/json body -func NewPostChecksIDLabelsRequest(server string, checkID string, params *PostChecksIDLabelsParams, body PostChecksIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostChecksIDLabelsRequestWithBody(server, checkID, params, "application/json", bodyReader) -} - -// NewPostChecksIDLabelsRequestWithBody generates requests for PostChecksIDLabels with any type of body -func NewPostChecksIDLabelsRequestWithBody(server string, checkID string, params *PostChecksIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteChecksIDLabelsIDRequest generates requests for DeleteChecksIDLabelsID -func NewDeleteChecksIDLabelsIDRequest(server string, checkID string, labelID string, params *DeleteChecksIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetChecksIDQueryRequest generates requests for GetChecksIDQuery -func NewGetChecksIDQueryRequest(server string, checkID string, params *GetChecksIDQueryParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, checkID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/checks/%s/query", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetConfigRequest generates requests for GetConfig -func NewGetConfigRequest(server string, params *GetConfigParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/config") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsRequest generates requests for GetDashboards -func NewGetDashboardsRequest(server string, params *GetDashboardsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Descending != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "descending", runtime.ParamLocationQuery, *params.Descending); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Owner != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "owner", runtime.ParamLocationQuery, *params.Owner); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.SortBy != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sortBy", runtime.ParamLocationQuery, *params.SortBy); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Id != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDashboardsRequest calls the generic PostDashboards builder with application/json body -func NewPostDashboardsRequest(server string, params *PostDashboardsParams, body PostDashboardsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDashboardsRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostDashboardsRequestWithBody generates requests for PostDashboards with any type of body -func NewPostDashboardsRequestWithBody(server string, params *PostDashboardsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDashboardsIDRequest generates requests for DeleteDashboardsID -func NewDeleteDashboardsIDRequest(server string, dashboardID string, params *DeleteDashboardsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsIDRequest generates requests for GetDashboardsID -func NewGetDashboardsIDRequest(server string, dashboardID string, params *GetDashboardsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Include != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "include", runtime.ParamLocationQuery, *params.Include); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchDashboardsIDRequest calls the generic PatchDashboardsID builder with application/json body -func NewPatchDashboardsIDRequest(server string, dashboardID string, params *PatchDashboardsIDParams, body PatchDashboardsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchDashboardsIDRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPatchDashboardsIDRequestWithBody generates requests for PatchDashboardsID with any type of body -func NewPatchDashboardsIDRequestWithBody(server string, dashboardID string, params *PatchDashboardsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDashboardsIDCellsRequest calls the generic PostDashboardsIDCells builder with application/json body -func NewPostDashboardsIDCellsRequest(server string, dashboardID string, params *PostDashboardsIDCellsParams, body PostDashboardsIDCellsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDashboardsIDCellsRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPostDashboardsIDCellsRequestWithBody generates requests for PostDashboardsIDCells with any type of body -func NewPostDashboardsIDCellsRequestWithBody(server string, dashboardID string, params *PostDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPutDashboardsIDCellsRequest calls the generic PutDashboardsIDCells builder with application/json body -func NewPutDashboardsIDCellsRequest(server string, dashboardID string, params *PutDashboardsIDCellsParams, body PutDashboardsIDCellsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPutDashboardsIDCellsRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPutDashboardsIDCellsRequestWithBody generates requests for PutDashboardsIDCells with any type of body -func NewPutDashboardsIDCellsRequestWithBody(server string, dashboardID string, params *PutDashboardsIDCellsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDashboardsIDCellsIDRequest generates requests for DeleteDashboardsIDCellsID -func NewDeleteDashboardsIDCellsIDRequest(server string, dashboardID string, cellID string, params *DeleteDashboardsIDCellsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, cellID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchDashboardsIDCellsIDRequest calls the generic PatchDashboardsIDCellsID builder with application/json body -func NewPatchDashboardsIDCellsIDRequest(server string, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, body PatchDashboardsIDCellsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchDashboardsIDCellsIDRequestWithBody(server, dashboardID, cellID, params, "application/json", bodyReader) -} - -// NewPatchDashboardsIDCellsIDRequestWithBody generates requests for PatchDashboardsIDCellsID with any type of body -func NewPatchDashboardsIDCellsIDRequestWithBody(server string, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, cellID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsIDCellsIDViewRequest generates requests for GetDashboardsIDCellsIDView -func NewGetDashboardsIDCellsIDViewRequest(server string, dashboardID string, cellID string, params *GetDashboardsIDCellsIDViewParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, cellID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells/%s/view", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchDashboardsIDCellsIDViewRequest calls the generic PatchDashboardsIDCellsIDView builder with application/json body -func NewPatchDashboardsIDCellsIDViewRequest(server string, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, body PatchDashboardsIDCellsIDViewJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchDashboardsIDCellsIDViewRequestWithBody(server, dashboardID, cellID, params, "application/json", bodyReader) -} - -// NewPatchDashboardsIDCellsIDViewRequestWithBody generates requests for PatchDashboardsIDCellsIDView with any type of body -func NewPatchDashboardsIDCellsIDViewRequestWithBody(server string, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, cellID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/cells/%s/view", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsIDLabelsRequest generates requests for GetDashboardsIDLabels -func NewGetDashboardsIDLabelsRequest(server string, dashboardID string, params *GetDashboardsIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDashboardsIDLabelsRequest calls the generic PostDashboardsIDLabels builder with application/json body -func NewPostDashboardsIDLabelsRequest(server string, dashboardID string, params *PostDashboardsIDLabelsParams, body PostDashboardsIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDashboardsIDLabelsRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPostDashboardsIDLabelsRequestWithBody generates requests for PostDashboardsIDLabels with any type of body -func NewPostDashboardsIDLabelsRequestWithBody(server string, dashboardID string, params *PostDashboardsIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDashboardsIDLabelsIDRequest generates requests for DeleteDashboardsIDLabelsID -func NewDeleteDashboardsIDLabelsIDRequest(server string, dashboardID string, labelID string, params *DeleteDashboardsIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsIDMembersRequest generates requests for GetDashboardsIDMembers -func NewGetDashboardsIDMembersRequest(server string, dashboardID string, params *GetDashboardsIDMembersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDashboardsIDMembersRequest calls the generic PostDashboardsIDMembers builder with application/json body -func NewPostDashboardsIDMembersRequest(server string, dashboardID string, params *PostDashboardsIDMembersParams, body PostDashboardsIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDashboardsIDMembersRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPostDashboardsIDMembersRequestWithBody generates requests for PostDashboardsIDMembers with any type of body -func NewPostDashboardsIDMembersRequestWithBody(server string, dashboardID string, params *PostDashboardsIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDashboardsIDMembersIDRequest generates requests for DeleteDashboardsIDMembersID -func NewDeleteDashboardsIDMembersIDRequest(server string, dashboardID string, userID string, params *DeleteDashboardsIDMembersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDashboardsIDOwnersRequest generates requests for GetDashboardsIDOwners -func NewGetDashboardsIDOwnersRequest(server string, dashboardID string, params *GetDashboardsIDOwnersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDashboardsIDOwnersRequest calls the generic PostDashboardsIDOwners builder with application/json body -func NewPostDashboardsIDOwnersRequest(server string, dashboardID string, params *PostDashboardsIDOwnersParams, body PostDashboardsIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDashboardsIDOwnersRequestWithBody(server, dashboardID, params, "application/json", bodyReader) -} - -// NewPostDashboardsIDOwnersRequestWithBody generates requests for PostDashboardsIDOwners with any type of body -func NewPostDashboardsIDOwnersRequestWithBody(server string, dashboardID string, params *PostDashboardsIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDashboardsIDOwnersIDRequest generates requests for DeleteDashboardsIDOwnersID -func NewDeleteDashboardsIDOwnersIDRequest(server string, dashboardID string, userID string, params *DeleteDashboardsIDOwnersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, dashboardID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dashboards/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDBRPsRequest generates requests for GetDBRPs -func NewGetDBRPsRequest(server string, params *GetDBRPsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbrps") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Id != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.BucketID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucketID", runtime.ParamLocationQuery, *params.BucketID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Default != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "default", runtime.ParamLocationQuery, *params.Default); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Db != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "db", runtime.ParamLocationQuery, *params.Db); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Rp != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "rp", runtime.ParamLocationQuery, *params.Rp); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDBRPRequest calls the generic PostDBRP builder with application/json body -func NewPostDBRPRequest(server string, params *PostDBRPParams, body PostDBRPJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDBRPRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostDBRPRequestWithBody generates requests for PostDBRP with any type of body -func NewPostDBRPRequestWithBody(server string, params *PostDBRPParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbrps") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteDBRPIDRequest generates requests for DeleteDBRPID -func NewDeleteDBRPIDRequest(server string, dbrpID string, params *DeleteDBRPIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, dbrpID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbrps/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetDBRPsIDRequest generates requests for GetDBRPsID -func NewGetDBRPsIDRequest(server string, dbrpID string, params *GetDBRPsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, dbrpID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbrps/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchDBRPIDRequest calls the generic PatchDBRPID builder with application/json body -func NewPatchDBRPIDRequest(server string, dbrpID string, params *PatchDBRPIDParams, body PatchDBRPIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchDBRPIDRequestWithBody(server, dbrpID, params, "application/json", bodyReader) -} - -// NewPatchDBRPIDRequestWithBody generates requests for PatchDBRPID with any type of body -func NewPatchDBRPIDRequestWithBody(server string, dbrpID string, params *PatchDBRPIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, dbrpID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/dbrps/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostDeleteRequest calls the generic PostDelete builder with application/json body -func NewPostDeleteRequest(server string, params *PostDeleteParams, body PostDeleteJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostDeleteRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostDeleteRequestWithBody generates requests for PostDelete with any type of body -func NewPostDeleteRequestWithBody(server string, params *PostDeleteParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/delete") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Bucket != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucket", runtime.ParamLocationQuery, *params.Bucket); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.BucketID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucketID", runtime.ParamLocationQuery, *params.BucketID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetFlagsRequest generates requests for GetFlags -func NewGetFlagsRequest(server string, params *GetFlagsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/flags") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetHealthRequest generates requests for GetHealth -func NewGetHealthRequest(server string, params *GetHealthParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/health") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetLabelsRequest generates requests for GetLabels -func NewGetLabelsRequest(server string, params *GetLabelsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labels") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostLabelsRequest calls the generic PostLabels builder with application/json body -func NewPostLabelsRequest(server string, body PostLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostLabelsRequestWithBody(server, "application/json", bodyReader) -} - -// NewPostLabelsRequestWithBody generates requests for PostLabels with any type of body -func NewPostLabelsRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labels") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteLabelsIDRequest generates requests for DeleteLabelsID -func NewDeleteLabelsIDRequest(server string, labelID string, params *DeleteLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labels/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetLabelsIDRequest generates requests for GetLabelsID -func NewGetLabelsIDRequest(server string, labelID string, params *GetLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labels/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchLabelsIDRequest calls the generic PatchLabelsID builder with application/json body -func NewPatchLabelsIDRequest(server string, labelID string, params *PatchLabelsIDParams, body PatchLabelsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchLabelsIDRequestWithBody(server, labelID, params, "application/json", bodyReader) -} - -// NewPatchLabelsIDRequestWithBody generates requests for PatchLabelsID with any type of body -func NewPatchLabelsIDRequestWithBody(server string, labelID string, params *PatchLabelsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/labels/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetLegacyAuthorizationsRequest generates requests for GetLegacyAuthorizations -func NewGetLegacyAuthorizationsRequest(server string, params *GetLegacyAuthorizationsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.UserID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "userID", runtime.ParamLocationQuery, *params.UserID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.User != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user", runtime.ParamLocationQuery, *params.User); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Token != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "token", runtime.ParamLocationQuery, *params.Token); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.AuthID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "authID", runtime.ParamLocationQuery, *params.AuthID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostLegacyAuthorizationsRequest calls the generic PostLegacyAuthorizations builder with application/json body -func NewPostLegacyAuthorizationsRequest(server string, params *PostLegacyAuthorizationsParams, body PostLegacyAuthorizationsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostLegacyAuthorizationsRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostLegacyAuthorizationsRequestWithBody generates requests for PostLegacyAuthorizations with any type of body -func NewPostLegacyAuthorizationsRequestWithBody(server string, params *PostLegacyAuthorizationsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteLegacyAuthorizationsIDRequest generates requests for DeleteLegacyAuthorizationsID -func NewDeleteLegacyAuthorizationsIDRequest(server string, authID string, params *DeleteLegacyAuthorizationsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetLegacyAuthorizationsIDRequest generates requests for GetLegacyAuthorizationsID -func NewGetLegacyAuthorizationsIDRequest(server string, authID string, params *GetLegacyAuthorizationsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchLegacyAuthorizationsIDRequest calls the generic PatchLegacyAuthorizationsID builder with application/json body -func NewPatchLegacyAuthorizationsIDRequest(server string, authID string, params *PatchLegacyAuthorizationsIDParams, body PatchLegacyAuthorizationsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchLegacyAuthorizationsIDRequestWithBody(server, authID, params, "application/json", bodyReader) -} - -// NewPatchLegacyAuthorizationsIDRequestWithBody generates requests for PatchLegacyAuthorizationsID with any type of body -func NewPatchLegacyAuthorizationsIDRequestWithBody(server string, authID string, params *PatchLegacyAuthorizationsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostLegacyAuthorizationsIDPasswordRequest calls the generic PostLegacyAuthorizationsIDPassword builder with application/json body -func NewPostLegacyAuthorizationsIDPasswordRequest(server string, authID string, params *PostLegacyAuthorizationsIDPasswordParams, body PostLegacyAuthorizationsIDPasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostLegacyAuthorizationsIDPasswordRequestWithBody(server, authID, params, "application/json", bodyReader) -} - -// NewPostLegacyAuthorizationsIDPasswordRequestWithBody generates requests for PostLegacyAuthorizationsIDPassword with any type of body -func NewPostLegacyAuthorizationsIDPasswordRequestWithBody(server string, authID string, params *PostLegacyAuthorizationsIDPasswordParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "authID", runtime.ParamLocationPath, authID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/legacy/authorizations/%s/password", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetMeRequest generates requests for GetMe -func NewGetMeRequest(server string, params *GetMeParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/me") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPutMePasswordRequest calls the generic PutMePassword builder with application/json body -func NewPutMePasswordRequest(server string, params *PutMePasswordParams, body PutMePasswordJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPutMePasswordRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPutMePasswordRequestWithBody generates requests for PutMePassword with any type of body -func NewPutMePasswordRequestWithBody(server string, params *PutMePasswordParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/me/password") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetMetricsRequest generates requests for GetMetrics -func NewGetMetricsRequest(server string, params *GetMetricsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/metrics") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationEndpointsRequest generates requests for GetNotificationEndpoints -func NewGetNotificationEndpointsRequest(server string, params *GetNotificationEndpointsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewCreateNotificationEndpointRequest calls the generic CreateNotificationEndpoint builder with application/json body -func NewCreateNotificationEndpointRequest(server string, body CreateNotificationEndpointJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateNotificationEndpointRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateNotificationEndpointRequestWithBody generates requests for CreateNotificationEndpoint with any type of body -func NewCreateNotificationEndpointRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteNotificationEndpointsIDRequest generates requests for DeleteNotificationEndpointsID -func NewDeleteNotificationEndpointsIDRequest(server string, endpointID string, params *DeleteNotificationEndpointsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationEndpointsIDRequest generates requests for GetNotificationEndpointsID -func NewGetNotificationEndpointsIDRequest(server string, endpointID string, params *GetNotificationEndpointsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchNotificationEndpointsIDRequest calls the generic PatchNotificationEndpointsID builder with application/json body -func NewPatchNotificationEndpointsIDRequest(server string, endpointID string, params *PatchNotificationEndpointsIDParams, body PatchNotificationEndpointsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchNotificationEndpointsIDRequestWithBody(server, endpointID, params, "application/json", bodyReader) -} - -// NewPatchNotificationEndpointsIDRequestWithBody generates requests for PatchNotificationEndpointsID with any type of body -func NewPatchNotificationEndpointsIDRequestWithBody(server string, endpointID string, params *PatchNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPutNotificationEndpointsIDRequest calls the generic PutNotificationEndpointsID builder with application/json body -func NewPutNotificationEndpointsIDRequest(server string, endpointID string, params *PutNotificationEndpointsIDParams, body PutNotificationEndpointsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPutNotificationEndpointsIDRequestWithBody(server, endpointID, params, "application/json", bodyReader) -} - -// NewPutNotificationEndpointsIDRequestWithBody generates requests for PutNotificationEndpointsID with any type of body -func NewPutNotificationEndpointsIDRequestWithBody(server string, endpointID string, params *PutNotificationEndpointsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationEndpointsIDLabelsRequest generates requests for GetNotificationEndpointsIDLabels -func NewGetNotificationEndpointsIDLabelsRequest(server string, endpointID string, params *GetNotificationEndpointsIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostNotificationEndpointIDLabelsRequest calls the generic PostNotificationEndpointIDLabels builder with application/json body -func NewPostNotificationEndpointIDLabelsRequest(server string, endpointID string, params *PostNotificationEndpointIDLabelsParams, body PostNotificationEndpointIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostNotificationEndpointIDLabelsRequestWithBody(server, endpointID, params, "application/json", bodyReader) -} - -// NewPostNotificationEndpointIDLabelsRequestWithBody generates requests for PostNotificationEndpointIDLabels with any type of body -func NewPostNotificationEndpointIDLabelsRequestWithBody(server string, endpointID string, params *PostNotificationEndpointIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteNotificationEndpointsIDLabelsIDRequest generates requests for DeleteNotificationEndpointsIDLabelsID -func NewDeleteNotificationEndpointsIDLabelsIDRequest(server string, endpointID string, labelID string, params *DeleteNotificationEndpointsIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, endpointID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationEndpoints/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationRulesRequest generates requests for GetNotificationRules -func NewGetNotificationRulesRequest(server string, params *GetNotificationRulesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - if params.CheckID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "checkID", runtime.ParamLocationQuery, *params.CheckID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Tag != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "tag", runtime.ParamLocationQuery, *params.Tag); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewCreateNotificationRuleRequest calls the generic CreateNotificationRule builder with application/json body -func NewCreateNotificationRuleRequest(server string, body CreateNotificationRuleJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateNotificationRuleRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateNotificationRuleRequestWithBody generates requests for CreateNotificationRule with any type of body -func NewCreateNotificationRuleRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteNotificationRulesIDRequest generates requests for DeleteNotificationRulesID -func NewDeleteNotificationRulesIDRequest(server string, ruleID string, params *DeleteNotificationRulesIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationRulesIDRequest generates requests for GetNotificationRulesID -func NewGetNotificationRulesIDRequest(server string, ruleID string, params *GetNotificationRulesIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchNotificationRulesIDRequest calls the generic PatchNotificationRulesID builder with application/json body -func NewPatchNotificationRulesIDRequest(server string, ruleID string, params *PatchNotificationRulesIDParams, body PatchNotificationRulesIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchNotificationRulesIDRequestWithBody(server, ruleID, params, "application/json", bodyReader) -} - -// NewPatchNotificationRulesIDRequestWithBody generates requests for PatchNotificationRulesID with any type of body -func NewPatchNotificationRulesIDRequestWithBody(server string, ruleID string, params *PatchNotificationRulesIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPutNotificationRulesIDRequest calls the generic PutNotificationRulesID builder with application/json body -func NewPutNotificationRulesIDRequest(server string, ruleID string, params *PutNotificationRulesIDParams, body PutNotificationRulesIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPutNotificationRulesIDRequestWithBody(server, ruleID, params, "application/json", bodyReader) -} - -// NewPutNotificationRulesIDRequestWithBody generates requests for PutNotificationRulesID with any type of body -func NewPutNotificationRulesIDRequestWithBody(server string, ruleID string, params *PutNotificationRulesIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PUT", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationRulesIDLabelsRequest generates requests for GetNotificationRulesIDLabels -func NewGetNotificationRulesIDLabelsRequest(server string, ruleID string, params *GetNotificationRulesIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostNotificationRuleIDLabelsRequest calls the generic PostNotificationRuleIDLabels builder with application/json body -func NewPostNotificationRuleIDLabelsRequest(server string, ruleID string, params *PostNotificationRuleIDLabelsParams, body PostNotificationRuleIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostNotificationRuleIDLabelsRequestWithBody(server, ruleID, params, "application/json", bodyReader) -} - -// NewPostNotificationRuleIDLabelsRequestWithBody generates requests for PostNotificationRuleIDLabels with any type of body -func NewPostNotificationRuleIDLabelsRequestWithBody(server string, ruleID string, params *PostNotificationRuleIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteNotificationRulesIDLabelsIDRequest generates requests for DeleteNotificationRulesIDLabelsID -func NewDeleteNotificationRulesIDLabelsIDRequest(server string, ruleID string, labelID string, params *DeleteNotificationRulesIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetNotificationRulesIDQueryRequest generates requests for GetNotificationRulesIDQuery -func NewGetNotificationRulesIDQueryRequest(server string, ruleID string, params *GetNotificationRulesIDQueryParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, ruleID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/notificationRules/%s/query", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetOrgsRequest generates requests for GetOrgs -func NewGetOrgsRequest(server string, params *GetOrgsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Offset != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Descending != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "descending", runtime.ParamLocationQuery, *params.Descending); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.UserID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "userID", runtime.ParamLocationQuery, *params.UserID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostOrgsRequest calls the generic PostOrgs builder with application/json body -func NewPostOrgsRequest(server string, params *PostOrgsParams, body PostOrgsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostOrgsRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostOrgsRequestWithBody generates requests for PostOrgs with any type of body -func NewPostOrgsRequestWithBody(server string, params *PostOrgsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteOrgsIDRequest generates requests for DeleteOrgsID -func NewDeleteOrgsIDRequest(server string, orgID string, params *DeleteOrgsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetOrgsIDRequest generates requests for GetOrgsID -func NewGetOrgsIDRequest(server string, orgID string, params *GetOrgsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchOrgsIDRequest calls the generic PatchOrgsID builder with application/json body -func NewPatchOrgsIDRequest(server string, orgID string, params *PatchOrgsIDParams, body PatchOrgsIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchOrgsIDRequestWithBody(server, orgID, params, "application/json", bodyReader) -} - -// NewPatchOrgsIDRequestWithBody generates requests for PatchOrgsID with any type of body -func NewPatchOrgsIDRequestWithBody(server string, orgID string, params *PatchOrgsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetOrgsIDMembersRequest generates requests for GetOrgsIDMembers -func NewGetOrgsIDMembersRequest(server string, orgID string, params *GetOrgsIDMembersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostOrgsIDMembersRequest calls the generic PostOrgsIDMembers builder with application/json body -func NewPostOrgsIDMembersRequest(server string, orgID string, params *PostOrgsIDMembersParams, body PostOrgsIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostOrgsIDMembersRequestWithBody(server, orgID, params, "application/json", bodyReader) -} - -// NewPostOrgsIDMembersRequestWithBody generates requests for PostOrgsIDMembers with any type of body -func NewPostOrgsIDMembersRequestWithBody(server string, orgID string, params *PostOrgsIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteOrgsIDMembersIDRequest generates requests for DeleteOrgsIDMembersID -func NewDeleteOrgsIDMembersIDRequest(server string, orgID string, userID string, params *DeleteOrgsIDMembersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetOrgsIDOwnersRequest generates requests for GetOrgsIDOwners -func NewGetOrgsIDOwnersRequest(server string, orgID string, params *GetOrgsIDOwnersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostOrgsIDOwnersRequest calls the generic PostOrgsIDOwners builder with application/json body -func NewPostOrgsIDOwnersRequest(server string, orgID string, params *PostOrgsIDOwnersParams, body PostOrgsIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostOrgsIDOwnersRequestWithBody(server, orgID, params, "application/json", bodyReader) -} - -// NewPostOrgsIDOwnersRequestWithBody generates requests for PostOrgsIDOwners with any type of body -func NewPostOrgsIDOwnersRequestWithBody(server string, orgID string, params *PostOrgsIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteOrgsIDOwnersIDRequest generates requests for DeleteOrgsIDOwnersID -func NewDeleteOrgsIDOwnersIDRequest(server string, orgID string, userID string, params *DeleteOrgsIDOwnersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetOrgsIDSecretsRequest generates requests for GetOrgsIDSecrets -func NewGetOrgsIDSecretsRequest(server string, orgID string, params *GetOrgsIDSecretsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/secrets", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchOrgsIDSecretsRequest calls the generic PatchOrgsIDSecrets builder with application/json body -func NewPatchOrgsIDSecretsRequest(server string, orgID string, params *PatchOrgsIDSecretsParams, body PatchOrgsIDSecretsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchOrgsIDSecretsRequestWithBody(server, orgID, params, "application/json", bodyReader) -} - -// NewPatchOrgsIDSecretsRequestWithBody generates requests for PatchOrgsIDSecrets with any type of body -func NewPatchOrgsIDSecretsRequestWithBody(server string, orgID string, params *PatchOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/secrets", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostOrgsIDSecretsRequest calls the generic PostOrgsIDSecrets builder with application/json body -func NewPostOrgsIDSecretsRequest(server string, orgID string, params *PostOrgsIDSecretsParams, body PostOrgsIDSecretsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostOrgsIDSecretsRequestWithBody(server, orgID, params, "application/json", bodyReader) -} - -// NewPostOrgsIDSecretsRequestWithBody generates requests for PostOrgsIDSecrets with any type of body -func NewPostOrgsIDSecretsRequestWithBody(server string, orgID string, params *PostOrgsIDSecretsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/secrets/delete", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteOrgsIDSecretsIDRequest generates requests for DeleteOrgsIDSecretsID -func NewDeleteOrgsIDSecretsIDRequest(server string, orgID string, secretID string, params *DeleteOrgsIDSecretsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, orgID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "secretID", runtime.ParamLocationPath, secretID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/orgs/%s/secrets/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetPingRequest generates requests for GetPing -func NewGetPingRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ping") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewHeadPingRequest generates requests for HeadPing -func NewHeadPingRequest(server string) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ping") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("HEAD", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewPostQueryRequest calls the generic PostQuery builder with application/json body -func NewPostQueryRequest(server string, params *PostQueryParams, body PostQueryJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostQueryRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostQueryRequestWithBody generates requests for PostQuery with any type of body -func NewPostQueryRequestWithBody(server string, params *PostQueryParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/query") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.AcceptEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept-Encoding", runtime.ParamLocationHeader, *params.AcceptEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Accept-Encoding", headerParam1) - } - - if params.ContentType != nil { - var headerParam2 string - - headerParam2, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam2) - } - - return req, nil -} - -// NewPostQueryAnalyzeRequest calls the generic PostQueryAnalyze builder with application/json body -func NewPostQueryAnalyzeRequest(server string, params *PostQueryAnalyzeParams, body PostQueryAnalyzeJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostQueryAnalyzeRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostQueryAnalyzeRequestWithBody generates requests for PostQueryAnalyze with any type of body -func NewPostQueryAnalyzeRequestWithBody(server string, params *PostQueryAnalyzeParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/query/analyze") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentType != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam1) - } - - return req, nil -} - -// NewPostQueryAstRequest calls the generic PostQueryAst builder with application/json body -func NewPostQueryAstRequest(server string, params *PostQueryAstParams, body PostQueryAstJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostQueryAstRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostQueryAstRequestWithBody generates requests for PostQueryAst with any type of body -func NewPostQueryAstRequestWithBody(server string, params *PostQueryAstParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/query/ast") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentType != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam1) - } - - return req, nil -} - -// NewGetQuerySuggestionsRequest generates requests for GetQuerySuggestions -func NewGetQuerySuggestionsRequest(server string, params *GetQuerySuggestionsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/query/suggestions") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetQuerySuggestionsNameRequest generates requests for GetQuerySuggestionsName -func NewGetQuerySuggestionsNameRequest(server string, name string, params *GetQuerySuggestionsNameParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, name) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/query/suggestions/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetReadyRequest generates requests for GetReady -func NewGetReadyRequest(server string, params *GetReadyParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/ready") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetRemoteConnectionsRequest generates requests for GetRemoteConnections -func NewGetRemoteConnectionsRequest(server string, params *GetRemoteConnectionsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/remotes") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.RemoteURL != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "remoteURL", runtime.ParamLocationQuery, *params.RemoteURL); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostRemoteConnectionRequest calls the generic PostRemoteConnection builder with application/json body -func NewPostRemoteConnectionRequest(server string, body PostRemoteConnectionJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostRemoteConnectionRequestWithBody(server, "application/json", bodyReader) -} - -// NewPostRemoteConnectionRequestWithBody generates requests for PostRemoteConnection with any type of body -func NewPostRemoteConnectionRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/remotes") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteRemoteConnectionByIDRequest generates requests for DeleteRemoteConnectionByID -func NewDeleteRemoteConnectionByIDRequest(server string, remoteID string, params *DeleteRemoteConnectionByIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, remoteID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/remotes/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetRemoteConnectionByIDRequest generates requests for GetRemoteConnectionByID -func NewGetRemoteConnectionByIDRequest(server string, remoteID string, params *GetRemoteConnectionByIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, remoteID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/remotes/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchRemoteConnectionByIDRequest calls the generic PatchRemoteConnectionByID builder with application/json body -func NewPatchRemoteConnectionByIDRequest(server string, remoteID string, params *PatchRemoteConnectionByIDParams, body PatchRemoteConnectionByIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchRemoteConnectionByIDRequestWithBody(server, remoteID, params, "application/json", bodyReader) -} - -// NewPatchRemoteConnectionByIDRequestWithBody generates requests for PatchRemoteConnectionByID with any type of body -func NewPatchRemoteConnectionByIDRequestWithBody(server string, remoteID string, params *PatchRemoteConnectionByIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, remoteID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/remotes/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetReplicationsRequest generates requests for GetReplications -func NewGetReplicationsRequest(server string, params *GetReplicationsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.RemoteID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "remoteID", runtime.ParamLocationQuery, *params.RemoteID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.LocalBucketID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "localBucketID", runtime.ParamLocationQuery, *params.LocalBucketID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostReplicationRequest calls the generic PostReplication builder with application/json body -func NewPostReplicationRequest(server string, params *PostReplicationParams, body PostReplicationJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostReplicationRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostReplicationRequestWithBody generates requests for PostReplication with any type of body -func NewPostReplicationRequestWithBody(server string, params *PostReplicationParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Validate != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "validate", runtime.ParamLocationQuery, *params.Validate); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteReplicationByIDRequest generates requests for DeleteReplicationByID -func NewDeleteReplicationByIDRequest(server string, replicationID string, params *DeleteReplicationByIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, replicationID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetReplicationByIDRequest generates requests for GetReplicationByID -func NewGetReplicationByIDRequest(server string, replicationID string, params *GetReplicationByIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, replicationID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchReplicationByIDRequest calls the generic PatchReplicationByID builder with application/json body -func NewPatchReplicationByIDRequest(server string, replicationID string, params *PatchReplicationByIDParams, body PatchReplicationByIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchReplicationByIDRequestWithBody(server, replicationID, params, "application/json", bodyReader) -} - -// NewPatchReplicationByIDRequestWithBody generates requests for PatchReplicationByID with any type of body -func NewPatchReplicationByIDRequestWithBody(server string, replicationID string, params *PatchReplicationByIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, replicationID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Validate != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "validate", runtime.ParamLocationQuery, *params.Validate); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostValidateReplicationByIDRequest generates requests for PostValidateReplicationByID -func NewPostValidateReplicationByIDRequest(server string, replicationID string, params *PostValidateReplicationByIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, replicationID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/replications/%s/validate", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetResourcesRequest generates requests for GetResources -func NewGetResourcesRequest(server string, params *GetResourcesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/resources") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostRestoreBucketIDRequestWithBody generates requests for PostRestoreBucketID with any type of body -func NewPostRestoreBucketIDRequestWithBody(server string, bucketID string, params *PostRestoreBucketIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, bucketID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/restore/bucket/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentType != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam1) - } - - return req, nil -} - -// NewPostRestoreBucketMetadataRequest calls the generic PostRestoreBucketMetadata builder with application/json body -func NewPostRestoreBucketMetadataRequest(server string, params *PostRestoreBucketMetadataParams, body PostRestoreBucketMetadataJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostRestoreBucketMetadataRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostRestoreBucketMetadataRequestWithBody generates requests for PostRestoreBucketMetadata with any type of body -func NewPostRestoreBucketMetadataRequestWithBody(server string, params *PostRestoreBucketMetadataParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/restore/bucketMetadata") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostRestoreKVRequestWithBody generates requests for PostRestoreKV with any type of body -func NewPostRestoreKVRequestWithBody(server string, params *PostRestoreKVParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/restore/kv") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Encoding", runtime.ParamLocationHeader, *params.ContentEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Encoding", headerParam1) - } - - if params.ContentType != nil { - var headerParam2 string - - headerParam2, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam2) - } - - return req, nil -} - -// NewPostRestoreShardIdRequestWithBody generates requests for PostRestoreShardId with any type of body -func NewPostRestoreShardIdRequestWithBody(server string, shardID string, params *PostRestoreShardIdParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "shardID", runtime.ParamLocationPath, shardID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/restore/shards/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Encoding", runtime.ParamLocationHeader, *params.ContentEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Encoding", headerParam1) - } - - if params.ContentType != nil { - var headerParam2 string - - headerParam2, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam2) - } - - return req, nil -} - -// NewPostRestoreSQLRequestWithBody generates requests for PostRestoreSQL with any type of body -func NewPostRestoreSQLRequestWithBody(server string, params *PostRestoreSQLParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/restore/sql") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - if params.ContentEncoding != nil { - var headerParam1 string - - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Encoding", runtime.ParamLocationHeader, *params.ContentEncoding) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Encoding", headerParam1) - } - - if params.ContentType != nil { - var headerParam2 string - - headerParam2, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", headerParam2) - } - - return req, nil -} - -// NewGetScrapersRequest generates requests for GetScrapers -func NewGetScrapersRequest(server string, params *GetScrapersParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Id != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostScrapersRequest calls the generic PostScrapers builder with application/json body -func NewPostScrapersRequest(server string, params *PostScrapersParams, body PostScrapersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostScrapersRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostScrapersRequestWithBody generates requests for PostScrapers with any type of body -func NewPostScrapersRequestWithBody(server string, params *PostScrapersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteScrapersIDRequest generates requests for DeleteScrapersID -func NewDeleteScrapersIDRequest(server string, scraperTargetID string, params *DeleteScrapersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetScrapersIDRequest generates requests for GetScrapersID -func NewGetScrapersIDRequest(server string, scraperTargetID string, params *GetScrapersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchScrapersIDRequest calls the generic PatchScrapersID builder with application/json body -func NewPatchScrapersIDRequest(server string, scraperTargetID string, params *PatchScrapersIDParams, body PatchScrapersIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchScrapersIDRequestWithBody(server, scraperTargetID, params, "application/json", bodyReader) -} - -// NewPatchScrapersIDRequestWithBody generates requests for PatchScrapersID with any type of body -func NewPatchScrapersIDRequestWithBody(server string, scraperTargetID string, params *PatchScrapersIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetScrapersIDLabelsRequest generates requests for GetScrapersIDLabels -func NewGetScrapersIDLabelsRequest(server string, scraperTargetID string, params *GetScrapersIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostScrapersIDLabelsRequest calls the generic PostScrapersIDLabels builder with application/json body -func NewPostScrapersIDLabelsRequest(server string, scraperTargetID string, params *PostScrapersIDLabelsParams, body PostScrapersIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostScrapersIDLabelsRequestWithBody(server, scraperTargetID, params, "application/json", bodyReader) -} - -// NewPostScrapersIDLabelsRequestWithBody generates requests for PostScrapersIDLabels with any type of body -func NewPostScrapersIDLabelsRequestWithBody(server string, scraperTargetID string, params *PostScrapersIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteScrapersIDLabelsIDRequest generates requests for DeleteScrapersIDLabelsID -func NewDeleteScrapersIDLabelsIDRequest(server string, scraperTargetID string, labelID string, params *DeleteScrapersIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetScrapersIDMembersRequest generates requests for GetScrapersIDMembers -func NewGetScrapersIDMembersRequest(server string, scraperTargetID string, params *GetScrapersIDMembersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostScrapersIDMembersRequest calls the generic PostScrapersIDMembers builder with application/json body -func NewPostScrapersIDMembersRequest(server string, scraperTargetID string, params *PostScrapersIDMembersParams, body PostScrapersIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostScrapersIDMembersRequestWithBody(server, scraperTargetID, params, "application/json", bodyReader) -} - -// NewPostScrapersIDMembersRequestWithBody generates requests for PostScrapersIDMembers with any type of body -func NewPostScrapersIDMembersRequestWithBody(server string, scraperTargetID string, params *PostScrapersIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteScrapersIDMembersIDRequest generates requests for DeleteScrapersIDMembersID -func NewDeleteScrapersIDMembersIDRequest(server string, scraperTargetID string, userID string, params *DeleteScrapersIDMembersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetScrapersIDOwnersRequest generates requests for GetScrapersIDOwners -func NewGetScrapersIDOwnersRequest(server string, scraperTargetID string, params *GetScrapersIDOwnersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostScrapersIDOwnersRequest calls the generic PostScrapersIDOwners builder with application/json body -func NewPostScrapersIDOwnersRequest(server string, scraperTargetID string, params *PostScrapersIDOwnersParams, body PostScrapersIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostScrapersIDOwnersRequestWithBody(server, scraperTargetID, params, "application/json", bodyReader) -} - -// NewPostScrapersIDOwnersRequestWithBody generates requests for PostScrapersIDOwners with any type of body -func NewPostScrapersIDOwnersRequestWithBody(server string, scraperTargetID string, params *PostScrapersIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteScrapersIDOwnersIDRequest generates requests for DeleteScrapersIDOwnersID -func NewDeleteScrapersIDOwnersIDRequest(server string, scraperTargetID string, userID string, params *DeleteScrapersIDOwnersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, scraperTargetID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/scrapers/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetSetupRequest generates requests for GetSetup -func NewGetSetupRequest(server string, params *GetSetupParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/setup") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostSetupRequest calls the generic PostSetup builder with application/json body -func NewPostSetupRequest(server string, params *PostSetupParams, body PostSetupJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostSetupRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostSetupRequestWithBody generates requests for PostSetup with any type of body -func NewPostSetupRequestWithBody(server string, params *PostSetupParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/setup") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostSigninRequest generates requests for PostSignin -func NewPostSigninRequest(server string, params *PostSigninParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/signin") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostSignoutRequest generates requests for PostSignout -func NewPostSignoutRequest(server string, params *PostSignoutParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/signout") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetSourcesRequest generates requests for GetSources -func NewGetSourcesRequest(server string, params *GetSourcesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostSourcesRequest calls the generic PostSources builder with application/json body -func NewPostSourcesRequest(server string, params *PostSourcesParams, body PostSourcesJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostSourcesRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostSourcesRequestWithBody generates requests for PostSources with any type of body -func NewPostSourcesRequestWithBody(server string, params *PostSourcesParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteSourcesIDRequest generates requests for DeleteSourcesID -func NewDeleteSourcesIDRequest(server string, sourceID string, params *DeleteSourcesIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, sourceID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetSourcesIDRequest generates requests for GetSourcesID -func NewGetSourcesIDRequest(server string, sourceID string, params *GetSourcesIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, sourceID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchSourcesIDRequest calls the generic PatchSourcesID builder with application/json body -func NewPatchSourcesIDRequest(server string, sourceID string, params *PatchSourcesIDParams, body PatchSourcesIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchSourcesIDRequestWithBody(server, sourceID, params, "application/json", bodyReader) -} - -// NewPatchSourcesIDRequestWithBody generates requests for PatchSourcesID with any type of body -func NewPatchSourcesIDRequestWithBody(server string, sourceID string, params *PatchSourcesIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, sourceID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetSourcesIDBucketsRequest generates requests for GetSourcesIDBuckets -func NewGetSourcesIDBucketsRequest(server string, sourceID string, params *GetSourcesIDBucketsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, sourceID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources/%s/buckets", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetSourcesIDHealthRequest generates requests for GetSourcesIDHealth -func NewGetSourcesIDHealthRequest(server string, sourceID string, params *GetSourcesIDHealthParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, sourceID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/sources/%s/health", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewListStacksRequest generates requests for ListStacks -func NewListStacksRequest(server string, params *ListStacksParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.StackID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "stackID", runtime.ParamLocationQuery, *params.StackID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewCreateStackRequest calls the generic CreateStack builder with application/json body -func NewCreateStackRequest(server string, body CreateStackJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewCreateStackRequestWithBody(server, "application/json", bodyReader) -} - -// NewCreateStackRequestWithBody generates requests for CreateStack with any type of body -func NewCreateStackRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewDeleteStackRequest generates requests for DeleteStack -func NewDeleteStackRequest(server string, stackId string, params *DeleteStackParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, stackId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewReadStackRequest generates requests for ReadStack -func NewReadStackRequest(server string, stackId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, stackId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewUpdateStackRequest calls the generic UpdateStack builder with application/json body -func NewUpdateStackRequest(server string, stackId string, body UpdateStackJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewUpdateStackRequestWithBody(server, stackId, "application/json", bodyReader) -} - -// NewUpdateStackRequestWithBody generates requests for UpdateStack with any type of body -func NewUpdateStackRequestWithBody(server string, stackId string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, stackId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - return req, nil -} - -// NewUninstallStackRequest generates requests for UninstallStack -func NewUninstallStackRequest(server string, stackId string) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, stackId) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/stacks/%s/uninstall", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewGetTasksRequest generates requests for GetTasks -func NewGetTasksRequest(server string, params *GetTasksParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.After != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.User != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user", runtime.ParamLocationQuery, *params.User); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Status != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "status", runtime.ParamLocationQuery, *params.Status); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Type != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksRequest calls the generic PostTasks builder with application/json body -func NewPostTasksRequest(server string, params *PostTasksParams, body PostTasksJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTasksRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostTasksRequestWithBody generates requests for PostTasks with any type of body -func NewPostTasksRequestWithBody(server string, params *PostTasksParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteTasksIDRequest generates requests for DeleteTasksID -func NewDeleteTasksIDRequest(server string, taskID string, params *DeleteTasksIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDRequest generates requests for GetTasksID -func NewGetTasksIDRequest(server string, taskID string, params *GetTasksIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPatchTasksIDRequest calls the generic PatchTasksID builder with application/json body -func NewPatchTasksIDRequest(server string, taskID string, params *PatchTasksIDParams, body PatchTasksIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchTasksIDRequestWithBody(server, taskID, params, "application/json", bodyReader) -} - -// NewPatchTasksIDRequestWithBody generates requests for PatchTasksID with any type of body -func NewPatchTasksIDRequestWithBody(server string, taskID string, params *PatchTasksIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("PATCH", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDLabelsRequest generates requests for GetTasksIDLabels -func NewGetTasksIDLabelsRequest(server string, taskID string, params *GetTasksIDLabelsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksIDLabelsRequest calls the generic PostTasksIDLabels builder with application/json body -func NewPostTasksIDLabelsRequest(server string, taskID string, params *PostTasksIDLabelsParams, body PostTasksIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTasksIDLabelsRequestWithBody(server, taskID, params, "application/json", bodyReader) -} - -// NewPostTasksIDLabelsRequestWithBody generates requests for PostTasksIDLabels with any type of body -func NewPostTasksIDLabelsRequestWithBody(server string, taskID string, params *PostTasksIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteTasksIDLabelsIDRequest generates requests for DeleteTasksIDLabelsID -func NewDeleteTasksIDLabelsIDRequest(server string, taskID string, labelID string, params *DeleteTasksIDLabelsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDLogsRequest generates requests for GetTasksIDLogs -func NewGetTasksIDLogsRequest(server string, taskID string, params *GetTasksIDLogsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/logs", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDMembersRequest generates requests for GetTasksIDMembers -func NewGetTasksIDMembersRequest(server string, taskID string, params *GetTasksIDMembersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksIDMembersRequest calls the generic PostTasksIDMembers builder with application/json body -func NewPostTasksIDMembersRequest(server string, taskID string, params *PostTasksIDMembersParams, body PostTasksIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTasksIDMembersRequestWithBody(server, taskID, params, "application/json", bodyReader) -} - -// NewPostTasksIDMembersRequestWithBody generates requests for PostTasksIDMembers with any type of body -func NewPostTasksIDMembersRequestWithBody(server string, taskID string, params *PostTasksIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteTasksIDMembersIDRequest generates requests for DeleteTasksIDMembersID -func NewDeleteTasksIDMembersIDRequest(server string, taskID string, userID string, params *DeleteTasksIDMembersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDOwnersRequest generates requests for GetTasksIDOwners -func NewGetTasksIDOwnersRequest(server string, taskID string, params *GetTasksIDOwnersParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksIDOwnersRequest calls the generic PostTasksIDOwners builder with application/json body -func NewPostTasksIDOwnersRequest(server string, taskID string, params *PostTasksIDOwnersParams, body PostTasksIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTasksIDOwnersRequestWithBody(server, taskID, params, "application/json", bodyReader) -} - -// NewPostTasksIDOwnersRequestWithBody generates requests for PostTasksIDOwners with any type of body -func NewPostTasksIDOwnersRequestWithBody(server string, taskID string, params *PostTasksIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteTasksIDOwnersIDRequest generates requests for DeleteTasksIDOwnersID -func NewDeleteTasksIDOwnersIDRequest(server string, taskID string, userID string, params *DeleteTasksIDOwnersIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDRunsRequest generates requests for GetTasksIDRuns -func NewGetTasksIDRunsRequest(server string, taskID string, params *GetTasksIDRunsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - queryValues := queryURL.Query() - - if params.After != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.Limit != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.AfterTime != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "afterTime", runtime.ParamLocationQuery, *params.AfterTime); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.BeforeTime != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "beforeTime", runtime.ParamLocationQuery, *params.BeforeTime); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksIDRunsRequest calls the generic PostTasksIDRuns builder with application/json body -func NewPostTasksIDRunsRequest(server string, taskID string, params *PostTasksIDRunsParams, body PostTasksIDRunsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTasksIDRunsRequestWithBody(server, taskID, params, "application/json", bodyReader) -} - -// NewPostTasksIDRunsRequestWithBody generates requests for PostTasksIDRuns with any type of body -func NewPostTasksIDRunsRequestWithBody(server string, taskID string, params *PostTasksIDRunsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewDeleteTasksIDRunsIDRequest generates requests for DeleteTasksIDRunsID -func NewDeleteTasksIDRunsIDRequest(server string, taskID string, runID string, params *DeleteTasksIDRunsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, runID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDRunsIDRequest generates requests for GetTasksIDRunsID -func NewGetTasksIDRunsIDRequest(server string, taskID string, runID string, params *GetTasksIDRunsIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, runID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewGetTasksIDRunsIDLogsRequest generates requests for GetTasksIDRunsIDLogs -func NewGetTasksIDRunsIDLogsRequest(server string, taskID string, runID string, params *GetTasksIDRunsIDLogsParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, runID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs/%s/logs", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string - - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { - return nil, err - } - - req.Header.Set("Zap-Trace-Span", headerParam0) - } - - return req, nil -} - -// NewPostTasksIDRunsIDRetryRequestWithBody generates requests for PostTasksIDRunsIDRetry with any type of body -func NewPostTasksIDRunsIDRetryRequestWithBody(server string, taskID string, runID string, params *PostTasksIDRunsIDRetryParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, taskID) - if err != nil { - return nil, err - } - - var pathParam1 string - - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, runID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/tasks/%s/runs/%s/retry", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets") queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) + queryValues := queryURL.Query() - if params.ZapTraceSpan != nil { - var headerParam0 string + if params.Offset != nil { - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewGetTelegrafPluginsRequest generates requests for GetTelegrafPlugins -func NewGetTelegrafPluginsRequest(server string, params *GetTelegrafPluginsParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } + if params.Limit != nil { - operationPath := fmt.Sprintf("/telegraf/plugins") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err } - queryValues := queryURL.Query() - - if params.Type != nil { + if params.After != nil { - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err @@ -14288,51 +560,57 @@ func NewGetTelegrafPluginsRequest(server string, params *GetTelegrafPluginsParam } - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) - if err != nil { - return nil, err - } - - if params.ZapTraceSpan != nil { - var headerParam0 string + if params.Org != nil { - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + if params.OrgID != nil { -// NewGetTelegrafsRequest generates requests for GetTelegrafs -func NewGetTelegrafsRequest(server string, params *GetTelegrafsParams) (*http.Request, error) { - var err error + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - serverURL, err := url.Parse(server) - if err != nil { - return nil, err } - operationPath := fmt.Sprintf("/telegrafs") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + if params.Name != nil { - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - queryValues := queryURL.Query() + } - if params.OrgID != nil { + if params.Id != nil { - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err @@ -14364,45 +642,61 @@ func NewGetTelegrafsRequest(server string, params *GetTelegrafsParams) (*http.Re req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewPostTelegrafsRequest calls the generic PostTelegrafs builder with application/json body -func NewPostTelegrafsRequest(server string, params *PostTelegrafsParams, body PostTelegrafsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewPostTelegrafsRequestWithBody(server, params, "application/json", bodyReader) + + response := &Buckets{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewPostTelegrafsRequestWithBody generates requests for PostTelegrafs with any type of body -func NewPostTelegrafsRequestWithBody(server string, params *PostTelegrafsParams, contentType string, body io.Reader) (*http.Request, error) { +// PostBuckets calls the POST on /buckets +// Create a bucket +func (c *Client) PostBuckets(ctx context.Context, params *PostBucketsAllParams) (*Bucket, error) { var err error - - serverURL, err := url.Parse(server) + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - operationPath := fmt.Sprintf("/telegrafs") - if operationPath[0] == '/' { - operationPath = "." + operationPath + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } + operationPath := fmt.Sprintf("./buckets") + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -14415,38 +709,59 @@ func NewPostTelegrafsRequestWithBody(server string, params *PostTelegrafsParams, req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) + + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &Bucket{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewDeleteTelegrafsIDRequest generates requests for DeleteTelegrafsID -func NewDeleteTelegrafsIDRequest(server string, telegrafID string, params *DeleteTelegrafsIDParams) (*http.Request, error) { +// DeleteBucketsID calls the DELETE on /buckets/{bucketID} +// Delete a bucket +func (c *Client) DeleteBucketsID(ctx context.Context, params *DeleteBucketsIDAllParams) error { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { - return nil, err + return err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/telegrafs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } if params.ZapTraceSpan != nil { @@ -14454,35 +769,49 @@ func NewDeleteTelegrafsIDRequest(server string, telegrafID string, params *Delet headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) if err != nil { - return nil, err + return err } req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil + } -// NewGetTelegrafsIDRequest generates requests for GetTelegrafsID -func NewGetTelegrafsIDRequest(server string, telegrafID string, params *GetTelegrafsIDParams) (*http.Request, error) { +// GetBucketsID calls the GET on /buckets/{bucketID} +// Retrieve a bucket +func (c *Client) GetBucketsID(ctx context.Context, params *GetBucketsIDAllParams) (*Bucket, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -14505,63 +834,68 @@ func NewGetTelegrafsIDRequest(server string, telegrafID string, params *GetTeleg req.Header.Set("Zap-Trace-Span", headerParam0) } - if params.Accept != nil { - var headerParam1 string + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept) - if err != nil { + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &Bucket{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Accept", headerParam1) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewPutTelegrafsIDRequest calls the generic PutTelegrafsID builder with application/json body -func NewPutTelegrafsIDRequest(server string, telegrafID string, params *PutTelegrafsIDParams, body PutTelegrafsIDJSONRequestBody) (*http.Request, error) { +// PatchBucketsID calls the PATCH on /buckets/{bucketID} +// Update a bucket +func (c *Client) PatchBucketsID(ctx context.Context, params *PatchBucketsIDAllParams) (*Bucket, error) { + var err error var bodyReader io.Reader - buf, err := json.Marshal(body) + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPutTelegrafsIDRequestWithBody(server, telegrafID, params, "application/json", bodyReader) -} - -// NewPutTelegrafsIDRequestWithBody generates requests for PutTelegrafsID with any type of body -func NewPutTelegrafsIDRequestWithBody(server string, telegrafID string, params *PutTelegrafsIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("PUT", queryURL.String(), body) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -14574,29 +908,50 @@ func NewPutTelegrafsIDRequestWithBody(server string, telegrafID string, params * req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) + + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &Bucket{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewGetTelegrafsIDLabelsRequest generates requests for GetTelegrafsIDLabels -func NewGetTelegrafsIDLabelsRequest(server string, telegrafID string, params *GetTelegrafsIDLabelsParams) (*http.Request, error) { +// GetBucketsIDLabels calls the GET on /buckets/{bucketID}/labels +// List all labels for a bucket +func (c *Client) GetBucketsIDLabels(ctx context.Context, params *GetBucketsIDLabelsAllParams) (*LabelsResponse, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/labels", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -14619,52 +974,68 @@ func NewGetTelegrafsIDLabelsRequest(server string, telegrafID string, params *Ge req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewPostTelegrafsIDLabelsRequest calls the generic PostTelegrafsIDLabels builder with application/json body -func NewPostTelegrafsIDLabelsRequest(server string, telegrafID string, params *PostTelegrafsIDLabelsParams, body PostTelegrafsIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewPostTelegrafsIDLabelsRequestWithBody(server, telegrafID, params, "application/json", bodyReader) + + response := &LabelsResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewPostTelegrafsIDLabelsRequestWithBody generates requests for PostTelegrafsIDLabels with any type of body -func NewPostTelegrafsIDLabelsRequestWithBody(server string, telegrafID string, params *PostTelegrafsIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { +// PostBucketsIDLabels calls the POST on /buckets/{bucketID}/labels +// Add a label to a bucket +func (c *Client) PostBucketsIDLabels(ctx context.Context, params *PostBucketsIDLabelsAllParams) (*LabelResponse, error) { var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/labels", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -14677,45 +1048,66 @@ func NewPostTelegrafsIDLabelsRequestWithBody(server string, telegrafID string, p req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) + + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &LabelResponse{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewDeleteTelegrafsIDLabelsIDRequest generates requests for DeleteTelegrafsIDLabelsID -func NewDeleteTelegrafsIDLabelsIDRequest(server string, telegrafID string, labelID string, params *DeleteTelegrafsIDLabelsIDParams) (*http.Request, error) { +// DeleteBucketsIDLabelsID calls the DELETE on /buckets/{bucketID}/labels/{labelID} +// Delete a label from a bucket +func (c *Client) DeleteBucketsIDLabelsID(ctx context.Context, params *DeleteBucketsIDLabelsIDAllParams) error { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { - return nil, err + return err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) if err != nil { - return nil, err + return err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/telegrafs/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/labels/%s", pathParam0, pathParam1) queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } if params.ZapTraceSpan != nil { @@ -14723,35 +1115,49 @@ func NewDeleteTelegrafsIDLabelsIDRequest(server string, telegrafID string, label headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) if err != nil { - return nil, err + return err } req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil + } -// NewGetTelegrafsIDMembersRequest generates requests for GetTelegrafsIDMembers -func NewGetTelegrafsIDMembersRequest(server string, telegrafID string, params *GetTelegrafsIDMembersParams) (*http.Request, error) { +// GetBucketsIDMembers calls the GET on /buckets/{bucketID}/members +// List all users with member privileges for a bucket +func (c *Client) GetBucketsIDMembers(ctx context.Context, params *GetBucketsIDMembersAllParams) (*ResourceMembers, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/members", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -14774,52 +1180,68 @@ func NewGetTelegrafsIDMembersRequest(server string, telegrafID string, params *G req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewPostTelegrafsIDMembersRequest calls the generic PostTelegrafsIDMembers builder with application/json body -func NewPostTelegrafsIDMembersRequest(server string, telegrafID string, params *PostTelegrafsIDMembersParams, body PostTelegrafsIDMembersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewPostTelegrafsIDMembersRequestWithBody(server, telegrafID, params, "application/json", bodyReader) + + response := &ResourceMembers{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewPostTelegrafsIDMembersRequestWithBody generates requests for PostTelegrafsIDMembers with any type of body -func NewPostTelegrafsIDMembersRequestWithBody(server string, telegrafID string, params *PostTelegrafsIDMembersParams, contentType string, body io.Reader) (*http.Request, error) { +// PostBucketsIDMembers calls the POST on /buckets/{bucketID}/members +// Add a member to a bucket +func (c *Client) PostBucketsIDMembers(ctx context.Context, params *PostBucketsIDMembersAllParams) (*ResourceMember, error) { var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/members", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/members", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -14832,45 +1254,66 @@ func NewPostTelegrafsIDMembersRequestWithBody(server string, telegrafID string, req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) + + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ResourceMember{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewDeleteTelegrafsIDMembersIDRequest generates requests for DeleteTelegrafsIDMembersID -func NewDeleteTelegrafsIDMembersIDRequest(server string, telegrafID string, userID string, params *DeleteTelegrafsIDMembersIDParams) (*http.Request, error) { +// DeleteBucketsIDMembersID calls the DELETE on /buckets/{bucketID}/members/{userID} +// Remove a member from a bucket +func (c *Client) DeleteBucketsIDMembersID(ctx context.Context, params *DeleteBucketsIDMembersIDAllParams) error { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { - return nil, err + return err } var pathParam1 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { - return nil, err + return err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/telegrafs/%s/members/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/members/%s", pathParam0, pathParam1) queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } if params.ZapTraceSpan != nil { @@ -14878,35 +1321,49 @@ func NewDeleteTelegrafsIDMembersIDRequest(server string, telegrafID string, user headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) if err != nil { - return nil, err + return err } req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil + } -// NewGetTelegrafsIDOwnersRequest generates requests for GetTelegrafsIDOwners -func NewGetTelegrafsIDOwnersRequest(server string, telegrafID string, params *GetTelegrafsIDOwnersParams) (*http.Request, error) { +// GetBucketsIDOwners calls the GET on /buckets/{bucketID}/owners +// List all owners of a bucket +func (c *Client) GetBucketsIDOwners(ctx context.Context, params *GetBucketsIDOwnersAllParams) (*ResourceOwners, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/owners", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -14929,105 +1386,69 @@ func NewGetTelegrafsIDOwnersRequest(server string, telegrafID string, params *Ge req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewPostTelegrafsIDOwnersRequest calls the generic PostTelegrafsIDOwners builder with application/json body -func NewPostTelegrafsIDOwnersRequest(server string, telegrafID string, params *PostTelegrafsIDOwnersParams, body PostTelegrafsIDOwnersJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostTelegrafsIDOwnersRequestWithBody(server, telegrafID, params, "application/json", bodyReader) -} - -// NewPostTelegrafsIDOwnersRequestWithBody generates requests for PostTelegrafsIDOwners with any type of body -func NewPostTelegrafsIDOwnersRequestWithBody(server string, telegrafID string, params *PostTelegrafsIDOwnersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/telegrafs/%s/owners", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("POST", queryURL.String(), body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &ResourceOwners{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewDeleteTelegrafsIDOwnersIDRequest generates requests for DeleteTelegrafsIDOwnersID -func NewDeleteTelegrafsIDOwnersIDRequest(server string, telegrafID string, userID string, params *DeleteTelegrafsIDOwnersIDParams) (*http.Request, error) { +// PostBucketsIDOwners calls the POST on /buckets/{bucketID}/owners +// Add an owner to a bucket +func (c *Client) PostBucketsIDOwners(ctx context.Context, params *PostBucketsIDOwnersAllParams) (*ResourceOwner, error) { var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, telegrafID) + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - var pathParam1 string + var pathParam0 string - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/telegrafs/%s/owners/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./buckets/%s/owners", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } + req.Header.Add("Content-Type", "application/json") + if params.ZapTraceSpan != nil { var headerParam0 string @@ -15039,102 +1460,109 @@ func NewDeleteTelegrafsIDOwnersIDRequest(server string, telegrafID string, userI req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewApplyTemplateRequest calls the generic ApplyTemplate builder with application/json body -func NewApplyTemplateRequest(server string, body ApplyTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewApplyTemplateRequestWithBody(server, "application/json", bodyReader) + + response := &ResourceOwner{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewApplyTemplateRequestWithBody generates requests for ApplyTemplate with any type of body -func NewApplyTemplateRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { +// DeleteBucketsIDOwnersID calls the DELETE on /buckets/{bucketID}/owners/{userID} +// Remove an owner from a bucket +func (c *Client) DeleteBucketsIDOwnersID(ctx context.Context, params *DeleteBucketsIDOwnersIDAllParams) error { var err error - serverURL, err := url.Parse(server) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "bucketID", runtime.ParamLocationPath, params.BucketID) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/templates/apply") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + var pathParam1 string - queryURL, err := serverURL.Parse(operationPath) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { - return nil, err + return err } - req, err := http.NewRequest("POST", queryURL.String(), body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - req.Header.Add("Content-Type", contentType) - - return req, nil -} + operationPath := fmt.Sprintf("./buckets/%s/owners/%s", pathParam0, pathParam1) -// NewExportTemplateRequest calls the generic ExportTemplate builder with application/json body -func NewExportTemplateRequest(server string, body ExportTemplateJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - bodyReader = bytes.NewReader(buf) - return NewExportTemplateRequestWithBody(server, "application/json", bodyReader) -} -// NewExportTemplateRequestWithBody generates requests for ExportTemplate with any type of body -func NewExportTemplateRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/templates/export") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + if params.ZapTraceSpan != nil { + var headerParam0 string - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - req, err := http.NewRequest("POST", queryURL.String(), body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - req.Header.Add("Content-Type", contentType) + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil - return req, nil } -// NewGetUsersRequest generates requests for GetUsers -func NewGetUsersRequest(server string, params *GetUsersParams) (*http.Request, error) { +// GetChecks calls the GET on /checks +// List all checks +func (c *Client) GetChecks(ctx context.Context, params *GetChecksParams) (*Checks, error) { var err error - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/users") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks") queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -15175,155 +1603,145 @@ func NewGetUsersRequest(server string, params *GetUsersParams) (*http.Request, e } - if params.After != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) } } - } - if params.Name != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } + queryURL.RawQuery = queryValues.Encode() + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - if params.Id != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } } + req.Header.Set("Zap-Trace-Span", headerParam0) } - queryURL.RawQuery = queryValues.Encode() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("GET", queryURL.String(), nil) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &Checks{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewPostUsersRequest calls the generic PostUsers builder with application/json body -func NewPostUsersRequest(server string, params *PostUsersParams, body PostUsersJSONRequestBody) (*http.Request, error) { +// CreateCheck calls the POST on /checks +// Add new check +func (c *Client) CreateCheck(ctx context.Context, params *CreateCheckAllParams) (*Check, error) { + var err error var bodyReader io.Reader - buf, err := json.Marshal(body) + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostUsersRequestWithBody(server, params, "application/json", bodyReader) -} - -// NewPostUsersRequestWithBody generates requests for PostUsers with any type of body -func NewPostUsersRequestWithBody(server string, params *PostUsersParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/users") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks") queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") - if params.ZapTraceSpan != nil { - var headerParam0 string + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &Check{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewDeleteUsersIDRequest generates requests for DeleteUsersID -func NewDeleteUsersIDRequest(server string, userID string, params *DeleteUsersIDParams) (*http.Request, error) { +// DeleteChecksID calls the DELETE on /checks/{checkID} +// Delete a check +func (c *Client) DeleteChecksID(ctx context.Context, params *DeleteChecksIDAllParams) error { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { - return nil, err + return err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/users/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } if params.ZapTraceSpan != nil { @@ -15331,35 +1749,49 @@ func NewDeleteUsersIDRequest(server string, userID string, params *DeleteUsersID headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) if err != nil { - return nil, err + return err } req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil + } -// NewGetUsersIDRequest generates requests for GetUsersID -func NewGetUsersIDRequest(server string, userID string, params *GetUsersIDParams) (*http.Request, error) { +// GetChecksID calls the GET on /checks/{checkID} +// Retrieve a check +func (c *Client) GetChecksID(ctx context.Context, params *GetChecksIDAllParams) (*Check, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/users/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -15382,110 +1814,68 @@ func NewGetUsersIDRequest(server string, userID string, params *GetUsersIDParams req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewPatchUsersIDRequest calls the generic PatchUsersID builder with application/json body -func NewPatchUsersIDRequest(server string, userID string, params *PatchUsersIDParams, body PatchUsersIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPatchUsersIDRequestWithBody(server, userID, params, "application/json", bodyReader) -} - -// NewPatchUsersIDRequestWithBody generates requests for PatchUsersID with any type of body -func NewPatchUsersIDRequestWithBody(server string, userID string, params *PatchUsersIDParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/users/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("PATCH", queryURL.String(), body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &Check{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewPostUsersIDPasswordRequest calls the generic PostUsersIDPassword builder with application/json body -func NewPostUsersIDPasswordRequest(server string, userID string, params *PostUsersIDPasswordParams, body PostUsersIDPasswordJSONRequestBody) (*http.Request, error) { +// PatchChecksID calls the PATCH on /checks/{checkID} +// Update a check +func (c *Client) PatchChecksID(ctx context.Context, params *PatchChecksIDAllParams) (*Check, error) { + var err error var bodyReader io.Reader - buf, err := json.Marshal(body) + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostUsersIDPasswordRequestWithBody(server, userID, params, "application/json", bodyReader) -} - -// NewPostUsersIDPasswordRequestWithBody generates requests for PostUsersIDPassword with any type of body -func NewPostUsersIDPasswordRequestWithBody(server string, userID string, params *PostUsersIDPasswordParams, contentType string, body io.Reader) (*http.Request, error) { - var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, userID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/users/%s/password", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -15498,119 +1888,68 @@ func NewPostUsersIDPasswordRequestWithBody(server string, userID string, params req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewGetVariablesRequest generates requests for GetVariables -func NewGetVariablesRequest(server string, params *GetVariablesParams) (*http.Request, error) { - var err error - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/variables") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - queryValues := queryURL.Query() - - if params.Org != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - if params.OrgID != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("GET", queryURL.String(), nil) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &Check{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewPostVariablesRequest calls the generic PostVariables builder with application/json body -func NewPostVariablesRequest(server string, params *PostVariablesParams, body PostVariablesJSONRequestBody) (*http.Request, error) { +// PutChecksID calls the PUT on /checks/{checkID} +// Update a check +func (c *Client) PutChecksID(ctx context.Context, params *PutChecksIDAllParams) (*Check, error) { + var err error var bodyReader io.Reader - buf, err := json.Marshal(body) + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewPostVariablesRequestWithBody(server, params, "application/json", bodyReader) -} -// NewPostVariablesRequestWithBody generates requests for PostVariables with any type of body -func NewPostVariablesRequestWithBody(server string, params *PostVariablesParams, contentType string, body io.Reader) (*http.Request, error) { - var err error + var pathParam0 string - serverURL, err := url.Parse(server) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/variables") - if operationPath[0] == '/' { - operationPath = "." + operationPath + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } + operationPath := fmt.Sprintf("./checks/%s", pathParam0) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), body) + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -15623,74 +1962,50 @@ func NewPostVariablesRequestWithBody(server string, params *PostVariablesParams, req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewDeleteVariablesIDRequest generates requests for DeleteVariablesID -func NewDeleteVariablesIDRequest(server string, variableID string, params *DeleteVariablesIDParams) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/variables/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &Check{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewGetVariablesIDRequest generates requests for GetVariablesID -func NewGetVariablesIDRequest(server string, variableID string, params *GetVariablesIDParams) (*http.Request, error) { +// GetChecksIDLabels calls the GET on /checks/{checkID}/labels +// List all labels for a check +func (c *Client) GetChecksIDLabels(ctx context.Context, params *GetChecksIDLabelsAllParams) (*LabelsResponse, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/variables/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s/labels", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -15713,52 +2028,68 @@ func NewGetVariablesIDRequest(server string, variableID string, params *GetVaria req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewPatchVariablesIDRequest calls the generic PatchVariablesID builder with application/json body -func NewPatchVariablesIDRequest(server string, variableID string, params *PatchVariablesIDParams, body PatchVariablesIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewPatchVariablesIDRequestWithBody(server, variableID, params, "application/json", bodyReader) + + response := &LabelsResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewPatchVariablesIDRequestWithBody generates requests for PatchVariablesID with any type of body -func NewPatchVariablesIDRequestWithBody(server string, variableID string, params *PatchVariablesIDParams, contentType string, body io.Reader) (*http.Request, error) { +// PostChecksIDLabels calls the POST on /checks/{checkID}/labels +// Add a label to a check +func (c *Client) PostChecksIDLabels(ctx context.Context, params *PostChecksIDLabelsAllParams) (*LabelResponse, error) { var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/variables/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s/labels", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - req, err := http.NewRequest("PATCH", queryURL.String(), body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) + req.Header.Add("Content-Type", "application/json") if params.ZapTraceSpan != nil { var headerParam0 string @@ -15771,87 +2102,116 @@ func NewPatchVariablesIDRequestWithBody(server string, variableID string, params req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// NewPutVariablesIDRequest calls the generic PutVariablesID builder with application/json body -func NewPutVariablesIDRequest(server string, variableID string, params *PutVariablesIDParams, body PutVariablesIDJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewPutVariablesIDRequestWithBody(server, variableID, params, "application/json", bodyReader) + + response := &LabelResponse{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// NewPutVariablesIDRequestWithBody generates requests for PutVariablesID with any type of body -func NewPutVariablesIDRequestWithBody(server string, variableID string, params *PutVariablesIDParams, contentType string, body io.Reader) (*http.Request, error) { +// DeleteChecksIDLabelsID calls the DELETE on /checks/{checkID}/labels/{labelID} +// Delete label from a check +func (c *Client) DeleteChecksIDLabelsID(ctx context.Context, params *DeleteChecksIDLabelsIDAllParams) error { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { - return nil, err + return err } - serverURL, err := url.Parse(server) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) if err != nil { - return nil, err + return err } - operationPath := fmt.Sprintf("/variables/%s", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } + operationPath := fmt.Sprintf("./checks/%s/labels/%s", pathParam0, pathParam1) + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - req, err := http.NewRequest("PUT", queryURL.String(), body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - req.Header.Add("Content-Type", contentType) - if params.ZapTraceSpan != nil { var headerParam0 string headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) if err != nil { - return nil, err + return err } req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil + } -// NewGetVariablesIDLabelsRequest generates requests for GetVariablesIDLabels -func NewGetVariablesIDLabelsRequest(server string, variableID string, params *GetVariablesIDLabelsParams) (*http.Request, error) { +// GetChecksIDQuery calls the GET on /checks/{checkID}/query +// Retrieve a check query +func (c *Client) GetChecksIDQuery(ctx context.Context, params *GetChecksIDQueryAllParams) (*FluxResponse, error) { var err error var pathParam0 string - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "checkID", runtime.ParamLocationPath, params.CheckID) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/variables/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./checks/%s/query", pathParam0) queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -15874,132 +2234,102 @@ func NewGetVariablesIDLabelsRequest(server string, variableID string, params *Ge req.Header.Set("Zap-Trace-Span", headerParam0) } - return req, nil -} - -// NewPostVariablesIDLabelsRequest calls the generic PostVariablesIDLabels builder with application/json body -func NewPostVariablesIDLabelsRequest(server string, variableID string, params *PostVariablesIDLabelsParams, body PostVariablesIDLabelsJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return NewPostVariablesIDLabelsRequestWithBody(server, variableID, params, "application/json", bodyReader) -} - -// NewPostVariablesIDLabelsRequestWithBody generates requests for PostVariablesIDLabels with any type of body -func NewPostVariablesIDLabelsRequestWithBody(server string, variableID string, params *PostVariablesIDLabelsParams, contentType string, body io.Reader) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/variables/%s/labels", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("POST", queryURL.String(), body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &FluxResponse{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewDeleteVariablesIDLabelsIDRequest generates requests for DeleteVariablesIDLabelsID -func NewDeleteVariablesIDLabelsIDRequest(server string, variableID string, labelID string, params *DeleteVariablesIDLabelsIDParams) (*http.Request, error) { +// GetConfig calls the GET on /config +// Retrieve runtime configuration +func (c *Client) GetConfig(ctx context.Context, params *GetConfigParams) (*Config, error) { var err error - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, variableID) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - var pathParam1 string + operationPath := fmt.Sprintf("./config") - pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, labelID) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - serverURL, err := url.Parse(server) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/variables/%s/labels/%s", pathParam0, pathParam1) - if operationPath[0] == '/' { - operationPath = "." + operationPath + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - queryURL, err := serverURL.Parse(operationPath) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - req, err := http.NewRequest("DELETE", queryURL.String(), nil) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - if params.ZapTraceSpan != nil { - var headerParam0 string + response := &Config{} - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - - req.Header.Set("Zap-Trace-Span", headerParam0) + default: + return nil, decodeError(bodyBytes, rsp) } + return response, nil - return req, nil } -// NewPostWriteRequestWithBody generates requests for PostWrite with any type of body -func NewPostWriteRequestWithBody(server string, params *PostWriteParams, contentType string, body io.Reader) (*http.Request, error) { +// GetDashboards calls the GET on /dashboards +// List all dashboards +func (c *Client) GetDashboards(ctx context.Context, params *GetDashboardsParams) (*Dashboards, error) { var err error - serverURL, err := url.Parse(server) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/write") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + operationPath := fmt.Sprintf("./dashboards") queryURL, err := serverURL.Parse(operationPath) if err != nil { @@ -16008,21 +2338,9 @@ func NewPostWriteRequestWithBody(server string, params *PostWriteParams, content queryValues := queryURL.Query() - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, params.Org); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - if params.OrgID != nil { + if params.Offset != nil { - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err @@ -16036,21 +2354,25 @@ func NewPostWriteRequestWithBody(server string, params *PostWriteParams, content } - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucket", runtime.ParamLocationQuery, params.Bucket); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } } } + } - if params.Precision != nil { + if params.Descending != nil { - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "precision", runtime.ParamLocationQuery, *params.Precision); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "descending", runtime.ParamLocationQuery, *params.Descending); err != nil { return nil, err } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err @@ -16064,17092 +2386,12460 @@ func NewPostWriteRequestWithBody(server string, params *PostWriteParams, content } - queryURL.RawQuery = queryValues.Encode() - - req, err := http.NewRequest("POST", queryURL.String(), body) - if err != nil { - return nil, err - } - - req.Header.Add("Content-Type", contentType) - - if params.ZapTraceSpan != nil { - var headerParam0 string + if params.Owner != nil { - headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "owner", runtime.ParamLocationQuery, *params.Owner); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Zap-Trace-Span", headerParam0) } - if params.ContentEncoding != nil { - var headerParam1 string + if params.SortBy != nil { - headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Encoding", runtime.ParamLocationHeader, *params.ContentEncoding) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sortBy", runtime.ParamLocationQuery, *params.SortBy); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Content-Encoding", headerParam1) } - if params.ContentType != nil { - var headerParam2 string + if params.Id != nil { - headerParam2, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Content-Type", headerParam2) } - if params.ContentLength != nil { - var headerParam3 string + if params.OrgID != nil { - headerParam3, err = runtime.StyleParamWithLocation("simple", false, "Content-Length", runtime.ParamLocationHeader, *params.ContentLength) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Content-Length", headerParam3) } - if params.Accept != nil { - var headerParam4 string + if params.Org != nil { - headerParam4, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept) - if err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - req.Header.Set("Accept", headerParam4) } - return req, nil -} - -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface -} - -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(service ihttp.Service) *ClientWithResponses { - client := NewClient(service) - return &ClientWithResponses{client} -} - -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { - // GetRoutes request - GetRoutesWithResponse(ctx context.Context, params *GetRoutesParams) (*GetRoutesResponse, error) - - // GetAuthorizations request - GetAuthorizationsWithResponse(ctx context.Context, params *GetAuthorizationsParams) (*GetAuthorizationsResponse, error) - - // PostAuthorizations request with any body - PostAuthorizationsWithBodyWithResponse(ctx context.Context, params *PostAuthorizationsParams, contentType string, body io.Reader) (*PostAuthorizationsResponse, error) - - PostAuthorizationsWithResponse(ctx context.Context, params *PostAuthorizationsParams, body PostAuthorizationsJSONRequestBody) (*PostAuthorizationsResponse, error) - - // DeleteAuthorizationsID request - DeleteAuthorizationsIDWithResponse(ctx context.Context, authID string, params *DeleteAuthorizationsIDParams) (*DeleteAuthorizationsIDResponse, error) - - // GetAuthorizationsID request - GetAuthorizationsIDWithResponse(ctx context.Context, authID string, params *GetAuthorizationsIDParams) (*GetAuthorizationsIDResponse, error) - - // PatchAuthorizationsID request with any body - PatchAuthorizationsIDWithBodyWithResponse(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, contentType string, body io.Reader) (*PatchAuthorizationsIDResponse, error) - - PatchAuthorizationsIDWithResponse(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, body PatchAuthorizationsIDJSONRequestBody) (*PatchAuthorizationsIDResponse, error) - - // GetBackupKV request - GetBackupKVWithResponse(ctx context.Context, params *GetBackupKVParams) (*GetBackupKVResponse, error) - - // GetBackupMetadata request - GetBackupMetadataWithResponse(ctx context.Context, params *GetBackupMetadataParams) (*GetBackupMetadataResponse, error) - - // GetBackupShardId request - GetBackupShardIdWithResponse(ctx context.Context, shardID int64, params *GetBackupShardIdParams) (*GetBackupShardIdResponse, error) - - // GetBuckets request - GetBucketsWithResponse(ctx context.Context, params *GetBucketsParams) (*GetBucketsResponse, error) - - // PostBuckets request with any body - PostBucketsWithBodyWithResponse(ctx context.Context, params *PostBucketsParams, contentType string, body io.Reader) (*PostBucketsResponse, error) - - PostBucketsWithResponse(ctx context.Context, params *PostBucketsParams, body PostBucketsJSONRequestBody) (*PostBucketsResponse, error) - - // DeleteBucketsID request - DeleteBucketsIDWithResponse(ctx context.Context, bucketID string, params *DeleteBucketsIDParams) (*DeleteBucketsIDResponse, error) - - // GetBucketsID request - GetBucketsIDWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDParams) (*GetBucketsIDResponse, error) - - // PatchBucketsID request with any body - PatchBucketsIDWithBodyWithResponse(ctx context.Context, bucketID string, params *PatchBucketsIDParams, contentType string, body io.Reader) (*PatchBucketsIDResponse, error) - - PatchBucketsIDWithResponse(ctx context.Context, bucketID string, params *PatchBucketsIDParams, body PatchBucketsIDJSONRequestBody) (*PatchBucketsIDResponse, error) - - // GetBucketsIDLabels request - GetBucketsIDLabelsWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDLabelsParams) (*GetBucketsIDLabelsResponse, error) - - // PostBucketsIDLabels request with any body - PostBucketsIDLabelsWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, contentType string, body io.Reader) (*PostBucketsIDLabelsResponse, error) - - PostBucketsIDLabelsWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, body PostBucketsIDLabelsJSONRequestBody) (*PostBucketsIDLabelsResponse, error) - - // DeleteBucketsIDLabelsID request - DeleteBucketsIDLabelsIDWithResponse(ctx context.Context, bucketID string, labelID string, params *DeleteBucketsIDLabelsIDParams) (*DeleteBucketsIDLabelsIDResponse, error) - - // GetBucketsIDMembers request - GetBucketsIDMembersWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDMembersParams) (*GetBucketsIDMembersResponse, error) - - // PostBucketsIDMembers request with any body - PostBucketsIDMembersWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, contentType string, body io.Reader) (*PostBucketsIDMembersResponse, error) - - PostBucketsIDMembersWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, body PostBucketsIDMembersJSONRequestBody) (*PostBucketsIDMembersResponse, error) - - // DeleteBucketsIDMembersID request - DeleteBucketsIDMembersIDWithResponse(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDMembersIDParams) (*DeleteBucketsIDMembersIDResponse, error) - - // GetBucketsIDOwners request - GetBucketsIDOwnersWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDOwnersParams) (*GetBucketsIDOwnersResponse, error) - - // PostBucketsIDOwners request with any body - PostBucketsIDOwnersWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, contentType string, body io.Reader) (*PostBucketsIDOwnersResponse, error) - - PostBucketsIDOwnersWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, body PostBucketsIDOwnersJSONRequestBody) (*PostBucketsIDOwnersResponse, error) - - // DeleteBucketsIDOwnersID request - DeleteBucketsIDOwnersIDWithResponse(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDOwnersIDParams) (*DeleteBucketsIDOwnersIDResponse, error) - - // GetChecks request - GetChecksWithResponse(ctx context.Context, params *GetChecksParams) (*GetChecksResponse, error) - - // CreateCheck request with any body - CreateCheckWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateCheckResponse, error) - - CreateCheckWithResponse(ctx context.Context, body CreateCheckJSONRequestBody) (*CreateCheckResponse, error) - - // DeleteChecksID request - DeleteChecksIDWithResponse(ctx context.Context, checkID string, params *DeleteChecksIDParams) (*DeleteChecksIDResponse, error) - - // GetChecksID request - GetChecksIDWithResponse(ctx context.Context, checkID string, params *GetChecksIDParams) (*GetChecksIDResponse, error) - - // PatchChecksID request with any body - PatchChecksIDWithBodyWithResponse(ctx context.Context, checkID string, params *PatchChecksIDParams, contentType string, body io.Reader) (*PatchChecksIDResponse, error) - - PatchChecksIDWithResponse(ctx context.Context, checkID string, params *PatchChecksIDParams, body PatchChecksIDJSONRequestBody) (*PatchChecksIDResponse, error) - - // PutChecksID request with any body - PutChecksIDWithBodyWithResponse(ctx context.Context, checkID string, params *PutChecksIDParams, contentType string, body io.Reader) (*PutChecksIDResponse, error) - - PutChecksIDWithResponse(ctx context.Context, checkID string, params *PutChecksIDParams, body PutChecksIDJSONRequestBody) (*PutChecksIDResponse, error) - - // GetChecksIDLabels request - GetChecksIDLabelsWithResponse(ctx context.Context, checkID string, params *GetChecksIDLabelsParams) (*GetChecksIDLabelsResponse, error) - - // PostChecksIDLabels request with any body - PostChecksIDLabelsWithBodyWithResponse(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, contentType string, body io.Reader) (*PostChecksIDLabelsResponse, error) - - PostChecksIDLabelsWithResponse(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, body PostChecksIDLabelsJSONRequestBody) (*PostChecksIDLabelsResponse, error) - - // DeleteChecksIDLabelsID request - DeleteChecksIDLabelsIDWithResponse(ctx context.Context, checkID string, labelID string, params *DeleteChecksIDLabelsIDParams) (*DeleteChecksIDLabelsIDResponse, error) - - // GetChecksIDQuery request - GetChecksIDQueryWithResponse(ctx context.Context, checkID string, params *GetChecksIDQueryParams) (*GetChecksIDQueryResponse, error) - - // GetConfig request - GetConfigWithResponse(ctx context.Context, params *GetConfigParams) (*GetConfigResponse, error) - - // GetDashboards request - GetDashboardsWithResponse(ctx context.Context, params *GetDashboardsParams) (*GetDashboardsResponse, error) - - // PostDashboards request with any body - PostDashboardsWithBodyWithResponse(ctx context.Context, params *PostDashboardsParams, contentType string, body io.Reader) (*PostDashboardsResponse, error) - - PostDashboardsWithResponse(ctx context.Context, params *PostDashboardsParams, body PostDashboardsJSONRequestBody) (*PostDashboardsResponse, error) - - // DeleteDashboardsID request - DeleteDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *DeleteDashboardsIDParams) (*DeleteDashboardsIDResponse, error) - - // GetDashboardsID request - GetDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDParams) (*GetDashboardsIDResponse, error) - - // PatchDashboardsID request with any body - PatchDashboardsIDWithBodyWithResponse(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, contentType string, body io.Reader) (*PatchDashboardsIDResponse, error) - - PatchDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, body PatchDashboardsIDJSONRequestBody) (*PatchDashboardsIDResponse, error) - - // PostDashboardsIDCells request with any body - PostDashboardsIDCellsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, contentType string, body io.Reader) (*PostDashboardsIDCellsResponse, error) - - PostDashboardsIDCellsWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, body PostDashboardsIDCellsJSONRequestBody) (*PostDashboardsIDCellsResponse, error) - - // PutDashboardsIDCells request with any body - PutDashboardsIDCellsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, contentType string, body io.Reader) (*PutDashboardsIDCellsResponse, error) - - PutDashboardsIDCellsWithResponse(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, body PutDashboardsIDCellsJSONRequestBody) (*PutDashboardsIDCellsResponse, error) - - // DeleteDashboardsIDCellsID request - DeleteDashboardsIDCellsIDWithResponse(ctx context.Context, dashboardID string, cellID string, params *DeleteDashboardsIDCellsIDParams) (*DeleteDashboardsIDCellsIDResponse, error) - - // PatchDashboardsIDCellsID request with any body - PatchDashboardsIDCellsIDWithBodyWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, contentType string, body io.Reader) (*PatchDashboardsIDCellsIDResponse, error) - - PatchDashboardsIDCellsIDWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, body PatchDashboardsIDCellsIDJSONRequestBody) (*PatchDashboardsIDCellsIDResponse, error) - - // GetDashboardsIDCellsIDView request - GetDashboardsIDCellsIDViewWithResponse(ctx context.Context, dashboardID string, cellID string, params *GetDashboardsIDCellsIDViewParams) (*GetDashboardsIDCellsIDViewResponse, error) - - // PatchDashboardsIDCellsIDView request with any body - PatchDashboardsIDCellsIDViewWithBodyWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, contentType string, body io.Reader) (*PatchDashboardsIDCellsIDViewResponse, error) - - PatchDashboardsIDCellsIDViewWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, body PatchDashboardsIDCellsIDViewJSONRequestBody) (*PatchDashboardsIDCellsIDViewResponse, error) - - // GetDashboardsIDLabels request - GetDashboardsIDLabelsWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDLabelsParams) (*GetDashboardsIDLabelsResponse, error) - - // PostDashboardsIDLabels request with any body - PostDashboardsIDLabelsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, contentType string, body io.Reader) (*PostDashboardsIDLabelsResponse, error) - - PostDashboardsIDLabelsWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, body PostDashboardsIDLabelsJSONRequestBody) (*PostDashboardsIDLabelsResponse, error) - - // DeleteDashboardsIDLabelsID request - DeleteDashboardsIDLabelsIDWithResponse(ctx context.Context, dashboardID string, labelID string, params *DeleteDashboardsIDLabelsIDParams) (*DeleteDashboardsIDLabelsIDResponse, error) - - // GetDashboardsIDMembers request - GetDashboardsIDMembersWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDMembersParams) (*GetDashboardsIDMembersResponse, error) - - // PostDashboardsIDMembers request with any body - PostDashboardsIDMembersWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, contentType string, body io.Reader) (*PostDashboardsIDMembersResponse, error) - - PostDashboardsIDMembersWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, body PostDashboardsIDMembersJSONRequestBody) (*PostDashboardsIDMembersResponse, error) - - // DeleteDashboardsIDMembersID request - DeleteDashboardsIDMembersIDWithResponse(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDMembersIDParams) (*DeleteDashboardsIDMembersIDResponse, error) - - // GetDashboardsIDOwners request - GetDashboardsIDOwnersWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDOwnersParams) (*GetDashboardsIDOwnersResponse, error) - - // PostDashboardsIDOwners request with any body - PostDashboardsIDOwnersWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, contentType string, body io.Reader) (*PostDashboardsIDOwnersResponse, error) - - PostDashboardsIDOwnersWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, body PostDashboardsIDOwnersJSONRequestBody) (*PostDashboardsIDOwnersResponse, error) - - // DeleteDashboardsIDOwnersID request - DeleteDashboardsIDOwnersIDWithResponse(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDOwnersIDParams) (*DeleteDashboardsIDOwnersIDResponse, error) - - // GetDBRPs request - GetDBRPsWithResponse(ctx context.Context, params *GetDBRPsParams) (*GetDBRPsResponse, error) - - // PostDBRP request with any body - PostDBRPWithBodyWithResponse(ctx context.Context, params *PostDBRPParams, contentType string, body io.Reader) (*PostDBRPResponse, error) - - PostDBRPWithResponse(ctx context.Context, params *PostDBRPParams, body PostDBRPJSONRequestBody) (*PostDBRPResponse, error) - - // DeleteDBRPID request - DeleteDBRPIDWithResponse(ctx context.Context, dbrpID string, params *DeleteDBRPIDParams) (*DeleteDBRPIDResponse, error) - - // GetDBRPsID request - GetDBRPsIDWithResponse(ctx context.Context, dbrpID string, params *GetDBRPsIDParams) (*GetDBRPsIDResponse, error) - - // PatchDBRPID request with any body - PatchDBRPIDWithBodyWithResponse(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, contentType string, body io.Reader) (*PatchDBRPIDResponse, error) - - PatchDBRPIDWithResponse(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, body PatchDBRPIDJSONRequestBody) (*PatchDBRPIDResponse, error) - - // PostDelete request with any body - PostDeleteWithBodyWithResponse(ctx context.Context, params *PostDeleteParams, contentType string, body io.Reader) (*PostDeleteResponse, error) - - PostDeleteWithResponse(ctx context.Context, params *PostDeleteParams, body PostDeleteJSONRequestBody) (*PostDeleteResponse, error) - - // GetFlags request - GetFlagsWithResponse(ctx context.Context, params *GetFlagsParams) (*GetFlagsResponse, error) - - // GetHealth request - GetHealthWithResponse(ctx context.Context, params *GetHealthParams) (*GetHealthResponse, error) - - // GetLabels request - GetLabelsWithResponse(ctx context.Context, params *GetLabelsParams) (*GetLabelsResponse, error) - - // PostLabels request with any body - PostLabelsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*PostLabelsResponse, error) - - PostLabelsWithResponse(ctx context.Context, body PostLabelsJSONRequestBody) (*PostLabelsResponse, error) - - // DeleteLabelsID request - DeleteLabelsIDWithResponse(ctx context.Context, labelID string, params *DeleteLabelsIDParams) (*DeleteLabelsIDResponse, error) - - // GetLabelsID request - GetLabelsIDWithResponse(ctx context.Context, labelID string, params *GetLabelsIDParams) (*GetLabelsIDResponse, error) - - // PatchLabelsID request with any body - PatchLabelsIDWithBodyWithResponse(ctx context.Context, labelID string, params *PatchLabelsIDParams, contentType string, body io.Reader) (*PatchLabelsIDResponse, error) - - PatchLabelsIDWithResponse(ctx context.Context, labelID string, params *PatchLabelsIDParams, body PatchLabelsIDJSONRequestBody) (*PatchLabelsIDResponse, error) - - // GetLegacyAuthorizations request - GetLegacyAuthorizationsWithResponse(ctx context.Context, params *GetLegacyAuthorizationsParams) (*GetLegacyAuthorizationsResponse, error) - - // PostLegacyAuthorizations request with any body - PostLegacyAuthorizationsWithBodyWithResponse(ctx context.Context, params *PostLegacyAuthorizationsParams, contentType string, body io.Reader) (*PostLegacyAuthorizationsResponse, error) - - PostLegacyAuthorizationsWithResponse(ctx context.Context, params *PostLegacyAuthorizationsParams, body PostLegacyAuthorizationsJSONRequestBody) (*PostLegacyAuthorizationsResponse, error) - - // DeleteLegacyAuthorizationsID request - DeleteLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *DeleteLegacyAuthorizationsIDParams) (*DeleteLegacyAuthorizationsIDResponse, error) - - // GetLegacyAuthorizationsID request - GetLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *GetLegacyAuthorizationsIDParams) (*GetLegacyAuthorizationsIDResponse, error) - - // PatchLegacyAuthorizationsID request with any body - PatchLegacyAuthorizationsIDWithBodyWithResponse(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, contentType string, body io.Reader) (*PatchLegacyAuthorizationsIDResponse, error) - - PatchLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, body PatchLegacyAuthorizationsIDJSONRequestBody) (*PatchLegacyAuthorizationsIDResponse, error) - - // PostLegacyAuthorizationsIDPassword request with any body - PostLegacyAuthorizationsIDPasswordWithBodyWithResponse(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, contentType string, body io.Reader) (*PostLegacyAuthorizationsIDPasswordResponse, error) - - PostLegacyAuthorizationsIDPasswordWithResponse(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, body PostLegacyAuthorizationsIDPasswordJSONRequestBody) (*PostLegacyAuthorizationsIDPasswordResponse, error) - - // GetMe request - GetMeWithResponse(ctx context.Context, params *GetMeParams) (*GetMeResponse, error) - - // PutMePassword request with any body - PutMePasswordWithBodyWithResponse(ctx context.Context, params *PutMePasswordParams, contentType string, body io.Reader) (*PutMePasswordResponse, error) - - PutMePasswordWithResponse(ctx context.Context, params *PutMePasswordParams, body PutMePasswordJSONRequestBody) (*PutMePasswordResponse, error) - - // GetMetrics request - GetMetricsWithResponse(ctx context.Context, params *GetMetricsParams) (*GetMetricsResponse, error) - - // GetNotificationEndpoints request - GetNotificationEndpointsWithResponse(ctx context.Context, params *GetNotificationEndpointsParams) (*GetNotificationEndpointsResponse, error) - - // CreateNotificationEndpoint request with any body - CreateNotificationEndpointWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateNotificationEndpointResponse, error) + queryURL.RawQuery = queryValues.Encode() - CreateNotificationEndpointWithResponse(ctx context.Context, body CreateNotificationEndpointJSONRequestBody) (*CreateNotificationEndpointResponse, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - // DeleteNotificationEndpointsID request - DeleteNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *DeleteNotificationEndpointsIDParams) (*DeleteNotificationEndpointsIDResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetNotificationEndpointsID request - GetNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDParams) (*GetNotificationEndpointsIDResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // PatchNotificationEndpointsID request with any body - PatchNotificationEndpointsIDWithBodyWithResponse(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, contentType string, body io.Reader) (*PatchNotificationEndpointsIDResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PatchNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, body PatchNotificationEndpointsIDJSONRequestBody) (*PatchNotificationEndpointsIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // PutNotificationEndpointsID request with any body - PutNotificationEndpointsIDWithBodyWithResponse(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, contentType string, body io.Reader) (*PutNotificationEndpointsIDResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - PutNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, body PutNotificationEndpointsIDJSONRequestBody) (*PutNotificationEndpointsIDResponse, error) + response := &Dashboards{} - // GetNotificationEndpointsIDLabels request - GetNotificationEndpointsIDLabelsWithResponse(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDLabelsParams) (*GetNotificationEndpointsIDLabelsResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // PostNotificationEndpointIDLabels request with any body - PostNotificationEndpointIDLabelsWithBodyWithResponse(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, contentType string, body io.Reader) (*PostNotificationEndpointIDLabelsResponse, error) +} - PostNotificationEndpointIDLabelsWithResponse(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, body PostNotificationEndpointIDLabelsJSONRequestBody) (*PostNotificationEndpointIDLabelsResponse, error) +// DeleteDashboardsID calls the DELETE on /dashboards/{dashboardID} +// Delete a dashboard +func (c *Client) DeleteDashboardsID(ctx context.Context, params *DeleteDashboardsIDAllParams) error { + var err error - // DeleteNotificationEndpointsIDLabelsID request - DeleteNotificationEndpointsIDLabelsIDWithResponse(ctx context.Context, endpointID string, labelID string, params *DeleteNotificationEndpointsIDLabelsIDParams) (*DeleteNotificationEndpointsIDLabelsIDResponse, error) + var pathParam0 string - // GetNotificationRules request - GetNotificationRulesWithResponse(ctx context.Context, params *GetNotificationRulesParams) (*GetNotificationRulesResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return err + } - // CreateNotificationRule request with any body - CreateNotificationRuleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateNotificationRuleResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err + } - CreateNotificationRuleWithResponse(ctx context.Context, body CreateNotificationRuleJSONRequestBody) (*CreateNotificationRuleResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s", pathParam0) - // DeleteNotificationRulesID request - DeleteNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *DeleteNotificationRulesIDParams) (*DeleteNotificationRulesIDResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - // GetNotificationRulesID request - GetNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDParams) (*GetNotificationRulesIDResponse, error) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err + } - // PatchNotificationRulesID request with any body - PatchNotificationRulesIDWithBodyWithResponse(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, contentType string, body io.Reader) (*PatchNotificationRulesIDResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - PatchNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, body PatchNotificationRulesIDJSONRequestBody) (*PatchNotificationRulesIDResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } - // PutNotificationRulesID request with any body - PutNotificationRulesIDWithBodyWithResponse(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, contentType string, body io.Reader) (*PutNotificationRulesIDResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PutNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, body PutNotificationRulesIDJSONRequestBody) (*PutNotificationRulesIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - // GetNotificationRulesIDLabels request - GetNotificationRulesIDLabelsWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDLabelsParams) (*GetNotificationRulesIDLabelsResponse, error) + defer func() { _ = rsp.Body.Close() }() - // PostNotificationRuleIDLabels request with any body - PostNotificationRuleIDLabelsWithBodyWithResponse(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, contentType string, body io.Reader) (*PostNotificationRuleIDLabelsResponse, error) + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil - PostNotificationRuleIDLabelsWithResponse(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, body PostNotificationRuleIDLabelsJSONRequestBody) (*PostNotificationRuleIDLabelsResponse, error) +} - // DeleteNotificationRulesIDLabelsID request - DeleteNotificationRulesIDLabelsIDWithResponse(ctx context.Context, ruleID string, labelID string, params *DeleteNotificationRulesIDLabelsIDParams) (*DeleteNotificationRulesIDLabelsIDResponse, error) +// PatchDashboardsID calls the PATCH on /dashboards/{dashboardID} +// Update a dashboard +func (c *Client) PatchDashboardsID(ctx context.Context, params *PatchDashboardsIDAllParams) (*Dashboard, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // GetNotificationRulesIDQuery request - GetNotificationRulesIDQueryWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDQueryParams) (*GetNotificationRulesIDQueryResponse, error) + var pathParam0 string - // GetOrgs request - GetOrgsWithResponse(ctx context.Context, params *GetOrgsParams) (*GetOrgsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // PostOrgs request with any body - PostOrgsWithBodyWithResponse(ctx context.Context, params *PostOrgsParams, contentType string, body io.Reader) (*PostOrgsResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - PostOrgsWithResponse(ctx context.Context, params *PostOrgsParams, body PostOrgsJSONRequestBody) (*PostOrgsResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s", pathParam0) - // DeleteOrgsID request - DeleteOrgsIDWithResponse(ctx context.Context, orgID string, params *DeleteOrgsIDParams) (*DeleteOrgsIDResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // GetOrgsID request - GetOrgsIDWithResponse(ctx context.Context, orgID string, params *GetOrgsIDParams) (*GetOrgsIDResponse, error) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // PatchOrgsID request with any body - PatchOrgsIDWithBodyWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDParams, contentType string, body io.Reader) (*PatchOrgsIDResponse, error) + req.Header.Add("Content-Type", "application/json") - PatchOrgsIDWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDParams, body PatchOrgsIDJSONRequestBody) (*PatchOrgsIDResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetOrgsIDMembers request - GetOrgsIDMembersWithResponse(ctx context.Context, orgID string, params *GetOrgsIDMembersParams) (*GetOrgsIDMembersResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // PostOrgsIDMembers request with any body - PostOrgsIDMembersWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, contentType string, body io.Reader) (*PostOrgsIDMembersResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PostOrgsIDMembersWithResponse(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, body PostOrgsIDMembersJSONRequestBody) (*PostOrgsIDMembersResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // DeleteOrgsIDMembersID request - DeleteOrgsIDMembersIDWithResponse(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDMembersIDParams) (*DeleteOrgsIDMembersIDResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // GetOrgsIDOwners request - GetOrgsIDOwnersWithResponse(ctx context.Context, orgID string, params *GetOrgsIDOwnersParams) (*GetOrgsIDOwnersResponse, error) + response := &Dashboard{} - // PostOrgsIDOwners request with any body - PostOrgsIDOwnersWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, contentType string, body io.Reader) (*PostOrgsIDOwnersResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - PostOrgsIDOwnersWithResponse(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, body PostOrgsIDOwnersJSONRequestBody) (*PostOrgsIDOwnersResponse, error) +} - // DeleteOrgsIDOwnersID request - DeleteOrgsIDOwnersIDWithResponse(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDOwnersIDParams) (*DeleteOrgsIDOwnersIDResponse, error) +// PostDashboardsIDCells calls the POST on /dashboards/{dashboardID}/cells +// Create a dashboard cell +func (c *Client) PostDashboardsIDCells(ctx context.Context, params *PostDashboardsIDCellsAllParams) (*Cell, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // GetOrgsIDSecrets request - GetOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *GetOrgsIDSecretsParams) (*GetOrgsIDSecretsResponse, error) + var pathParam0 string - // PatchOrgsIDSecrets request with any body - PatchOrgsIDSecretsWithBodyWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, contentType string, body io.Reader) (*PatchOrgsIDSecretsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - PatchOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, body PatchOrgsIDSecretsJSONRequestBody) (*PatchOrgsIDSecretsResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // PostOrgsIDSecrets request with any body - PostOrgsIDSecretsWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, contentType string, body io.Reader) (*PostOrgsIDSecretsResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells", pathParam0) - PostOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, body PostOrgsIDSecretsJSONRequestBody) (*PostOrgsIDSecretsResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // DeleteOrgsIDSecretsID request - DeleteOrgsIDSecretsIDWithResponse(ctx context.Context, orgID string, secretID string, params *DeleteOrgsIDSecretsIDParams) (*DeleteOrgsIDSecretsIDResponse, error) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // GetPing request - GetPingWithResponse(ctx context.Context) (*GetPingResponse, error) + req.Header.Add("Content-Type", "application/json") - // HeadPing request - HeadPingWithResponse(ctx context.Context) (*HeadPingResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // PostQuery request with any body - PostQueryWithBodyWithResponse(ctx context.Context, params *PostQueryParams, contentType string, body io.Reader) (*PostQueryResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - PostQueryWithResponse(ctx context.Context, params *PostQueryParams, body PostQueryJSONRequestBody) (*PostQueryResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // PostQueryAnalyze request with any body - PostQueryAnalyzeWithBodyWithResponse(ctx context.Context, params *PostQueryAnalyzeParams, contentType string, body io.Reader) (*PostQueryAnalyzeResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - PostQueryAnalyzeWithResponse(ctx context.Context, params *PostQueryAnalyzeParams, body PostQueryAnalyzeJSONRequestBody) (*PostQueryAnalyzeResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // PostQueryAst request with any body - PostQueryAstWithBodyWithResponse(ctx context.Context, params *PostQueryAstParams, contentType string, body io.Reader) (*PostQueryAstResponse, error) + response := &Cell{} - PostQueryAstWithResponse(ctx context.Context, params *PostQueryAstParams, body PostQueryAstJSONRequestBody) (*PostQueryAstResponse, error) + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // GetQuerySuggestions request - GetQuerySuggestionsWithResponse(ctx context.Context, params *GetQuerySuggestionsParams) (*GetQuerySuggestionsResponse, error) +} - // GetQuerySuggestionsName request - GetQuerySuggestionsNameWithResponse(ctx context.Context, name string, params *GetQuerySuggestionsNameParams) (*GetQuerySuggestionsNameResponse, error) +// PutDashboardsIDCells calls the PUT on /dashboards/{dashboardID}/cells +// Replace cells in a dashboard +func (c *Client) PutDashboardsIDCells(ctx context.Context, params *PutDashboardsIDCellsAllParams) (*Dashboard, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // GetReady request - GetReadyWithResponse(ctx context.Context, params *GetReadyParams) (*GetReadyResponse, error) + var pathParam0 string - // GetRemoteConnections request - GetRemoteConnectionsWithResponse(ctx context.Context, params *GetRemoteConnectionsParams) (*GetRemoteConnectionsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // PostRemoteConnection request with any body - PostRemoteConnectionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*PostRemoteConnectionResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - PostRemoteConnectionWithResponse(ctx context.Context, body PostRemoteConnectionJSONRequestBody) (*PostRemoteConnectionResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells", pathParam0) - // DeleteRemoteConnectionByID request - DeleteRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *DeleteRemoteConnectionByIDParams) (*DeleteRemoteConnectionByIDResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // GetRemoteConnectionByID request - GetRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *GetRemoteConnectionByIDParams) (*GetRemoteConnectionByIDResponse, error) + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // PatchRemoteConnectionByID request with any body - PatchRemoteConnectionByIDWithBodyWithResponse(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, contentType string, body io.Reader) (*PatchRemoteConnectionByIDResponse, error) + req.Header.Add("Content-Type", "application/json") - PatchRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, body PatchRemoteConnectionByIDJSONRequestBody) (*PatchRemoteConnectionByIDResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetReplications request - GetReplicationsWithResponse(ctx context.Context, params *GetReplicationsParams) (*GetReplicationsResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // PostReplication request with any body - PostReplicationWithBodyWithResponse(ctx context.Context, params *PostReplicationParams, contentType string, body io.Reader) (*PostReplicationResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PostReplicationWithResponse(ctx context.Context, params *PostReplicationParams, body PostReplicationJSONRequestBody) (*PostReplicationResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // DeleteReplicationByID request - DeleteReplicationByIDWithResponse(ctx context.Context, replicationID string, params *DeleteReplicationByIDParams) (*DeleteReplicationByIDResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // GetReplicationByID request - GetReplicationByIDWithResponse(ctx context.Context, replicationID string, params *GetReplicationByIDParams) (*GetReplicationByIDResponse, error) + response := &Dashboard{} - // PatchReplicationByID request with any body - PatchReplicationByIDWithBodyWithResponse(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, contentType string, body io.Reader) (*PatchReplicationByIDResponse, error) + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - PatchReplicationByIDWithResponse(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, body PatchReplicationByIDJSONRequestBody) (*PatchReplicationByIDResponse, error) +} - // PostValidateReplicationByID request - PostValidateReplicationByIDWithResponse(ctx context.Context, replicationID string, params *PostValidateReplicationByIDParams) (*PostValidateReplicationByIDResponse, error) +// DeleteDashboardsIDCellsID calls the DELETE on /dashboards/{dashboardID}/cells/{cellID} +// Delete a dashboard cell +func (c *Client) DeleteDashboardsIDCellsID(ctx context.Context, params *DeleteDashboardsIDCellsIDAllParams) error { + var err error - // GetResources request - GetResourcesWithResponse(ctx context.Context, params *GetResourcesParams) (*GetResourcesResponse, error) + var pathParam0 string - // PostRestoreBucketID request with any body - PostRestoreBucketIDWithBodyWithResponse(ctx context.Context, bucketID string, params *PostRestoreBucketIDParams, contentType string, body io.Reader) (*PostRestoreBucketIDResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return err + } - // PostRestoreBucketMetadata request with any body - PostRestoreBucketMetadataWithBodyWithResponse(ctx context.Context, params *PostRestoreBucketMetadataParams, contentType string, body io.Reader) (*PostRestoreBucketMetadataResponse, error) + var pathParam1 string - PostRestoreBucketMetadataWithResponse(ctx context.Context, params *PostRestoreBucketMetadataParams, body PostRestoreBucketMetadataJSONRequestBody) (*PostRestoreBucketMetadataResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, params.CellID) + if err != nil { + return err + } - // PostRestoreKV request with any body - PostRestoreKVWithBodyWithResponse(ctx context.Context, params *PostRestoreKVParams, contentType string, body io.Reader) (*PostRestoreKVResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err + } - // PostRestoreShardId request with any body - PostRestoreShardIdWithBodyWithResponse(ctx context.Context, shardID string, params *PostRestoreShardIdParams, contentType string, body io.Reader) (*PostRestoreShardIdResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells/%s", pathParam0, pathParam1) - // PostRestoreSQL request with any body - PostRestoreSQLWithBodyWithResponse(ctx context.Context, params *PostRestoreSQLParams, contentType string, body io.Reader) (*PostRestoreSQLResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - // GetScrapers request - GetScrapersWithResponse(ctx context.Context, params *GetScrapersParams) (*GetScrapersResponse, error) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err + } - // PostScrapers request with any body - PostScrapersWithBodyWithResponse(ctx context.Context, params *PostScrapersParams, contentType string, body io.Reader) (*PostScrapersResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - PostScrapersWithResponse(ctx context.Context, params *PostScrapersParams, body PostScrapersJSONRequestBody) (*PostScrapersResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } - // DeleteScrapersID request - DeleteScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *DeleteScrapersIDParams) (*DeleteScrapersIDResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // GetScrapersID request - GetScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDParams) (*GetScrapersIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - // PatchScrapersID request with any body - PatchScrapersIDWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, contentType string, body io.Reader) (*PatchScrapersIDResponse, error) + defer func() { _ = rsp.Body.Close() }() - PatchScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, body PatchScrapersIDJSONRequestBody) (*PatchScrapersIDResponse, error) + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil - // GetScrapersIDLabels request - GetScrapersIDLabelsWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDLabelsParams) (*GetScrapersIDLabelsResponse, error) +} - // PostScrapersIDLabels request with any body - PostScrapersIDLabelsWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, contentType string, body io.Reader) (*PostScrapersIDLabelsResponse, error) +// PatchDashboardsIDCellsID calls the PATCH on /dashboards/{dashboardID}/cells/{cellID} +// Update the non-positional information related to a cell +func (c *Client) PatchDashboardsIDCellsID(ctx context.Context, params *PatchDashboardsIDCellsIDAllParams) (*Cell, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - PostScrapersIDLabelsWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, body PostScrapersIDLabelsJSONRequestBody) (*PostScrapersIDLabelsResponse, error) + var pathParam0 string - // DeleteScrapersIDLabelsID request - DeleteScrapersIDLabelsIDWithResponse(ctx context.Context, scraperTargetID string, labelID string, params *DeleteScrapersIDLabelsIDParams) (*DeleteScrapersIDLabelsIDResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // GetScrapersIDMembers request - GetScrapersIDMembersWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDMembersParams) (*GetScrapersIDMembersResponse, error) + var pathParam1 string - // PostScrapersIDMembers request with any body - PostScrapersIDMembersWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, contentType string, body io.Reader) (*PostScrapersIDMembersResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, params.CellID) + if err != nil { + return nil, err + } - PostScrapersIDMembersWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, body PostScrapersIDMembersJSONRequestBody) (*PostScrapersIDMembersResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // DeleteScrapersIDMembersID request - DeleteScrapersIDMembersIDWithResponse(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDMembersIDParams) (*DeleteScrapersIDMembersIDResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells/%s", pathParam0, pathParam1) - // GetScrapersIDOwners request - GetScrapersIDOwnersWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDOwnersParams) (*GetScrapersIDOwnersResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // PostScrapersIDOwners request with any body - PostScrapersIDOwnersWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, contentType string, body io.Reader) (*PostScrapersIDOwnersResponse, error) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - PostScrapersIDOwnersWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, body PostScrapersIDOwnersJSONRequestBody) (*PostScrapersIDOwnersResponse, error) + req.Header.Add("Content-Type", "application/json") - // DeleteScrapersIDOwnersID request - DeleteScrapersIDOwnersIDWithResponse(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDOwnersIDParams) (*DeleteScrapersIDOwnersIDResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetSetup request - GetSetupWithResponse(ctx context.Context, params *GetSetupParams) (*GetSetupResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // PostSetup request with any body - PostSetupWithBodyWithResponse(ctx context.Context, params *PostSetupParams, contentType string, body io.Reader) (*PostSetupResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PostSetupWithResponse(ctx context.Context, params *PostSetupParams, body PostSetupJSONRequestBody) (*PostSetupResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // PostSignin request - PostSigninWithResponse(ctx context.Context, params *PostSigninParams) (*PostSigninResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // PostSignout request - PostSignoutWithResponse(ctx context.Context, params *PostSignoutParams) (*PostSignoutResponse, error) + response := &Cell{} - // GetSources request - GetSourcesWithResponse(ctx context.Context, params *GetSourcesParams) (*GetSourcesResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // PostSources request with any body - PostSourcesWithBodyWithResponse(ctx context.Context, params *PostSourcesParams, contentType string, body io.Reader) (*PostSourcesResponse, error) +} - PostSourcesWithResponse(ctx context.Context, params *PostSourcesParams, body PostSourcesJSONRequestBody) (*PostSourcesResponse, error) +// GetDashboardsIDCellsIDView calls the GET on /dashboards/{dashboardID}/cells/{cellID}/view +// Retrieve the view for a cell +func (c *Client) GetDashboardsIDCellsIDView(ctx context.Context, params *GetDashboardsIDCellsIDViewAllParams) (*View, error) { + var err error - // DeleteSourcesID request - DeleteSourcesIDWithResponse(ctx context.Context, sourceID string, params *DeleteSourcesIDParams) (*DeleteSourcesIDResponse, error) + var pathParam0 string - // GetSourcesID request - GetSourcesIDWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDParams) (*GetSourcesIDResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // PatchSourcesID request with any body - PatchSourcesIDWithBodyWithResponse(ctx context.Context, sourceID string, params *PatchSourcesIDParams, contentType string, body io.Reader) (*PatchSourcesIDResponse, error) + var pathParam1 string - PatchSourcesIDWithResponse(ctx context.Context, sourceID string, params *PatchSourcesIDParams, body PatchSourcesIDJSONRequestBody) (*PatchSourcesIDResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, params.CellID) + if err != nil { + return nil, err + } - // GetSourcesIDBuckets request - GetSourcesIDBucketsWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDBucketsParams) (*GetSourcesIDBucketsResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // GetSourcesIDHealth request - GetSourcesIDHealthWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDHealthParams) (*GetSourcesIDHealthResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells/%s/view", pathParam0, pathParam1) - // ListStacks request - ListStacksWithResponse(ctx context.Context, params *ListStacksParams) (*ListStacksResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // CreateStack request with any body - CreateStackWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateStackResponse, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - CreateStackWithResponse(ctx context.Context, body CreateStackJSONRequestBody) (*CreateStackResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // DeleteStack request - DeleteStackWithResponse(ctx context.Context, stackId string, params *DeleteStackParams) (*DeleteStackResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // ReadStack request - ReadStackWithResponse(ctx context.Context, stackId string) (*ReadStackResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // UpdateStack request with any body - UpdateStackWithBodyWithResponse(ctx context.Context, stackId string, contentType string, body io.Reader) (*UpdateStackResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - UpdateStackWithResponse(ctx context.Context, stackId string, body UpdateStackJSONRequestBody) (*UpdateStackResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // UninstallStack request - UninstallStackWithResponse(ctx context.Context, stackId string) (*UninstallStackResponse, error) + response := &View{} - // GetTasks request - GetTasksWithResponse(ctx context.Context, params *GetTasksParams) (*GetTasksResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // PostTasks request with any body - PostTasksWithBodyWithResponse(ctx context.Context, params *PostTasksParams, contentType string, body io.Reader) (*PostTasksResponse, error) +} - PostTasksWithResponse(ctx context.Context, params *PostTasksParams, body PostTasksJSONRequestBody) (*PostTasksResponse, error) +// PatchDashboardsIDCellsIDView calls the PATCH on /dashboards/{dashboardID}/cells/{cellID}/view +// Update the view for a cell +func (c *Client) PatchDashboardsIDCellsIDView(ctx context.Context, params *PatchDashboardsIDCellsIDViewAllParams) (*View, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // DeleteTasksID request - DeleteTasksIDWithResponse(ctx context.Context, taskID string, params *DeleteTasksIDParams) (*DeleteTasksIDResponse, error) + var pathParam0 string - // GetTasksID request - GetTasksIDWithResponse(ctx context.Context, taskID string, params *GetTasksIDParams) (*GetTasksIDResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // PatchTasksID request with any body - PatchTasksIDWithBodyWithResponse(ctx context.Context, taskID string, params *PatchTasksIDParams, contentType string, body io.Reader) (*PatchTasksIDResponse, error) + var pathParam1 string - PatchTasksIDWithResponse(ctx context.Context, taskID string, params *PatchTasksIDParams, body PatchTasksIDJSONRequestBody) (*PatchTasksIDResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "cellID", runtime.ParamLocationPath, params.CellID) + if err != nil { + return nil, err + } - // GetTasksIDLabels request - GetTasksIDLabelsWithResponse(ctx context.Context, taskID string, params *GetTasksIDLabelsParams) (*GetTasksIDLabelsResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // PostTasksIDLabels request with any body - PostTasksIDLabelsWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, contentType string, body io.Reader) (*PostTasksIDLabelsResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/cells/%s/view", pathParam0, pathParam1) - PostTasksIDLabelsWithResponse(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, body PostTasksIDLabelsJSONRequestBody) (*PostTasksIDLabelsResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // DeleteTasksIDLabelsID request - DeleteTasksIDLabelsIDWithResponse(ctx context.Context, taskID string, labelID string, params *DeleteTasksIDLabelsIDParams) (*DeleteTasksIDLabelsIDResponse, error) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // GetTasksIDLogs request - GetTasksIDLogsWithResponse(ctx context.Context, taskID string, params *GetTasksIDLogsParams) (*GetTasksIDLogsResponse, error) + req.Header.Add("Content-Type", "application/json") - // GetTasksIDMembers request - GetTasksIDMembersWithResponse(ctx context.Context, taskID string, params *GetTasksIDMembersParams) (*GetTasksIDMembersResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // PostTasksIDMembers request with any body - PostTasksIDMembersWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDMembersParams, contentType string, body io.Reader) (*PostTasksIDMembersResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - PostTasksIDMembersWithResponse(ctx context.Context, taskID string, params *PostTasksIDMembersParams, body PostTasksIDMembersJSONRequestBody) (*PostTasksIDMembersResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // DeleteTasksIDMembersID request - DeleteTasksIDMembersIDWithResponse(ctx context.Context, taskID string, userID string, params *DeleteTasksIDMembersIDParams) (*DeleteTasksIDMembersIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // GetTasksIDOwners request - GetTasksIDOwnersWithResponse(ctx context.Context, taskID string, params *GetTasksIDOwnersParams) (*GetTasksIDOwnersResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // PostTasksIDOwners request with any body - PostTasksIDOwnersWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, contentType string, body io.Reader) (*PostTasksIDOwnersResponse, error) + response := &View{} - PostTasksIDOwnersWithResponse(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, body PostTasksIDOwnersJSONRequestBody) (*PostTasksIDOwnersResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - // DeleteTasksIDOwnersID request - DeleteTasksIDOwnersIDWithResponse(ctx context.Context, taskID string, userID string, params *DeleteTasksIDOwnersIDParams) (*DeleteTasksIDOwnersIDResponse, error) +} - // GetTasksIDRuns request - GetTasksIDRunsWithResponse(ctx context.Context, taskID string, params *GetTasksIDRunsParams) (*GetTasksIDRunsResponse, error) +// GetDashboardsIDLabels calls the GET on /dashboards/{dashboardID}/labels +// List all labels for a dashboard +func (c *Client) GetDashboardsIDLabels(ctx context.Context, params *GetDashboardsIDLabelsAllParams) (*LabelsResponse, error) { + var err error - // PostTasksIDRuns request with any body - PostTasksIDRunsWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDRunsParams, contentType string, body io.Reader) (*PostTasksIDRunsResponse, error) + var pathParam0 string - PostTasksIDRunsWithResponse(ctx context.Context, taskID string, params *PostTasksIDRunsParams, body PostTasksIDRunsJSONRequestBody) (*PostTasksIDRunsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // DeleteTasksIDRunsID request - DeleteTasksIDRunsIDWithResponse(ctx context.Context, taskID string, runID string, params *DeleteTasksIDRunsIDParams) (*DeleteTasksIDRunsIDResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // GetTasksIDRunsID request - GetTasksIDRunsIDWithResponse(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDParams) (*GetTasksIDRunsIDResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/labels", pathParam0) - // GetTasksIDRunsIDLogs request - GetTasksIDRunsIDLogsWithResponse(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDLogsParams) (*GetTasksIDRunsIDLogsResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // PostTasksIDRunsIDRetry request with any body - PostTasksIDRunsIDRetryWithBodyWithResponse(ctx context.Context, taskID string, runID string, params *PostTasksIDRunsIDRetryParams, contentType string, body io.Reader) (*PostTasksIDRunsIDRetryResponse, error) + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } - // GetTelegrafPlugins request - GetTelegrafPluginsWithResponse(ctx context.Context, params *GetTelegrafPluginsParams) (*GetTelegrafPluginsResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // GetTelegrafs request - GetTelegrafsWithResponse(ctx context.Context, params *GetTelegrafsParams) (*GetTelegrafsResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - // PostTelegrafs request with any body - PostTelegrafsWithBodyWithResponse(ctx context.Context, params *PostTelegrafsParams, contentType string, body io.Reader) (*PostTelegrafsResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - PostTelegrafsWithResponse(ctx context.Context, params *PostTelegrafsParams, body PostTelegrafsJSONRequestBody) (*PostTelegrafsResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // DeleteTelegrafsID request - DeleteTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *DeleteTelegrafsIDParams) (*DeleteTelegrafsIDResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - // GetTelegrafsID request - GetTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDParams) (*GetTelegrafsIDResponse, error) + response := &LabelsResponse{} - // PutTelegrafsID request with any body - PutTelegrafsIDWithBodyWithResponse(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, contentType string, body io.Reader) (*PutTelegrafsIDResponse, error) + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - PutTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, body PutTelegrafsIDJSONRequestBody) (*PutTelegrafsIDResponse, error) +} - // GetTelegrafsIDLabels request - GetTelegrafsIDLabelsWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDLabelsParams) (*GetTelegrafsIDLabelsResponse, error) +// PostDashboardsIDLabels calls the POST on /dashboards/{dashboardID}/labels +// Add a label to a dashboard +func (c *Client) PostDashboardsIDLabels(ctx context.Context, params *PostDashboardsIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) - // PostTelegrafsIDLabels request with any body - PostTelegrafsIDLabelsWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, contentType string, body io.Reader) (*PostTelegrafsIDLabelsResponse, error) + var pathParam0 string - PostTelegrafsIDLabelsWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, body PostTelegrafsIDLabelsJSONRequestBody) (*PostTelegrafsIDLabelsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // DeleteTelegrafsIDLabelsID request - DeleteTelegrafsIDLabelsIDWithResponse(ctx context.Context, telegrafID string, labelID string, params *DeleteTelegrafsIDLabelsIDParams) (*DeleteTelegrafsIDLabelsIDResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - // GetTelegrafsIDMembers request - GetTelegrafsIDMembersWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDMembersParams) (*GetTelegrafsIDMembersResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/labels", pathParam0) - // PostTelegrafsIDMembers request with any body - PostTelegrafsIDMembersWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, contentType string, body io.Reader) (*PostTelegrafsIDMembersResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - PostTelegrafsIDMembersWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, body PostTelegrafsIDMembersJSONRequestBody) (*PostTelegrafsIDMembersResponse, error) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err + } - // DeleteTelegrafsIDMembersID request - DeleteTelegrafsIDMembersIDWithResponse(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDMembersIDParams) (*DeleteTelegrafsIDMembersIDResponse, error) + req.Header.Add("Content-Type", "application/json") - // GetTelegrafsIDOwners request - GetTelegrafsIDOwnersWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDOwnersParams) (*GetTelegrafsIDOwnersResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // PostTelegrafsIDOwners request with any body - PostTelegrafsIDOwnersWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, contentType string, body io.Reader) (*PostTelegrafsIDOwnersResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } - PostTelegrafsIDOwnersWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, body PostTelegrafsIDOwnersJSONRequestBody) (*PostTelegrafsIDOwnersResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // DeleteTelegrafsIDOwnersID request - DeleteTelegrafsIDOwnersIDWithResponse(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDOwnersIDParams) (*DeleteTelegrafsIDOwnersIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - // ApplyTemplate request with any body - ApplyTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*ApplyTemplateResponse, error) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - ApplyTemplateWithResponse(ctx context.Context, body ApplyTemplateJSONRequestBody) (*ApplyTemplateResponse, error) + response := &LabelResponse{} - // ExportTemplate request with any body - ExportTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*ExportTemplateResponse, error) + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil - ExportTemplateWithResponse(ctx context.Context, body ExportTemplateJSONRequestBody) (*ExportTemplateResponse, error) +} - // GetUsers request - GetUsersWithResponse(ctx context.Context, params *GetUsersParams) (*GetUsersResponse, error) +// DeleteDashboardsIDLabelsID calls the DELETE on /dashboards/{dashboardID}/labels/{labelID} +// Delete a label from a dashboard +func (c *Client) DeleteDashboardsIDLabelsID(ctx context.Context, params *DeleteDashboardsIDLabelsIDAllParams) error { + var err error - // PostUsers request with any body - PostUsersWithBodyWithResponse(ctx context.Context, params *PostUsersParams, contentType string, body io.Reader) (*PostUsersResponse, error) + var pathParam0 string - PostUsersWithResponse(ctx context.Context, params *PostUsersParams, body PostUsersJSONRequestBody) (*PostUsersResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return err + } - // DeleteUsersID request - DeleteUsersIDWithResponse(ctx context.Context, userID string, params *DeleteUsersIDParams) (*DeleteUsersIDResponse, error) + var pathParam1 string - // GetUsersID request - GetUsersIDWithResponse(ctx context.Context, userID string, params *GetUsersIDParams) (*GetUsersIDResponse, error) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err + } - // PatchUsersID request with any body - PatchUsersIDWithBodyWithResponse(ctx context.Context, userID string, params *PatchUsersIDParams, contentType string, body io.Reader) (*PatchUsersIDResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err + } - PatchUsersIDWithResponse(ctx context.Context, userID string, params *PatchUsersIDParams, body PatchUsersIDJSONRequestBody) (*PatchUsersIDResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/labels/%s", pathParam0, pathParam1) - // PostUsersIDPassword request with any body - PostUsersIDPasswordWithBodyWithResponse(ctx context.Context, userID string, params *PostUsersIDPasswordParams, contentType string, body io.Reader) (*PostUsersIDPasswordResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - PostUsersIDPasswordWithResponse(ctx context.Context, userID string, params *PostUsersIDPasswordParams, body PostUsersIDPasswordJSONRequestBody) (*PostUsersIDPasswordResponse, error) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err + } - // GetVariables request - GetVariablesWithResponse(ctx context.Context, params *GetVariablesParams) (*GetVariablesResponse, error) + if params.ZapTraceSpan != nil { + var headerParam0 string - // PostVariables request with any body - PostVariablesWithBodyWithResponse(ctx context.Context, params *PostVariablesParams, contentType string, body io.Reader) (*PostVariablesResponse, error) + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } - PostVariablesWithResponse(ctx context.Context, params *PostVariablesParams, body PostVariablesJSONRequestBody) (*PostVariablesResponse, error) + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // DeleteVariablesID request - DeleteVariablesIDWithResponse(ctx context.Context, variableID string, params *DeleteVariablesIDParams) (*DeleteVariablesIDResponse, error) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - // GetVariablesID request - GetVariablesIDWithResponse(ctx context.Context, variableID string, params *GetVariablesIDParams) (*GetVariablesIDResponse, error) + defer func() { _ = rsp.Body.Close() }() - // PatchVariablesID request with any body - PatchVariablesIDWithBodyWithResponse(ctx context.Context, variableID string, params *PatchVariablesIDParams, contentType string, body io.Reader) (*PatchVariablesIDResponse, error) + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil - PatchVariablesIDWithResponse(ctx context.Context, variableID string, params *PatchVariablesIDParams, body PatchVariablesIDJSONRequestBody) (*PatchVariablesIDResponse, error) +} - // PutVariablesID request with any body - PutVariablesIDWithBodyWithResponse(ctx context.Context, variableID string, params *PutVariablesIDParams, contentType string, body io.Reader) (*PutVariablesIDResponse, error) +// GetDashboardsIDMembers calls the GET on /dashboards/{dashboardID}/members +// List all dashboard members +func (c *Client) GetDashboardsIDMembers(ctx context.Context, params *GetDashboardsIDMembersAllParams) (*ResourceMembers, error) { + var err error - PutVariablesIDWithResponse(ctx context.Context, variableID string, params *PutVariablesIDParams, body PutVariablesIDJSONRequestBody) (*PutVariablesIDResponse, error) + var pathParam0 string - // GetVariablesIDLabels request - GetVariablesIDLabelsWithResponse(ctx context.Context, variableID string, params *GetVariablesIDLabelsParams) (*GetVariablesIDLabelsResponse, error) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err + } - // PostVariablesIDLabels request with any body - PostVariablesIDLabelsWithBodyWithResponse(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, contentType string, body io.Reader) (*PostVariablesIDLabelsResponse, error) + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } - PostVariablesIDLabelsWithResponse(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, body PostVariablesIDLabelsJSONRequestBody) (*PostVariablesIDLabelsResponse, error) + operationPath := fmt.Sprintf("./dashboards/%s/members", pathParam0) - // DeleteVariablesIDLabelsID request - DeleteVariablesIDLabelsIDWithResponse(ctx context.Context, variableID string, labelID string, params *DeleteVariablesIDLabelsIDParams) (*DeleteVariablesIDLabelsIDResponse, error) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // PostWrite request with any body - PostWriteWithBodyWithResponse(ctx context.Context, params *PostWriteParams, contentType string, body io.Reader) (*PostWriteResponse, error) -} + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } -type GetRoutesResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Routes -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetRoutesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetRoutesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type GetAuthorizationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorizations - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r GetAuthorizationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetAuthorizationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostAuthorizationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Authorization - JSON400 *Error - JSONDefault *Error -} + response := &ResourceMembers{} -// Status returns HTTPResponse.Status -func (r PostAuthorizationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostAuthorizationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PostDashboardsIDMembers calls the POST on /dashboards/{dashboardID}/members +// Add a member to a dashboard +func (c *Client) PostDashboardsIDMembers(ctx context.Context, params *PostDashboardsIDMembersAllParams) (*ResourceMember, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type DeleteAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorization - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dashboards/%s/members", pathParam0) -// Status returns HTTPResponse.Status -func (r GetAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PatchAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorization - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PatchAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PatchAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type GetBackupKVResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r GetBackupKVResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetBackupKVResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetBackupMetadataResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + response := &ResourceMember{} -// Status returns HTTPResponse.Status -func (r GetBackupMetadataResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetBackupMetadataResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetBackupShardIdResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} +// DeleteDashboardsIDMembersID calls the DELETE on /dashboards/{dashboardID}/members/{userID} +// Remove a member from a dashboard +func (c *Client) DeleteDashboardsIDMembersID(ctx context.Context, params *DeleteDashboardsIDMembersIDAllParams) error { + var err error -// Status returns HTTPResponse.Status -func (r GetBackupShardIdResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r GetBackupShardIdResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return err } - return 0 -} -type GetBucketsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Buckets - JSONDefault *Error -} + var pathParam1 string -// Status returns HTTPResponse.Status -func (r GetBucketsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetBucketsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type PostBucketsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Bucket - JSON422 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dashboards/%s/members/%s", pathParam0, pathParam1) -// Status returns HTTPResponse.Status -func (r PostBucketsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostBucketsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type DeleteBucketsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r DeleteBucketsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteBucketsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type GetBucketsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Bucket - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r GetBucketsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetBucketsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PatchBucketsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Bucket - JSONDefault *Error -} +// GetDashboardsIDOwners calls the GET on /dashboards/{dashboardID}/owners +// List all dashboard owners +func (c *Client) GetDashboardsIDOwners(ctx context.Context, params *GetDashboardsIDOwnersAllParams) (*ResourceOwners, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PatchBucketsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchBucketsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetBucketsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dashboards/%s/owners", pathParam0) -// Status returns HTTPResponse.Status -func (r GetBucketsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetBucketsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type PostBucketsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r PostBucketsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostBucketsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type DeleteBucketsIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r DeleteBucketsIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteBucketsIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetBucketsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSONDefault *Error -} + response := &ResourceOwners{} -// Status returns HTTPResponse.Status -func (r GetBucketsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetBucketsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PostDashboardsIDOwners calls the POST on /dashboards/{dashboardID}/owners +// Add an owner to a dashboard +func (c *Client) PostDashboardsIDOwners(ctx context.Context, params *PostDashboardsIDOwnersAllParams) (*ResourceOwner, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type PostBucketsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostBucketsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostBucketsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteBucketsIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dashboards/%s/owners", pathParam0) -// Status returns HTTPResponse.Status -func (r DeleteBucketsIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteBucketsIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type GetBucketsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r GetBucketsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r GetBucketsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type PostBucketsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r PostBucketsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PostBucketsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type DeleteBucketsIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + response := &ResourceOwner{} -// Status returns HTTPResponse.Status -func (r DeleteBucketsIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteBucketsIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetChecksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Checks - JSONDefault *Error -} +// DeleteDashboardsIDOwnersID calls the DELETE on /dashboards/{dashboardID}/owners/{userID} +// Remove an owner from a dashboard +func (c *Client) DeleteDashboardsIDOwnersID(ctx context.Context, params *DeleteDashboardsIDOwnersIDAllParams) error { + var err error -// Status returns HTTPResponse.Status -func (r GetChecksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r GetChecksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dashboardID", runtime.ParamLocationPath, params.DashboardID) + if err != nil { + return err } - return 0 -} -type CreateCheckResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Check - JSONDefault *Error -} + var pathParam1 string -// Status returns HTTPResponse.Status -func (r CreateCheckResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r CreateCheckResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type DeleteChecksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dashboards/%s/owners/%s", pathParam0, pathParam1) -// Status returns HTTPResponse.Status -func (r DeleteChecksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteChecksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type GetChecksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Check - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetChecksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetChecksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type PatchChecksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Check - JSON404 *Error - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r PatchChecksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchChecksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return 0 -} + return nil -type PutChecksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Check - JSON404 *Error - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PutChecksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} +// GetDBRPs calls the GET on /dbrps +// List database retention policy mappings +func (c *Client) GetDBRPs(ctx context.Context, params *GetDBRPsParams) (*DBRPs, error) { + var err error -// StatusCode returns HTTPResponse.StatusCode -func (r PutChecksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetChecksIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dbrps") -// Status returns HTTPResponse.Status -func (r GetChecksIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetChecksIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type PostChecksIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r PostChecksIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostChecksIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteChecksIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r DeleteChecksIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteChecksIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetChecksIDQueryResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *FluxResponse - JSON400 *Error - JSON404 *Error - JSONDefault *Error -} + if params.Id != nil { -// Status returns HTTPResponse.Status -func (r GetChecksIDQueryResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetChecksIDQueryResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetConfigResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Config - JSON401 *Error - JSONDefault *Error -} + if params.BucketID != nil { -// Status returns HTTPResponse.Status -func (r GetConfigResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucketID", runtime.ParamLocationQuery, *params.BucketID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetConfigResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetDashboardsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Dashboards - JSONDefault *Error -} + if params.Default != nil { -// Status returns HTTPResponse.Status -func (r GetDashboardsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "default", runtime.ParamLocationQuery, *params.Default); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostDashboardsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *interface{} - JSONDefault *Error -} + if params.Db != nil { -// Status returns HTTPResponse.Status -func (r PostDashboardsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "db", runtime.ParamLocationQuery, *params.Db); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostDashboardsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteDashboardsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.Rp != nil { -// Status returns HTTPResponse.Status -func (r DeleteDashboardsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "rp", runtime.ParamLocationQuery, *params.Rp); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDashboardsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetDashboardsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *interface{} - JSON404 *Error - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r GetDashboardsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type PatchDashboardsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Dashboard - JSON404 *Error - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// Status returns HTTPResponse.Status -func (r PatchDashboardsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchDashboardsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return 0 -} - -type PostDashboardsIDCellsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Cell - JSON404 *Error - JSONDefault *Error -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r PostDashboardsIDCellsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostDashboardsIDCellsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &DBRPs{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PutDashboardsIDCellsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Dashboard - JSON404 *Error - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PutDashboardsIDCellsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// PostDBRP calls the POST on /dbrps +// Add a database retention policy mapping +func (c *Client) PostDBRP(ctx context.Context, params *PostDBRPAllParams) (*DBRP, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r PutDashboardsIDCellsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteDashboardsIDCellsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dbrps") -// Status returns HTTPResponse.Status -func (r DeleteDashboardsIDCellsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDashboardsIDCellsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PatchDashboardsIDCellsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Cell - JSON404 *Error - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PatchDashboardsIDCellsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PatchDashboardsIDCellsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type GetDashboardsIDCellsIDViewResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *View - JSON404 *Error - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r GetDashboardsIDCellsIDViewResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsIDCellsIDViewResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PatchDashboardsIDCellsIDViewResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *View - JSON404 *Error - JSONDefault *Error -} + response := &DBRP{} -// Status returns HTTPResponse.Status -func (r PatchDashboardsIDCellsIDViewResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r PatchDashboardsIDCellsIDViewResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetDashboardsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} +// DeleteDBRPID calls the DELETE on /dbrps/{dbrpID} +// Delete a database retention policy +func (c *Client) DeleteDBRPID(ctx context.Context, params *DeleteDBRPIDAllParams) error { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetDashboardsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, params.DbrpID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type PostDashboardsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dbrps/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r PostDashboardsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostDashboardsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type DeleteDashboardsIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r DeleteDashboardsIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDashboardsIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetDashboardsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r GetDashboardsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostDashboardsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r PostDashboardsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostDashboardsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type DeleteDashboardsIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r DeleteDashboardsIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDashboardsIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type GetDashboardsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r GetDashboardsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetDashboardsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PostDashboardsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} +// GetDBRPsID calls the GET on /dbrps/{dbrpID} +// Retrieve a database retention policy mapping +func (c *Client) GetDBRPsID(ctx context.Context, params *GetDBRPsIDAllParams) (*DBRPGet, error) { + var err error -// Status returns HTTPResponse.Status -func (r PostDashboardsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, params.DbrpID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostDashboardsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteDashboardsIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dbrps/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r DeleteDashboardsIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDashboardsIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type GetDBRPsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DBRPs - JSON400 *Error - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r GetDBRPsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetDBRPsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostDBRPResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *DBRP - JSON400 *Error - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r PostDBRPResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostDBRPResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteDBRPIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *Error - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r DeleteDBRPIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + queryURL.RawQuery = queryValues.Encode() -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteDBRPIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetDBRPsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DBRPGet - JSON400 *Error - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetDBRPsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetDBRPsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type PatchDBRPIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *DBRPGet - JSON400 *Error - JSON404 *Error - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PatchDBRPIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PatchDBRPIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostDeleteResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *Error - JSON403 *Error - JSON404 *Error - JSONDefault *Error -} + response := &DBRPGet{} -// Status returns HTTPResponse.Status -func (r PostDeleteResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostDeleteResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PatchDBRPID calls the PATCH on /dbrps/{dbrpID} +// Update a database retention policy mapping +func (c *Client) PatchDBRPID(ctx context.Context, params *PatchDBRPIDAllParams) (*DBRPGet, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type GetFlagsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Flags - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetFlagsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "dbrpID", runtime.ParamLocationPath, params.DbrpID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetFlagsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetHealthResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HealthCheck - JSON503 *HealthCheck - JSONDefault *Error -} + operationPath := fmt.Sprintf("./dbrps/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetHealthResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetHealthResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type GetLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r GetLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r PostLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r DeleteLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + req.Header.Add("Content-Type", "application/json") -type GetLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelResponse - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type PatchLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelResponse - JSON404 *Error - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PatchLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PatchLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} - -type GetLegacyAuthorizationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorizations - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r GetLegacyAuthorizationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + response := &DBRPGet{} -// StatusCode returns HTTPResponse.StatusCode -func (r GetLegacyAuthorizationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PostLegacyAuthorizationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Authorization - JSON400 *Error - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PostLegacyAuthorizationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// PostDelete calls the POST on /delete +// Delete data +func (c *Client) PostDelete(ctx context.Context, params *PostDeleteAllParams) error { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r PostLegacyAuthorizationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type DeleteLegacyAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./delete") -// Status returns HTTPResponse.Status -func (r DeleteLegacyAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteLegacyAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type GetLegacyAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorization - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r GetLegacyAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetLegacyAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PatchLegacyAuthorizationsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Authorization - JSONDefault *Error -} + if params.Bucket != nil { -// Status returns HTTPResponse.Status -func (r PatchLegacyAuthorizationsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucket", runtime.ParamLocationQuery, *params.Bucket); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PatchLegacyAuthorizationsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostLegacyAuthorizationsIDPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r PostLegacyAuthorizationsIDPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostLegacyAuthorizationsIDPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetMeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *UserResponse - JSONDefault *Error -} + if params.BucketID != nil { -// Status returns HTTPResponse.Status -func (r GetMeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "bucketID", runtime.ParamLocationQuery, *params.BucketID); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMeResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PutMePasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r PutMePasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PutMePasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + req.Header.Add("Content-Type", "application/json") -type GetMetricsResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetMetricsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetMetricsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type GetNotificationEndpointsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationEndpoints - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r GetNotificationEndpointsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationEndpointsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return 0 -} + return nil -type CreateNotificationEndpointResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *NotificationEndpoint - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r CreateNotificationEndpointResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} +// GetFlags calls the GET on /flags +// Return the feature flags for the currently authenticated user +func (c *Client) GetFlags(ctx context.Context, params *GetFlagsParams) (*Flags, error) { + var err error -// StatusCode returns HTTPResponse.StatusCode -func (r CreateNotificationEndpointResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteNotificationEndpointsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./flags") -// Status returns HTTPResponse.Status -func (r DeleteNotificationEndpointsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteNotificationEndpointsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetNotificationEndpointsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationEndpoint - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetNotificationEndpointsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationEndpointsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type PatchNotificationEndpointsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationEndpoint - JSON404 *Error - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r PatchNotificationEndpointsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PatchNotificationEndpointsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PutNotificationEndpointsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationEndpoint - JSON404 *Error - JSONDefault *Error -} + response := &Flags{} -// Status returns HTTPResponse.Status -func (r PutNotificationEndpointsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PutNotificationEndpointsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// GetHealth calls the GET on /health +// Retrieve the health of the instance +func (c *Client) GetHealth(ctx context.Context, params *GetHealthParams) (*HealthCheck, error) { + var err error + + serverURL, err := url.Parse(c.Server) + if err != nil { + return nil, err } - return 0 -} -type GetNotificationEndpointsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./health") -// Status returns HTTPResponse.Status -func (r GetNotificationEndpointsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationEndpointsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type PostNotificationEndpointIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r PostNotificationEndpointIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostNotificationEndpointIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type DeleteNotificationEndpointsIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r DeleteNotificationEndpointsIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteNotificationEndpointsIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetNotificationRulesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationRules - JSONDefault *Error -} + response := &HealthCheck{} -// Status returns HTTPResponse.Status -func (r GetNotificationRulesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationRulesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type CreateNotificationRuleResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *NotificationRule - JSONDefault *Error -} +// GetLabels calls the GET on /labels +// List all labels +func (c *Client) GetLabels(ctx context.Context, params *GetLabelsParams) (*LabelsResponse, error) { + var err error -// Status returns HTTPResponse.Status -func (r CreateNotificationRuleResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r CreateNotificationRuleResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + operationPath := fmt.Sprintf("./labels") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return 0 -} -type DeleteNotificationRulesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + queryValues := queryURL.Query() -// Status returns HTTPResponse.Status -func (r DeleteNotificationRulesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.OrgID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteNotificationRulesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetNotificationRulesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationRule - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r GetNotificationRulesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationRulesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type PatchNotificationRulesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationRule - JSON404 *Error - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// Status returns HTTPResponse.Status -func (r PatchNotificationRulesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchNotificationRulesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return 0 -} - -type PutNotificationRulesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *NotificationRule - JSON404 *Error - JSONDefault *Error -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r PutNotificationRulesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PutNotificationRulesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &LabelsResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type GetNotificationRulesIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r GetNotificationRulesIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// PostLabels calls the POST on /labels +// Create a label +func (c *Client) PostLabels(ctx context.Context, params *PostLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationRulesIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostNotificationRuleIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./labels") -// Status returns HTTPResponse.Status -func (r PostNotificationRuleIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostNotificationRuleIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type DeleteNotificationRulesIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r DeleteNotificationRulesIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteNotificationRulesIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetNotificationRulesIDQueryResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *FluxResponse - JSON400 *Error - JSON404 *Error - JSONDefault *Error -} + response := &LabelResponse{} -// Status returns HTTPResponse.Status -func (r GetNotificationRulesIDQueryResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetNotificationRulesIDQueryResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetOrgsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Organizations - JSONDefault *Error -} +// DeleteLabelsID calls the DELETE on /labels/{labelID} +// Delete a label +func (c *Client) DeleteLabelsID(ctx context.Context, params *DeleteLabelsIDAllParams) error { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetOrgsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetOrgsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type PostOrgsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Organization - JSONDefault *Error -} + operationPath := fmt.Sprintf("./labels/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r PostOrgsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostOrgsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type DeleteOrgsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r DeleteOrgsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteOrgsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type GetOrgsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Organization - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r GetOrgsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetOrgsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PatchOrgsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Organization - JSONDefault *Error -} +// GetLabelsID calls the GET on /labels/{labelID} +// Retrieve a label +func (c *Client) GetLabelsID(ctx context.Context, params *GetLabelsIDAllParams) (*LabelResponse, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PatchOrgsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchOrgsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetOrgsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./labels/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetOrgsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetOrgsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type PostOrgsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r PostOrgsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostOrgsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type DeleteOrgsIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r DeleteOrgsIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteOrgsIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetOrgsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSON404 *Error - JSONDefault *Error -} + response := &LabelResponse{} -// Status returns HTTPResponse.Status -func (r GetOrgsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetOrgsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PatchLabelsID calls the PATCH on /labels/{labelID} +// Update a label +func (c *Client) PatchLabelsID(ctx context.Context, params *PatchLabelsIDAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type PostOrgsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostOrgsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostOrgsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteOrgsIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./labels/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r DeleteOrgsIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteOrgsIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type GetOrgsIDSecretsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *SecretKeysResponse - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r GetOrgsIDSecretsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetOrgsIDSecretsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type PatchOrgsIDSecretsResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r PatchOrgsIDSecretsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchOrgsIDSecretsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &LabelResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PostOrgsIDSecretsResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PostOrgsIDSecretsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} +// GetMe calls the GET on /me +// Retrieve the currently authenticated user +func (c *Client) GetMe(ctx context.Context, params *GetMeParams) (*UserResponse, error) { + var err error -// StatusCode returns HTTPResponse.StatusCode -func (r PostOrgsIDSecretsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteOrgsIDSecretsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./me") -// Status returns HTTPResponse.Status -func (r DeleteOrgsIDSecretsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteOrgsIDSecretsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetPingResponse struct { - Body []byte - HTTPResponse *http.Response -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetPingResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetPingResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type HeadPingResponse struct { - Body []byte - HTTPResponse *http.Response -} -// Status returns HTTPResponse.Status -func (r HeadPingResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r HeadPingResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} - -type PostQueryResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r PostQueryResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + response := &UserResponse{} -// StatusCode returns HTTPResponse.StatusCode -func (r PostQueryResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PostQueryAnalyzeResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *AnalyzeQueryResponse - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PostQueryAnalyzeResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// PutMePassword calls the PUT on /me/password +// Update a password +func (c *Client) PutMePassword(ctx context.Context, params *PutMePasswordAllParams) error { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r PostQueryAnalyzeResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type PostQueryAstResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ASTResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./me/password") -// Status returns HTTPResponse.Status -func (r PostQueryAstResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostQueryAstResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return err } - return 0 -} - -type GetQuerySuggestionsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *FluxSuggestions - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r GetQuerySuggestionsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + req.Header.Add("Content-Type", "application/json") -// StatusCode returns HTTPResponse.StatusCode -func (r GetQuerySuggestionsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type GetQuerySuggestionsNameResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *FluxSuggestion - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r GetQuerySuggestionsNameResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetQuerySuggestionsNameResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type GetReadyResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Ready - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r GetReadyResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetReadyResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetRemoteConnectionsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *RemoteConnections - JSON404 *Error - JSONDefault *Error -} +// GetNotificationEndpoints calls the GET on /notificationEndpoints +// List all notification endpoints +func (c *Client) GetNotificationEndpoints(ctx context.Context, params *GetNotificationEndpointsParams) (*NotificationEndpoints, error) { + var err error -// Status returns HTTPResponse.Status -func (r GetRemoteConnectionsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetRemoteConnectionsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + operationPath := fmt.Sprintf("./notificationEndpoints") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return 0 -} -type PostRemoteConnectionResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *RemoteConnection - JSON400 *Error - JSONDefault *Error -} + queryValues := queryURL.Query() -// Status returns HTTPResponse.Status -func (r PostRemoteConnectionResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.Offset != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostRemoteConnectionResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteRemoteConnectionByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// Status returns HTTPResponse.Status -func (r DeleteRemoteConnectionByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteRemoteConnectionByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - return 0 -} -type GetRemoteConnectionByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *RemoteConnection - JSON404 *Error - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r GetRemoteConnectionByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetRemoteConnectionByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type PatchRemoteConnectionByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *RemoteConnection - JSON400 *Error - JSON404 *Error - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// Status returns HTTPResponse.Status -func (r PatchRemoteConnectionByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchRemoteConnectionByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return 0 -} - -type GetReplicationsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Replications - JSON404 *Error - JSONDefault *Error -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r GetReplicationsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetReplicationsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &NotificationEndpoints{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PostReplicationResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Replication - JSON400 *Error - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PostReplicationResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// CreateNotificationEndpoint calls the POST on /notificationEndpoints +// Add a notification endpoint +func (c *Client) CreateNotificationEndpoint(ctx context.Context, params *CreateNotificationEndpointAllParams) (*NotificationEndpoint, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r PostReplicationResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteReplicationByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints") -// Status returns HTTPResponse.Status -func (r DeleteReplicationByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteReplicationByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type GetReplicationByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Replication - JSON404 *Error - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r GetReplicationByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetReplicationByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PatchReplicationByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Replication - JSON400 *Error - JSON404 *Error - JSONDefault *Error -} + response := &NotificationEndpoint{} -// Status returns HTTPResponse.Status -func (r PatchReplicationByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r PatchReplicationByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PostValidateReplicationByIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *Error - JSONDefault *Error -} +// DeleteNotificationEndpointsID calls the DELETE on /notificationEndpoints/{endpointID} +// Delete a notification endpoint +func (c *Client) DeleteNotificationEndpointsID(ctx context.Context, params *DeleteNotificationEndpointsIDAllParams) error { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostValidateReplicationByIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostValidateReplicationByIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type GetResourcesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *[]string - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetResourcesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetResourcesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type PostRestoreBucketIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *[]byte - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r PostRestoreBucketIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostRestoreBucketIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type PostRestoreBucketMetadataResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *RestoredBucketMappings - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r PostRestoreBucketMetadataResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r PostRestoreBucketMetadataResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PostRestoreKVResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - // token is the root token for the instance after restore (this is overwritten during the restore) - Token *string `json:"token,omitempty"` - } - JSONDefault *Error -} +// GetNotificationEndpointsID calls the GET on /notificationEndpoints/{endpointID} +// Retrieve a notification endpoint +func (c *Client) GetNotificationEndpointsID(ctx context.Context, params *GetNotificationEndpointsIDAllParams) (*NotificationEndpoint, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostRestoreKVResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostRestoreKVResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostRestoreShardIdResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r PostRestoreShardIdResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostRestoreShardIdResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type PostRestoreSQLResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r PostRestoreSQLResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostRestoreSQLResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type GetScrapersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ScraperTargetResponses -} -// Status returns HTTPResponse.Status -func (r GetScrapersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetScrapersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostScrapersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ScraperTargetResponse - JSONDefault *Error -} + response := &NotificationEndpoint{} -// Status returns HTTPResponse.Status -func (r PostScrapersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostScrapersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PatchNotificationEndpointsID calls the PATCH on /notificationEndpoints/{endpointID} +// Update a notification endpoint +func (c *Client) PatchNotificationEndpointsID(ctx context.Context, params *PatchNotificationEndpointsIDAllParams) (*NotificationEndpoint, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type DeleteScrapersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteScrapersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteScrapersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetScrapersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ScraperTargetResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetScrapersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetScrapersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PatchScrapersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ScraperTargetResponse - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PatchScrapersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PatchScrapersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type GetScrapersIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r GetScrapersIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetScrapersIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostScrapersIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + response := &NotificationEndpoint{} -// Status returns HTTPResponse.Status -func (r PostScrapersIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostScrapersIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PutNotificationEndpointsID calls the PUT on /notificationEndpoints/{endpointID} +// Update a notification endpoint +func (c *Client) PutNotificationEndpointsID(ctx context.Context, params *PutNotificationEndpointsIDAllParams) (*NotificationEndpoint, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type DeleteScrapersIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteScrapersIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteScrapersIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetScrapersIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetScrapersIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetScrapersIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PostScrapersIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PostScrapersIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PostScrapersIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type DeleteScrapersIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r DeleteScrapersIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteScrapersIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetScrapersIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSONDefault *Error -} + response := &NotificationEndpoint{} -// Status returns HTTPResponse.Status -func (r GetScrapersIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetScrapersIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PostScrapersIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} +// GetNotificationEndpointsIDLabels calls the GET on /notificationEndpoints/{endpointID}/labels +// List all labels for a notification endpoint +func (c *Client) GetNotificationEndpointsIDLabels(ctx context.Context, params *GetNotificationEndpointsIDLabelsAllParams) (*LabelsResponse, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostScrapersIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostScrapersIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type DeleteScrapersIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s/labels", pathParam0) -// Status returns HTTPResponse.Status -func (r DeleteScrapersIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteScrapersIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetSetupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *IsOnboarding -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetSetupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetSetupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type PostSetupResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *OnboardingResponse - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r PostSetupResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PostSetupResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostSigninResponse struct { - Body []byte - HTTPResponse *http.Response - JSON401 *Error - JSON403 *Error - JSONDefault *Error -} + response := &LabelsResponse{} -// Status returns HTTPResponse.Status -func (r PostSigninResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostSigninResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PostNotificationEndpointIDLabels calls the POST on /notificationEndpoints/{endpointID}/labels +// Add a label to a notification endpoint +func (c *Client) PostNotificationEndpointIDLabels(ctx context.Context, params *PostNotificationEndpointIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type PostSignoutResponse struct { - Body []byte - HTTPResponse *http.Response - JSON401 *Error - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PostSignoutResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostSignoutResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetSourcesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Sources - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s/labels", pathParam0) -// Status returns HTTPResponse.Status -func (r GetSourcesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetSourcesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PostSourcesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Source - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PostSourcesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PostSourcesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type DeleteSourcesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r DeleteSourcesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteSourcesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetSourcesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Source - JSON404 *Error - JSONDefault *Error -} + response := &LabelResponse{} -// Status returns HTTPResponse.Status -func (r GetSourcesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetSourcesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PatchSourcesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Source - JSON404 *Error - JSONDefault *Error -} +// DeleteNotificationEndpointsIDLabelsID calls the DELETE on /notificationEndpoints/{endpointID}/labels/{labelID} +// Delete a label from a notification endpoint +func (c *Client) DeleteNotificationEndpointsIDLabelsID(ctx context.Context, params *DeleteNotificationEndpointsIDLabelsIDAllParams) error { + var err error -// Status returns HTTPResponse.Status -func (r PatchSourcesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PatchSourcesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "endpointID", runtime.ParamLocationPath, params.EndpointID) + if err != nil { + return err } - return 0 -} -type GetSourcesIDBucketsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Buckets - JSON404 *Error - JSONDefault *Error -} + var pathParam1 string -// Status returns HTTPResponse.Status -func (r GetSourcesIDBucketsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetSourcesIDBucketsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type GetSourcesIDHealthResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *HealthCheck - JSON503 *HealthCheck - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationEndpoints/%s/labels/%s", pathParam0, pathParam1) -// Status returns HTTPResponse.Status -func (r GetSourcesIDHealthResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetSourcesIDHealthResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type ListStacksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *struct { - Stacks *[]Stack `json:"stacks,omitempty"` - } - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r ListStacksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r ListStacksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type CreateStackResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Stack - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r CreateStackResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r CreateStackResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type DeleteStackResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} +// GetNotificationRules calls the GET on /notificationRules +// List all notification rules +func (c *Client) GetNotificationRules(ctx context.Context, params *GetNotificationRulesParams) (*NotificationRules, error) { + var err error -// Status returns HTTPResponse.Status -func (r DeleteStackResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteStackResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + operationPath := fmt.Sprintf("./notificationRules") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return 0 -} -type ReadStackResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Stack - JSONDefault *Error -} + queryValues := queryURL.Query() -// Status returns HTTPResponse.Status -func (r ReadStackResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.Offset != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r ReadStackResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type UpdateStackResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Stack - JSONDefault *Error -} + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// Status returns HTTPResponse.Status -func (r UpdateStackResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r UpdateStackResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - return 0 -} -type UninstallStackResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Stack - JSONDefault *Error -} + if params.CheckID != nil { -// Status returns HTTPResponse.Status -func (r UninstallStackResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "checkID", runtime.ParamLocationQuery, *params.CheckID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r UninstallStackResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetTasksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Tasks - JSONDefault *Error -} + if params.Tag != nil { -// Status returns HTTPResponse.Status -func (r GetTasksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "tag", runtime.ParamLocationQuery, *params.Tag); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostTasksResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Task - JSONDefault *Error -} + queryURL.RawQuery = queryValues.Encode() -// Status returns HTTPResponse.Status -func (r PostTasksResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + if params.ZapTraceSpan != nil { + var headerParam0 string -type DeleteTasksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// Status returns HTTPResponse.Status -func (r DeleteTasksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTasksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return 0 -} - -type GetTasksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Task - JSONDefault *Error -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r GetTasksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &NotificationRules{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type PatchTasksIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Task - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r PatchTasksIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +// CreateNotificationRule calls the POST on /notificationRules +// Add a notification rule +func (c *Client) CreateNotificationRule(ctx context.Context, params *CreateNotificationRuleAllParams) (*NotificationRule, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyReader = bytes.NewReader(buf) -// StatusCode returns HTTPResponse.StatusCode -func (r PatchTasksIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetTasksIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules") -// Status returns HTTPResponse.Status -func (r GetTasksIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PostTasksIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PostTasksIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type DeleteTasksIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + response := &NotificationRule{} -// Status returns HTTPResponse.Status -func (r DeleteTasksIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTasksIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetTasksIDLogsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Logs - JSONDefault *Error -} +// DeleteNotificationRulesID calls the DELETE on /notificationRules/{ruleID} +// Delete a notification rule +func (c *Client) DeleteNotificationRulesID(ctx context.Context, params *DeleteNotificationRulesIDAllParams) error { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetTasksIDLogsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDLogsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type GetTasksIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetTasksIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type PostTasksIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r PostTasksIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type DeleteTasksIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r DeleteTasksIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTasksIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetTasksIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSONDefault *Error -} +// GetNotificationRulesID calls the GET on /notificationRules/{ruleID} +// Retrieve a notification rule +func (c *Client) GetNotificationRulesID(ctx context.Context, params *GetNotificationRulesIDAllParams) (*NotificationRule, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetTasksIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostTasksIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r PostTasksIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type DeleteTasksIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r DeleteTasksIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTasksIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} - -type GetTasksIDRunsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Runs - JSONDefault *Error -} -// Status returns HTTPResponse.Status -func (r GetTasksIDRunsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDRunsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostTasksIDRunsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Run - JSONDefault *Error -} + response := &NotificationRule{} -// Status returns HTTPResponse.Status -func (r PostTasksIDRunsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksIDRunsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PatchNotificationRulesID calls the PATCH on /notificationRules/{ruleID} +// Update a notification rule +func (c *Client) PatchNotificationRulesID(ctx context.Context, params *PatchNotificationRulesIDAllParams) (*NotificationRule, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type DeleteTasksIDRunsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteTasksIDRunsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTasksIDRunsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetTasksIDRunsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Run - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r GetTasksIDRunsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDRunsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type GetTasksIDRunsIDLogsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Logs - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r GetTasksIDRunsIDLogsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r GetTasksIDRunsIDLogsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type PostTasksIDRunsIDRetryResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Run - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r PostTasksIDRunsIDRetryResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r PostTasksIDRunsIDRetryResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type GetTelegrafPluginsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *TelegrafPlugins - JSONDefault *Error -} + response := &NotificationRule{} -// Status returns HTTPResponse.Status -func (r GetTelegrafPluginsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafPluginsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PutNotificationRulesID calls the PUT on /notificationRules/{ruleID} +// Update a notification rule +func (c *Client) PutNotificationRulesID(ctx context.Context, params *PutNotificationRulesIDAllParams) (*NotificationRule, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type GetTelegrafsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Telegrafs - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r GetTelegrafsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostTelegrafsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Telegraf - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s", pathParam0) -// Status returns HTTPResponse.Status -func (r PostTelegrafsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostTelegrafsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type DeleteTelegrafsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r DeleteTelegrafsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTelegrafsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type GetTelegrafsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Telegraf - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r GetTelegrafsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PutTelegrafsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Telegraf - JSONDefault *Error -} + response := &NotificationRule{} -// Status returns HTTPResponse.Status -func (r PutTelegrafsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r PutTelegrafsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type GetTelegrafsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} +// GetNotificationRulesIDLabels calls the GET on /notificationRules/{ruleID}/labels +// List all labels for a notification rule +func (c *Client) GetNotificationRulesIDLabels(ctx context.Context, params *GetNotificationRulesIDLabelsAllParams) (*LabelsResponse, error) { + var err error -// Status returns HTTPResponse.Status -func (r GetTelegrafsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostTelegrafsIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s/labels", pathParam0) -// Status returns HTTPResponse.Status -func (r PostTelegrafsIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostTelegrafsIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type DeleteTelegrafsIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r DeleteTelegrafsIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTelegrafsIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type GetTelegrafsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceMembers - JSONDefault *Error -} - -// Status returns HTTPResponse.Status -func (r GetTelegrafsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type PostTelegrafsIDMembersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceMember - JSONDefault *Error -} + response := &LabelsResponse{} -// Status returns HTTPResponse.Status -func (r PostTelegrafsIDMembersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) + return response, nil + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostTelegrafsIDMembersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode +// PostNotificationRuleIDLabels calls the POST on /notificationRules/{ruleID}/labels +// Add a label to a notification rule +func (c *Client) PostNotificationRuleIDLabels(ctx context.Context, params *PostNotificationRuleIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err } - return 0 -} + bodyReader = bytes.NewReader(buf) -type DeleteTelegrafsIDMembersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + var pathParam0 string -// Status returns HTTPResponse.Status -func (r DeleteTelegrafsIDMembersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTelegrafsIDMembersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetTelegrafsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *ResourceOwners - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s/labels", pathParam0) -// Status returns HTTPResponse.Status -func (r GetTelegrafsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetTelegrafsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return 0 -} -type PostTelegrafsIDOwnersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *ResourceOwner - JSONDefault *Error -} + req.Header.Add("Content-Type", "application/json") -// Status returns HTTPResponse.Status -func (r PostTelegrafsIDOwnersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r PostTelegrafsIDOwnersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -type DeleteTelegrafsIDOwnersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + req.Header.Set("Zap-Trace-Span", headerParam0) + } -// Status returns HTTPResponse.Status -func (r DeleteTelegrafsIDOwnersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } - return http.StatusText(0) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteTelegrafsIDOwnersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return 0 -} -type ApplyTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *TemplateSummary - JSON201 *TemplateSummary - JSONDefault *Error -} + response := &LabelResponse{} -// Status returns HTTPResponse.Status -func (r ApplyTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return response, nil -// StatusCode returns HTTPResponse.StatusCode -func (r ApplyTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type ExportTemplateResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Template - YAML200 *Template - JSONDefault *Error -} +// DeleteNotificationRulesIDLabelsID calls the DELETE on /notificationRules/{ruleID}/labels/{labelID} +// Delete label from a notification rule +func (c *Client) DeleteNotificationRulesIDLabelsID(ctx context.Context, params *DeleteNotificationRulesIDLabelsIDAllParams) error { + var err error -// Status returns HTTPResponse.Status -func (r ExportTemplateResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + var pathParam0 string -// StatusCode returns HTTPResponse.StatusCode -func (r ExportTemplateResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return err } - return 0 -} -type GetUsersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Users - JSONDefault *Error -} + var pathParam1 string -// Status returns HTTPResponse.Status -func (r GetUsersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetUsersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return 0 -} -type PostUsersResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *UserResponse - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s/labels/%s", pathParam0, pathParam1) -// Status returns HTTPResponse.Status -func (r PostUsersResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostUsersResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return 0 -} -type DeleteUsersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } -// Status returns HTTPResponse.Status -func (r DeleteUsersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + req.Header.Set("Zap-Trace-Span", headerParam0) } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteUsersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - return 0 -} -type GetUsersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *UserResponse - JSONDefault *Error -} + defer func() { _ = rsp.Body.Close() }() -// Status returns HTTPResponse.Status -func (r GetUsersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return http.StatusText(0) -} + return nil -// StatusCode returns HTTPResponse.StatusCode -func (r GetUsersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 } -type PatchUsersIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *UserResponse - JSONDefault *Error -} +// GetNotificationRulesIDQuery calls the GET on /notificationRules/{ruleID}/query +// Retrieve a notification rule query +func (c *Client) GetNotificationRulesIDQuery(ctx context.Context, params *GetNotificationRulesIDQueryAllParams) (*FluxResponse, error) { + var err error + + var pathParam0 string -// Status returns HTTPResponse.Status -func (r PatchUsersIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ruleID", runtime.ParamLocationPath, params.RuleID) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PatchUsersIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type PostUsersIDPasswordResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error -} + operationPath := fmt.Sprintf("./notificationRules/%s/query", pathParam0) -// Status returns HTTPResponse.Status -func (r PostUsersIDPasswordResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostUsersIDPasswordResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - return 0 -} -type GetVariablesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Variables - JSON400 *Error - JSONDefault *Error -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// Status returns HTTPResponse.Status -func (r GetVariablesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetVariablesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + req.Header.Set("Zap-Trace-Span", headerParam0) } - return 0 -} -type PostVariablesResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *Variable - JSONDefault *Error -} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// Status returns HTTPResponse.Status -func (r PostVariablesResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r PostVariablesResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + response := &FluxResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return 0 -} + return response, nil -type DeleteVariablesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSONDefault *Error } -// Status returns HTTPResponse.Status -func (r DeleteVariablesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} +// GetOrgs calls the GET on /orgs +// List organizations +func (c *Client) GetOrgs(ctx context.Context, params *GetOrgsParams) (*Organizations, error) { + var err error -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteVariablesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return 0 -} -type GetVariablesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Variable - JSON404 *Error - JSONDefault *Error -} + operationPath := fmt.Sprintf("./orgs") -// Status returns HTTPResponse.Status -func (r GetVariablesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return http.StatusText(0) -} -// StatusCode returns HTTPResponse.StatusCode -func (r GetVariablesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode - } - return 0 -} + queryValues := queryURL.Query() -type PatchVariablesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Variable - JSONDefault *Error -} + if params.Offset != nil { -// Status returns HTTPResponse.Status -func (r PatchVariablesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PatchVariablesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PutVariablesIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *Variable - JSONDefault *Error -} + if params.Limit != nil { -// Status returns HTTPResponse.Status -func (r PutVariablesIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PutVariablesIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type GetVariablesIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON200 *LabelsResponse - JSONDefault *Error -} + if params.Descending != nil { -// Status returns HTTPResponse.Status -func (r GetVariablesIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "descending", runtime.ParamLocationQuery, *params.Descending); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r GetVariablesIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostVariablesIDLabelsResponse struct { - Body []byte - HTTPResponse *http.Response - JSON201 *LabelResponse - JSONDefault *Error -} + if params.Org != nil { -// Status returns HTTPResponse.Status -func (r PostVariablesIDLabelsResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostVariablesIDLabelsResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type DeleteVariablesIDLabelsIDResponse struct { - Body []byte - HTTPResponse *http.Response - JSON404 *Error - JSONDefault *Error -} + if params.OrgID != nil { -// Status returns HTTPResponse.Status -func (r DeleteVariablesIDLabelsIDResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r DeleteVariablesIDLabelsIDResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -type PostWriteResponse struct { - Body []byte - HTTPResponse *http.Response - JSON400 *LineProtocolError - JSON401 *Error - JSON404 *Error - JSON413 *LineProtocolLengthError - JSON500 *Error - JSONDefault *Error -} + if params.UserID != nil { -// Status returns HTTPResponse.Status -func (r PostWriteResponse) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status - } - return http.StatusText(0) -} + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "userID", runtime.ParamLocationQuery, *params.UserID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } -// StatusCode returns HTTPResponse.StatusCode -func (r PostWriteResponse) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode } - return 0 -} -// GetRoutesWithResponse request returning *GetRoutesResponse -func (c *ClientWithResponses) GetRoutesWithResponse(ctx context.Context, params *GetRoutesParams) (*GetRoutesResponse, error) { - rsp, err := c.GetRoutes(ctx, params) + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseGetRoutesResponse(rsp) -} -// GetAuthorizationsWithResponse request returning *GetAuthorizationsResponse -func (c *ClientWithResponses) GetAuthorizationsWithResponse(ctx context.Context, params *GetAuthorizationsParams) (*GetAuthorizationsResponse, error) { - rsp, err := c.GetAuthorizations(ctx, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetAuthorizationsResponse(rsp) -} -// PostAuthorizationsWithBodyWithResponse request with arbitrary body returning *PostAuthorizationsResponse -func (c *ClientWithResponses) PostAuthorizationsWithBodyWithResponse(ctx context.Context, params *PostAuthorizationsParams, contentType string, body io.Reader) (*PostAuthorizationsResponse, error) { - rsp, err := c.PostAuthorizationsWithBody(ctx, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostAuthorizationsResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PostAuthorizationsWithResponse(ctx context.Context, params *PostAuthorizationsParams, body PostAuthorizationsJSONRequestBody) (*PostAuthorizationsResponse, error) { - rsp, err := c.PostAuthorizations(ctx, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostAuthorizationsResponse(rsp) -} -// DeleteAuthorizationsIDWithResponse request returning *DeleteAuthorizationsIDResponse -func (c *ClientWithResponses) DeleteAuthorizationsIDWithResponse(ctx context.Context, authID string, params *DeleteAuthorizationsIDParams) (*DeleteAuthorizationsIDResponse, error) { - rsp, err := c.DeleteAuthorizationsID(ctx, authID, params) - if err != nil { - return nil, err + response := &Organizations{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseDeleteAuthorizationsIDResponse(rsp) + return response, nil + } -// GetAuthorizationsIDWithResponse request returning *GetAuthorizationsIDResponse -func (c *ClientWithResponses) GetAuthorizationsIDWithResponse(ctx context.Context, authID string, params *GetAuthorizationsIDParams) (*GetAuthorizationsIDResponse, error) { - rsp, err := c.GetAuthorizationsID(ctx, authID, params) +// PostOrgs calls the POST on /orgs +// Create an organization +func (c *Client) PostOrgs(ctx context.Context, params *PostOrgsAllParams) (*Organization, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseGetAuthorizationsIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -// PatchAuthorizationsIDWithBodyWithResponse request with arbitrary body returning *PatchAuthorizationsIDResponse -func (c *ClientWithResponses) PatchAuthorizationsIDWithBodyWithResponse(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, contentType string, body io.Reader) (*PatchAuthorizationsIDResponse, error) { - rsp, err := c.PatchAuthorizationsIDWithBody(ctx, authID, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePatchAuthorizationsIDResponse(rsp) -} -func (c *ClientWithResponses) PatchAuthorizationsIDWithResponse(ctx context.Context, authID string, params *PatchAuthorizationsIDParams, body PatchAuthorizationsIDJSONRequestBody) (*PatchAuthorizationsIDResponse, error) { - rsp, err := c.PatchAuthorizationsID(ctx, authID, params, body) + operationPath := fmt.Sprintf("./orgs") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePatchAuthorizationsIDResponse(rsp) -} -// GetBackupKVWithResponse request returning *GetBackupKVResponse -func (c *ClientWithResponses) GetBackupKVWithResponse(ctx context.Context, params *GetBackupKVParams) (*GetBackupKVResponse, error) { - rsp, err := c.GetBackupKV(ctx, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseGetBackupKVResponse(rsp) -} -// GetBackupMetadataWithResponse request returning *GetBackupMetadataResponse -func (c *ClientWithResponses) GetBackupMetadataWithResponse(ctx context.Context, params *GetBackupMetadataParams) (*GetBackupMetadataResponse, error) { - rsp, err := c.GetBackupMetadata(ctx, params) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetBackupMetadataResponse(rsp) -} -// GetBackupShardIdWithResponse request returning *GetBackupShardIdResponse -func (c *ClientWithResponses) GetBackupShardIdWithResponse(ctx context.Context, shardID int64, params *GetBackupShardIdParams) (*GetBackupShardIdResponse, error) { - rsp, err := c.GetBackupShardId(ctx, shardID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseGetBackupShardIdResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetBucketsWithResponse request returning *GetBucketsResponse -func (c *ClientWithResponses) GetBucketsWithResponse(ctx context.Context, params *GetBucketsParams) (*GetBucketsResponse, error) { - rsp, err := c.GetBuckets(ctx, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetBucketsResponse(rsp) -} -// PostBucketsWithBodyWithResponse request with arbitrary body returning *PostBucketsResponse -func (c *ClientWithResponses) PostBucketsWithBodyWithResponse(ctx context.Context, params *PostBucketsParams, contentType string, body io.Reader) (*PostBucketsResponse, error) { - rsp, err := c.PostBucketsWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + response := &Organization{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostBucketsResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PostBucketsWithResponse(ctx context.Context, params *PostBucketsParams, body PostBucketsJSONRequestBody) (*PostBucketsResponse, error) { - rsp, err := c.PostBuckets(ctx, params, body) +// DeleteOrgsID calls the DELETE on /orgs/{orgID} +// Delete an organization +func (c *Client) DeleteOrgsID(ctx context.Context, params *DeleteOrgsIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParsePostBucketsResponse(rsp) -} -// DeleteBucketsIDWithResponse request returning *DeleteBucketsIDResponse -func (c *ClientWithResponses) DeleteBucketsIDWithResponse(ctx context.Context, bucketID string, params *DeleteBucketsIDParams) (*DeleteBucketsIDResponse, error) { - rsp, err := c.DeleteBucketsID(ctx, bucketID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParseDeleteBucketsIDResponse(rsp) -} -// GetBucketsIDWithResponse request returning *GetBucketsIDResponse -func (c *ClientWithResponses) GetBucketsIDWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDParams) (*GetBucketsIDResponse, error) { - rsp, err := c.GetBucketsID(ctx, bucketID, params) + operationPath := fmt.Sprintf("./orgs/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetBucketsIDResponse(rsp) -} -// PatchBucketsIDWithBodyWithResponse request with arbitrary body returning *PatchBucketsIDResponse -func (c *ClientWithResponses) PatchBucketsIDWithBodyWithResponse(ctx context.Context, bucketID string, params *PatchBucketsIDParams, contentType string, body io.Reader) (*PatchBucketsIDResponse, error) { - rsp, err := c.PatchBucketsIDWithBody(ctx, bucketID, params, contentType, body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePatchBucketsIDResponse(rsp) -} -func (c *ClientWithResponses) PatchBucketsIDWithResponse(ctx context.Context, bucketID string, params *PatchBucketsIDParams, body PatchBucketsIDJSONRequestBody) (*PatchBucketsIDResponse, error) { - rsp, err := c.PatchBucketsID(ctx, bucketID, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePatchBucketsIDResponse(rsp) -} -// GetBucketsIDLabelsWithResponse request returning *GetBucketsIDLabelsResponse -func (c *ClientWithResponses) GetBucketsIDLabelsWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDLabelsParams) (*GetBucketsIDLabelsResponse, error) { - rsp, err := c.GetBucketsIDLabels(ctx, bucketID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParseGetBucketsIDLabelsResponse(rsp) -} -// PostBucketsIDLabelsWithBodyWithResponse request with arbitrary body returning *PostBucketsIDLabelsResponse -func (c *ClientWithResponses) PostBucketsIDLabelsWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, contentType string, body io.Reader) (*PostBucketsIDLabelsResponse, error) { - rsp, err := c.PostBucketsIDLabelsWithBody(ctx, bucketID, params, contentType, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePostBucketsIDLabelsResponse(rsp) + return nil + } -func (c *ClientWithResponses) PostBucketsIDLabelsWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDLabelsParams, body PostBucketsIDLabelsJSONRequestBody) (*PostBucketsIDLabelsResponse, error) { - rsp, err := c.PostBucketsIDLabels(ctx, bucketID, params, body) +// GetOrgsID calls the GET on /orgs/{orgID} +// Retrieve an organization +func (c *Client) GetOrgsID(ctx context.Context, params *GetOrgsIDAllParams) (*Organization, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParsePostBucketsIDLabelsResponse(rsp) -} -// DeleteBucketsIDLabelsIDWithResponse request returning *DeleteBucketsIDLabelsIDResponse -func (c *ClientWithResponses) DeleteBucketsIDLabelsIDWithResponse(ctx context.Context, bucketID string, labelID string, params *DeleteBucketsIDLabelsIDParams) (*DeleteBucketsIDLabelsIDResponse, error) { - rsp, err := c.DeleteBucketsIDLabelsID(ctx, bucketID, labelID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseDeleteBucketsIDLabelsIDResponse(rsp) -} -// GetBucketsIDMembersWithResponse request returning *GetBucketsIDMembersResponse -func (c *ClientWithResponses) GetBucketsIDMembersWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDMembersParams) (*GetBucketsIDMembersResponse, error) { - rsp, err := c.GetBucketsIDMembers(ctx, bucketID, params) + operationPath := fmt.Sprintf("./orgs/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetBucketsIDMembersResponse(rsp) -} -// PostBucketsIDMembersWithBodyWithResponse request with arbitrary body returning *PostBucketsIDMembersResponse -func (c *ClientWithResponses) PostBucketsIDMembersWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, contentType string, body io.Reader) (*PostBucketsIDMembersResponse, error) { - rsp, err := c.PostBucketsIDMembersWithBody(ctx, bucketID, params, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostBucketsIDMembersResponse(rsp) -} -func (c *ClientWithResponses) PostBucketsIDMembersWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDMembersParams, body PostBucketsIDMembersJSONRequestBody) (*PostBucketsIDMembersResponse, error) { - rsp, err := c.PostBucketsIDMembers(ctx, bucketID, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostBucketsIDMembersResponse(rsp) -} -// DeleteBucketsIDMembersIDWithResponse request returning *DeleteBucketsIDMembersIDResponse -func (c *ClientWithResponses) DeleteBucketsIDMembersIDWithResponse(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDMembersIDParams) (*DeleteBucketsIDMembersIDResponse, error) { - rsp, err := c.DeleteBucketsIDMembersID(ctx, bucketID, userID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteBucketsIDMembersIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetBucketsIDOwnersWithResponse request returning *GetBucketsIDOwnersResponse -func (c *ClientWithResponses) GetBucketsIDOwnersWithResponse(ctx context.Context, bucketID string, params *GetBucketsIDOwnersParams) (*GetBucketsIDOwnersResponse, error) { - rsp, err := c.GetBucketsIDOwners(ctx, bucketID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetBucketsIDOwnersResponse(rsp) + + response := &Organization{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// PostBucketsIDOwnersWithBodyWithResponse request with arbitrary body returning *PostBucketsIDOwnersResponse -func (c *ClientWithResponses) PostBucketsIDOwnersWithBodyWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, contentType string, body io.Reader) (*PostBucketsIDOwnersResponse, error) { - rsp, err := c.PostBucketsIDOwnersWithBody(ctx, bucketID, params, contentType, body) +// PatchOrgsID calls the PATCH on /orgs/{orgID} +// Update an organization +func (c *Client) PatchOrgsID(ctx context.Context, params *PatchOrgsIDAllParams) (*Organization, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePostBucketsIDOwnersResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -func (c *ClientWithResponses) PostBucketsIDOwnersWithResponse(ctx context.Context, bucketID string, params *PostBucketsIDOwnersParams, body PostBucketsIDOwnersJSONRequestBody) (*PostBucketsIDOwnersResponse, error) { - rsp, err := c.PostBucketsIDOwners(ctx, bucketID, params, body) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParsePostBucketsIDOwnersResponse(rsp) -} -// DeleteBucketsIDOwnersIDWithResponse request returning *DeleteBucketsIDOwnersIDResponse -func (c *ClientWithResponses) DeleteBucketsIDOwnersIDWithResponse(ctx context.Context, bucketID string, userID string, params *DeleteBucketsIDOwnersIDParams) (*DeleteBucketsIDOwnersIDResponse, error) { - rsp, err := c.DeleteBucketsIDOwnersID(ctx, bucketID, userID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseDeleteBucketsIDOwnersIDResponse(rsp) -} -// GetChecksWithResponse request returning *GetChecksResponse -func (c *ClientWithResponses) GetChecksWithResponse(ctx context.Context, params *GetChecksParams) (*GetChecksResponse, error) { - rsp, err := c.GetChecks(ctx, params) + operationPath := fmt.Sprintf("./orgs/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetChecksResponse(rsp) -} -// CreateCheckWithBodyWithResponse request with arbitrary body returning *CreateCheckResponse -func (c *ClientWithResponses) CreateCheckWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateCheckResponse, error) { - rsp, err := c.CreateCheckWithBody(ctx, contentType, body) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseCreateCheckResponse(rsp) -} -func (c *ClientWithResponses) CreateCheckWithResponse(ctx context.Context, body CreateCheckJSONRequestBody) (*CreateCheckResponse, error) { - rsp, err := c.CreateCheck(ctx, body) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseCreateCheckResponse(rsp) -} -// DeleteChecksIDWithResponse request returning *DeleteChecksIDResponse -func (c *ClientWithResponses) DeleteChecksIDWithResponse(ctx context.Context, checkID string, params *DeleteChecksIDParams) (*DeleteChecksIDResponse, error) { - rsp, err := c.DeleteChecksID(ctx, checkID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteChecksIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetChecksIDWithResponse request returning *GetChecksIDResponse -func (c *ClientWithResponses) GetChecksIDWithResponse(ctx context.Context, checkID string, params *GetChecksIDParams) (*GetChecksIDResponse, error) { - rsp, err := c.GetChecksID(ctx, checkID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetChecksIDResponse(rsp) -} -// PatchChecksIDWithBodyWithResponse request with arbitrary body returning *PatchChecksIDResponse -func (c *ClientWithResponses) PatchChecksIDWithBodyWithResponse(ctx context.Context, checkID string, params *PatchChecksIDParams, contentType string, body io.Reader) (*PatchChecksIDResponse, error) { - rsp, err := c.PatchChecksIDWithBody(ctx, checkID, params, contentType, body) - if err != nil { - return nil, err + response := &Organization{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePatchChecksIDResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PatchChecksIDWithResponse(ctx context.Context, checkID string, params *PatchChecksIDParams, body PatchChecksIDJSONRequestBody) (*PatchChecksIDResponse, error) { - rsp, err := c.PatchChecksID(ctx, checkID, params, body) +// GetOrgsIDMembers calls the GET on /orgs/{orgID}/members +// List all members of an organization +func (c *Client) GetOrgsIDMembers(ctx context.Context, params *GetOrgsIDMembersAllParams) (*ResourceMembers, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParsePatchChecksIDResponse(rsp) -} -// PutChecksIDWithBodyWithResponse request with arbitrary body returning *PutChecksIDResponse -func (c *ClientWithResponses) PutChecksIDWithBodyWithResponse(ctx context.Context, checkID string, params *PutChecksIDParams, contentType string, body io.Reader) (*PutChecksIDResponse, error) { - rsp, err := c.PutChecksIDWithBody(ctx, checkID, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePutChecksIDResponse(rsp) -} -func (c *ClientWithResponses) PutChecksIDWithResponse(ctx context.Context, checkID string, params *PutChecksIDParams, body PutChecksIDJSONRequestBody) (*PutChecksIDResponse, error) { - rsp, err := c.PutChecksID(ctx, checkID, params, body) + operationPath := fmt.Sprintf("./orgs/%s/members", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePutChecksIDResponse(rsp) -} -// GetChecksIDLabelsWithResponse request returning *GetChecksIDLabelsResponse -func (c *ClientWithResponses) GetChecksIDLabelsWithResponse(ctx context.Context, checkID string, params *GetChecksIDLabelsParams) (*GetChecksIDLabelsResponse, error) { - rsp, err := c.GetChecksIDLabels(ctx, checkID, params) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseGetChecksIDLabelsResponse(rsp) -} -// PostChecksIDLabelsWithBodyWithResponse request with arbitrary body returning *PostChecksIDLabelsResponse -func (c *ClientWithResponses) PostChecksIDLabelsWithBodyWithResponse(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, contentType string, body io.Reader) (*PostChecksIDLabelsResponse, error) { - rsp, err := c.PostChecksIDLabelsWithBody(ctx, checkID, params, contentType, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostChecksIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostChecksIDLabelsWithResponse(ctx context.Context, checkID string, params *PostChecksIDLabelsParams, body PostChecksIDLabelsJSONRequestBody) (*PostChecksIDLabelsResponse, error) { - rsp, err := c.PostChecksIDLabels(ctx, checkID, params, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostChecksIDLabelsResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// DeleteChecksIDLabelsIDWithResponse request returning *DeleteChecksIDLabelsIDResponse -func (c *ClientWithResponses) DeleteChecksIDLabelsIDWithResponse(ctx context.Context, checkID string, labelID string, params *DeleteChecksIDLabelsIDParams) (*DeleteChecksIDLabelsIDResponse, error) { - rsp, err := c.DeleteChecksIDLabelsID(ctx, checkID, labelID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseDeleteChecksIDLabelsIDResponse(rsp) -} -// GetChecksIDQueryWithResponse request returning *GetChecksIDQueryResponse -func (c *ClientWithResponses) GetChecksIDQueryWithResponse(ctx context.Context, checkID string, params *GetChecksIDQueryParams) (*GetChecksIDQueryResponse, error) { - rsp, err := c.GetChecksIDQuery(ctx, checkID, params) - if err != nil { - return nil, err + response := &ResourceMembers{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseGetChecksIDQueryResponse(rsp) + return response, nil + } -// GetConfigWithResponse request returning *GetConfigResponse -func (c *ClientWithResponses) GetConfigWithResponse(ctx context.Context, params *GetConfigParams) (*GetConfigResponse, error) { - rsp, err := c.GetConfig(ctx, params) +// PostOrgsIDMembers calls the POST on /orgs/{orgID}/members +// Add a member to an organization +func (c *Client) PostOrgsIDMembers(ctx context.Context, params *PostOrgsIDMembersAllParams) (*ResourceMember, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseGetConfigResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -// GetDashboardsWithResponse request returning *GetDashboardsResponse -func (c *ClientWithResponses) GetDashboardsWithResponse(ctx context.Context, params *GetDashboardsParams) (*GetDashboardsResponse, error) { - rsp, err := c.GetDashboards(ctx, params) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParseGetDashboardsResponse(rsp) -} -// PostDashboardsWithBodyWithResponse request with arbitrary body returning *PostDashboardsResponse -func (c *ClientWithResponses) PostDashboardsWithBodyWithResponse(ctx context.Context, params *PostDashboardsParams, contentType string, body io.Reader) (*PostDashboardsResponse, error) { - rsp, err := c.PostDashboardsWithBody(ctx, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostDashboardsResponse(rsp) -} -func (c *ClientWithResponses) PostDashboardsWithResponse(ctx context.Context, params *PostDashboardsParams, body PostDashboardsJSONRequestBody) (*PostDashboardsResponse, error) { - rsp, err := c.PostDashboards(ctx, params, body) + operationPath := fmt.Sprintf("./orgs/%s/members", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostDashboardsResponse(rsp) -} -// DeleteDashboardsIDWithResponse request returning *DeleteDashboardsIDResponse -func (c *ClientWithResponses) DeleteDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *DeleteDashboardsIDParams) (*DeleteDashboardsIDResponse, error) { - rsp, err := c.DeleteDashboardsID(ctx, dashboardID, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseDeleteDashboardsIDResponse(rsp) -} -// GetDashboardsIDWithResponse request returning *GetDashboardsIDResponse -func (c *ClientWithResponses) GetDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDParams) (*GetDashboardsIDResponse, error) { - rsp, err := c.GetDashboardsID(ctx, dashboardID, params) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetDashboardsIDResponse(rsp) -} -// PatchDashboardsIDWithBodyWithResponse request with arbitrary body returning *PatchDashboardsIDResponse -func (c *ClientWithResponses) PatchDashboardsIDWithBodyWithResponse(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, contentType string, body io.Reader) (*PatchDashboardsIDResponse, error) { - rsp, err := c.PatchDashboardsIDWithBody(ctx, dashboardID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePatchDashboardsIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PatchDashboardsIDWithResponse(ctx context.Context, dashboardID string, params *PatchDashboardsIDParams, body PatchDashboardsIDJSONRequestBody) (*PatchDashboardsIDResponse, error) { - rsp, err := c.PatchDashboardsID(ctx, dashboardID, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePatchDashboardsIDResponse(rsp) -} -// PostDashboardsIDCellsWithBodyWithResponse request with arbitrary body returning *PostDashboardsIDCellsResponse -func (c *ClientWithResponses) PostDashboardsIDCellsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, contentType string, body io.Reader) (*PostDashboardsIDCellsResponse, error) { - rsp, err := c.PostDashboardsIDCellsWithBody(ctx, dashboardID, params, contentType, body) - if err != nil { - return nil, err + response := &ResourceMember{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostDashboardsIDCellsResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PostDashboardsIDCellsWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDCellsParams, body PostDashboardsIDCellsJSONRequestBody) (*PostDashboardsIDCellsResponse, error) { - rsp, err := c.PostDashboardsIDCells(ctx, dashboardID, params, body) +// DeleteOrgsIDMembersID calls the DELETE on /orgs/{orgID}/members/{userID} +// Remove a member from an organization +func (c *Client) DeleteOrgsIDMembersID(ctx context.Context, params *DeleteOrgsIDMembersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParsePostDashboardsIDCellsResponse(rsp) -} -// PutDashboardsIDCellsWithBodyWithResponse request with arbitrary body returning *PutDashboardsIDCellsResponse -func (c *ClientWithResponses) PutDashboardsIDCellsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, contentType string, body io.Reader) (*PutDashboardsIDCellsResponse, error) { - rsp, err := c.PutDashboardsIDCellsWithBody(ctx, dashboardID, params, contentType, body) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { - return nil, err + return err } - return ParsePutDashboardsIDCellsResponse(rsp) -} -func (c *ClientWithResponses) PutDashboardsIDCellsWithResponse(ctx context.Context, dashboardID string, params *PutDashboardsIDCellsParams, body PutDashboardsIDCellsJSONRequestBody) (*PutDashboardsIDCellsResponse, error) { - rsp, err := c.PutDashboardsIDCells(ctx, dashboardID, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePutDashboardsIDCellsResponse(rsp) -} -// DeleteDashboardsIDCellsIDWithResponse request returning *DeleteDashboardsIDCellsIDResponse -func (c *ClientWithResponses) DeleteDashboardsIDCellsIDWithResponse(ctx context.Context, dashboardID string, cellID string, params *DeleteDashboardsIDCellsIDParams) (*DeleteDashboardsIDCellsIDResponse, error) { - rsp, err := c.DeleteDashboardsIDCellsID(ctx, dashboardID, cellID, params) + operationPath := fmt.Sprintf("./orgs/%s/members/%s", pathParam0, pathParam1) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseDeleteDashboardsIDCellsIDResponse(rsp) -} -// PatchDashboardsIDCellsIDWithBodyWithResponse request with arbitrary body returning *PatchDashboardsIDCellsIDResponse -func (c *ClientWithResponses) PatchDashboardsIDCellsIDWithBodyWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, contentType string, body io.Reader) (*PatchDashboardsIDCellsIDResponse, error) { - rsp, err := c.PatchDashboardsIDCellsIDWithBody(ctx, dashboardID, cellID, params, contentType, body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePatchDashboardsIDCellsIDResponse(rsp) -} -func (c *ClientWithResponses) PatchDashboardsIDCellsIDWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDParams, body PatchDashboardsIDCellsIDJSONRequestBody) (*PatchDashboardsIDCellsIDResponse, error) { - rsp, err := c.PatchDashboardsIDCellsID(ctx, dashboardID, cellID, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePatchDashboardsIDCellsIDResponse(rsp) -} -// GetDashboardsIDCellsIDViewWithResponse request returning *GetDashboardsIDCellsIDViewResponse -func (c *ClientWithResponses) GetDashboardsIDCellsIDViewWithResponse(ctx context.Context, dashboardID string, cellID string, params *GetDashboardsIDCellsIDViewParams) (*GetDashboardsIDCellsIDViewResponse, error) { - rsp, err := c.GetDashboardsIDCellsIDView(ctx, dashboardID, cellID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParseGetDashboardsIDCellsIDViewResponse(rsp) -} -// PatchDashboardsIDCellsIDViewWithBodyWithResponse request with arbitrary body returning *PatchDashboardsIDCellsIDViewResponse -func (c *ClientWithResponses) PatchDashboardsIDCellsIDViewWithBodyWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, contentType string, body io.Reader) (*PatchDashboardsIDCellsIDViewResponse, error) { - rsp, err := c.PatchDashboardsIDCellsIDViewWithBody(ctx, dashboardID, cellID, params, contentType, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePatchDashboardsIDCellsIDViewResponse(rsp) + return nil + } -func (c *ClientWithResponses) PatchDashboardsIDCellsIDViewWithResponse(ctx context.Context, dashboardID string, cellID string, params *PatchDashboardsIDCellsIDViewParams, body PatchDashboardsIDCellsIDViewJSONRequestBody) (*PatchDashboardsIDCellsIDViewResponse, error) { - rsp, err := c.PatchDashboardsIDCellsIDView(ctx, dashboardID, cellID, params, body) +// GetOrgsIDOwners calls the GET on /orgs/{orgID}/owners +// List all owners of an organization +func (c *Client) GetOrgsIDOwners(ctx context.Context, params *GetOrgsIDOwnersAllParams) (*ResourceOwners, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParsePatchDashboardsIDCellsIDViewResponse(rsp) -} -// GetDashboardsIDLabelsWithResponse request returning *GetDashboardsIDLabelsResponse -func (c *ClientWithResponses) GetDashboardsIDLabelsWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDLabelsParams) (*GetDashboardsIDLabelsResponse, error) { - rsp, err := c.GetDashboardsIDLabels(ctx, dashboardID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetDashboardsIDLabelsResponse(rsp) -} -// PostDashboardsIDLabelsWithBodyWithResponse request with arbitrary body returning *PostDashboardsIDLabelsResponse -func (c *ClientWithResponses) PostDashboardsIDLabelsWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, contentType string, body io.Reader) (*PostDashboardsIDLabelsResponse, error) { - rsp, err := c.PostDashboardsIDLabelsWithBody(ctx, dashboardID, params, contentType, body) + operationPath := fmt.Sprintf("./orgs/%s/owners", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostDashboardsIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostDashboardsIDLabelsWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDLabelsParams, body PostDashboardsIDLabelsJSONRequestBody) (*PostDashboardsIDLabelsResponse, error) { - rsp, err := c.PostDashboardsIDLabels(ctx, dashboardID, params, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostDashboardsIDLabelsResponse(rsp) -} -// DeleteDashboardsIDLabelsIDWithResponse request returning *DeleteDashboardsIDLabelsIDResponse -func (c *ClientWithResponses) DeleteDashboardsIDLabelsIDWithResponse(ctx context.Context, dashboardID string, labelID string, params *DeleteDashboardsIDLabelsIDParams) (*DeleteDashboardsIDLabelsIDResponse, error) { - rsp, err := c.DeleteDashboardsIDLabelsID(ctx, dashboardID, labelID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseDeleteDashboardsIDLabelsIDResponse(rsp) -} -// GetDashboardsIDMembersWithResponse request returning *GetDashboardsIDMembersResponse -func (c *ClientWithResponses) GetDashboardsIDMembersWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDMembersParams) (*GetDashboardsIDMembersResponse, error) { - rsp, err := c.GetDashboardsIDMembers(ctx, dashboardID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseGetDashboardsIDMembersResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// PostDashboardsIDMembersWithBodyWithResponse request with arbitrary body returning *PostDashboardsIDMembersResponse -func (c *ClientWithResponses) PostDashboardsIDMembersWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, contentType string, body io.Reader) (*PostDashboardsIDMembersResponse, error) { - rsp, err := c.PostDashboardsIDMembersWithBody(ctx, dashboardID, params, contentType, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostDashboardsIDMembersResponse(rsp) -} -func (c *ClientWithResponses) PostDashboardsIDMembersWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDMembersParams, body PostDashboardsIDMembersJSONRequestBody) (*PostDashboardsIDMembersResponse, error) { - rsp, err := c.PostDashboardsIDMembers(ctx, dashboardID, params, body) - if err != nil { - return nil, err + response := &ResourceOwners{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostDashboardsIDMembersResponse(rsp) + return response, nil + } -// DeleteDashboardsIDMembersIDWithResponse request returning *DeleteDashboardsIDMembersIDResponse -func (c *ClientWithResponses) DeleteDashboardsIDMembersIDWithResponse(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDMembersIDParams) (*DeleteDashboardsIDMembersIDResponse, error) { - rsp, err := c.DeleteDashboardsIDMembersID(ctx, dashboardID, userID, params) +// PostOrgsIDOwners calls the POST on /orgs/{orgID}/owners +// Add an owner to an organization +func (c *Client) PostOrgsIDOwners(ctx context.Context, params *PostOrgsIDOwnersAllParams) (*ResourceOwner, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseDeleteDashboardsIDMembersIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -// GetDashboardsIDOwnersWithResponse request returning *GetDashboardsIDOwnersResponse -func (c *ClientWithResponses) GetDashboardsIDOwnersWithResponse(ctx context.Context, dashboardID string, params *GetDashboardsIDOwnersParams) (*GetDashboardsIDOwnersResponse, error) { - rsp, err := c.GetDashboardsIDOwners(ctx, dashboardID, params) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParseGetDashboardsIDOwnersResponse(rsp) -} -// PostDashboardsIDOwnersWithBodyWithResponse request with arbitrary body returning *PostDashboardsIDOwnersResponse -func (c *ClientWithResponses) PostDashboardsIDOwnersWithBodyWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, contentType string, body io.Reader) (*PostDashboardsIDOwnersResponse, error) { - rsp, err := c.PostDashboardsIDOwnersWithBody(ctx, dashboardID, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostDashboardsIDOwnersResponse(rsp) -} -func (c *ClientWithResponses) PostDashboardsIDOwnersWithResponse(ctx context.Context, dashboardID string, params *PostDashboardsIDOwnersParams, body PostDashboardsIDOwnersJSONRequestBody) (*PostDashboardsIDOwnersResponse, error) { - rsp, err := c.PostDashboardsIDOwners(ctx, dashboardID, params, body) + operationPath := fmt.Sprintf("./orgs/%s/owners", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostDashboardsIDOwnersResponse(rsp) -} -// DeleteDashboardsIDOwnersIDWithResponse request returning *DeleteDashboardsIDOwnersIDResponse -func (c *ClientWithResponses) DeleteDashboardsIDOwnersIDWithResponse(ctx context.Context, dashboardID string, userID string, params *DeleteDashboardsIDOwnersIDParams) (*DeleteDashboardsIDOwnersIDResponse, error) { - rsp, err := c.DeleteDashboardsIDOwnersID(ctx, dashboardID, userID, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseDeleteDashboardsIDOwnersIDResponse(rsp) -} -// GetDBRPsWithResponse request returning *GetDBRPsResponse -func (c *ClientWithResponses) GetDBRPsWithResponse(ctx context.Context, params *GetDBRPsParams) (*GetDBRPsResponse, error) { - rsp, err := c.GetDBRPs(ctx, params) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetDBRPsResponse(rsp) -} -// PostDBRPWithBodyWithResponse request with arbitrary body returning *PostDBRPResponse -func (c *ClientWithResponses) PostDBRPWithBodyWithResponse(ctx context.Context, params *PostDBRPParams, contentType string, body io.Reader) (*PostDBRPResponse, error) { - rsp, err := c.PostDBRPWithBody(ctx, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostDBRPResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PostDBRPWithResponse(ctx context.Context, params *PostDBRPParams, body PostDBRPJSONRequestBody) (*PostDBRPResponse, error) { - rsp, err := c.PostDBRP(ctx, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostDBRPResponse(rsp) -} -// DeleteDBRPIDWithResponse request returning *DeleteDBRPIDResponse -func (c *ClientWithResponses) DeleteDBRPIDWithResponse(ctx context.Context, dbrpID string, params *DeleteDBRPIDParams) (*DeleteDBRPIDResponse, error) { - rsp, err := c.DeleteDBRPID(ctx, dbrpID, params) - if err != nil { - return nil, err + response := &ResourceOwner{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseDeleteDBRPIDResponse(rsp) + return response, nil + } -// GetDBRPsIDWithResponse request returning *GetDBRPsIDResponse -func (c *ClientWithResponses) GetDBRPsIDWithResponse(ctx context.Context, dbrpID string, params *GetDBRPsIDParams) (*GetDBRPsIDResponse, error) { - rsp, err := c.GetDBRPsID(ctx, dbrpID, params) +// DeleteOrgsIDOwnersID calls the DELETE on /orgs/{orgID}/owners/{userID} +// Remove an owner from an organization +func (c *Client) DeleteOrgsIDOwnersID(ctx context.Context, params *DeleteOrgsIDOwnersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParseGetDBRPsIDResponse(rsp) -} -// PatchDBRPIDWithBodyWithResponse request with arbitrary body returning *PatchDBRPIDResponse -func (c *ClientWithResponses) PatchDBRPIDWithBodyWithResponse(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, contentType string, body io.Reader) (*PatchDBRPIDResponse, error) { - rsp, err := c.PatchDBRPIDWithBody(ctx, dbrpID, params, contentType, body) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { - return nil, err + return err } - return ParsePatchDBRPIDResponse(rsp) -} -func (c *ClientWithResponses) PatchDBRPIDWithResponse(ctx context.Context, dbrpID string, params *PatchDBRPIDParams, body PatchDBRPIDJSONRequestBody) (*PatchDBRPIDResponse, error) { - rsp, err := c.PatchDBRPID(ctx, dbrpID, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePatchDBRPIDResponse(rsp) -} -// PostDeleteWithBodyWithResponse request with arbitrary body returning *PostDeleteResponse -func (c *ClientWithResponses) PostDeleteWithBodyWithResponse(ctx context.Context, params *PostDeleteParams, contentType string, body io.Reader) (*PostDeleteResponse, error) { - rsp, err := c.PostDeleteWithBody(ctx, params, contentType, body) + operationPath := fmt.Sprintf("./orgs/%s/owners/%s", pathParam0, pathParam1) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParsePostDeleteResponse(rsp) -} -func (c *ClientWithResponses) PostDeleteWithResponse(ctx context.Context, params *PostDeleteParams, body PostDeleteJSONRequestBody) (*PostDeleteResponse, error) { - rsp, err := c.PostDelete(ctx, params, body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePostDeleteResponse(rsp) -} -// GetFlagsWithResponse request returning *GetFlagsResponse -func (c *ClientWithResponses) GetFlagsWithResponse(ctx context.Context, params *GetFlagsParams) (*GetFlagsResponse, error) { - rsp, err := c.GetFlags(ctx, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetFlagsResponse(rsp) -} -// GetHealthWithResponse request returning *GetHealthResponse -func (c *ClientWithResponses) GetHealthWithResponse(ctx context.Context, params *GetHealthParams) (*GetHealthResponse, error) { - rsp, err := c.GetHealth(ctx, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParseGetHealthResponse(rsp) + return nil + } -// GetLabelsWithResponse request returning *GetLabelsResponse -func (c *ClientWithResponses) GetLabelsWithResponse(ctx context.Context, params *GetLabelsParams) (*GetLabelsResponse, error) { - rsp, err := c.GetLabels(ctx, params) +// GetOrgsIDSecrets calls the GET on /orgs/{orgID}/secrets +// List all secret keys for an organization +func (c *Client) GetOrgsIDSecrets(ctx context.Context, params *GetOrgsIDSecretsAllParams) (*SecretKeysResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { return nil, err } - return ParseGetLabelsResponse(rsp) -} -// PostLabelsWithBodyWithResponse request with arbitrary body returning *PostLabelsResponse -func (c *ClientWithResponses) PostLabelsWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*PostLabelsResponse, error) { - rsp, err := c.PostLabelsWithBody(ctx, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostLabelsWithResponse(ctx context.Context, body PostLabelsJSONRequestBody) (*PostLabelsResponse, error) { - rsp, err := c.PostLabels(ctx, body) + operationPath := fmt.Sprintf("./orgs/%s/secrets", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostLabelsResponse(rsp) -} -// DeleteLabelsIDWithResponse request returning *DeleteLabelsIDResponse -func (c *ClientWithResponses) DeleteLabelsIDWithResponse(ctx context.Context, labelID string, params *DeleteLabelsIDParams) (*DeleteLabelsIDResponse, error) { - rsp, err := c.DeleteLabelsID(ctx, labelID, params) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseDeleteLabelsIDResponse(rsp) -} -// GetLabelsIDWithResponse request returning *GetLabelsIDResponse -func (c *ClientWithResponses) GetLabelsIDWithResponse(ctx context.Context, labelID string, params *GetLabelsIDParams) (*GetLabelsIDResponse, error) { - rsp, err := c.GetLabelsID(ctx, labelID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetLabelsIDResponse(rsp) -} -// PatchLabelsIDWithBodyWithResponse request with arbitrary body returning *PatchLabelsIDResponse -func (c *ClientWithResponses) PatchLabelsIDWithBodyWithResponse(ctx context.Context, labelID string, params *PatchLabelsIDParams, contentType string, body io.Reader) (*PatchLabelsIDResponse, error) { - rsp, err := c.PatchLabelsIDWithBody(ctx, labelID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePatchLabelsIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PatchLabelsIDWithResponse(ctx context.Context, labelID string, params *PatchLabelsIDParams, body PatchLabelsIDJSONRequestBody) (*PatchLabelsIDResponse, error) { - rsp, err := c.PatchLabelsID(ctx, labelID, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePatchLabelsIDResponse(rsp) -} -// GetLegacyAuthorizationsWithResponse request returning *GetLegacyAuthorizationsResponse -func (c *ClientWithResponses) GetLegacyAuthorizationsWithResponse(ctx context.Context, params *GetLegacyAuthorizationsParams) (*GetLegacyAuthorizationsResponse, error) { - rsp, err := c.GetLegacyAuthorizations(ctx, params) - if err != nil { - return nil, err + response := &SecretKeysResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseGetLegacyAuthorizationsResponse(rsp) + return response, nil + } -// PostLegacyAuthorizationsWithBodyWithResponse request with arbitrary body returning *PostLegacyAuthorizationsResponse -func (c *ClientWithResponses) PostLegacyAuthorizationsWithBodyWithResponse(ctx context.Context, params *PostLegacyAuthorizationsParams, contentType string, body io.Reader) (*PostLegacyAuthorizationsResponse, error) { - rsp, err := c.PostLegacyAuthorizationsWithBody(ctx, params, contentType, body) +// PatchOrgsIDSecrets calls the PATCH on /orgs/{orgID}/secrets +// Update secrets in an organization +func (c *Client) PatchOrgsIDSecrets(ctx context.Context, params *PatchOrgsIDSecretsAllParams) error { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { - return nil, err + return err } - return ParsePostLegacyAuthorizationsResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -func (c *ClientWithResponses) PostLegacyAuthorizationsWithResponse(ctx context.Context, params *PostLegacyAuthorizationsParams, body PostLegacyAuthorizationsJSONRequestBody) (*PostLegacyAuthorizationsResponse, error) { - rsp, err := c.PostLegacyAuthorizations(ctx, params, body) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParsePostLegacyAuthorizationsResponse(rsp) -} -// DeleteLegacyAuthorizationsIDWithResponse request returning *DeleteLegacyAuthorizationsIDResponse -func (c *ClientWithResponses) DeleteLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *DeleteLegacyAuthorizationsIDParams) (*DeleteLegacyAuthorizationsIDResponse, error) { - rsp, err := c.DeleteLegacyAuthorizationsID(ctx, authID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParseDeleteLegacyAuthorizationsIDResponse(rsp) -} -// GetLegacyAuthorizationsIDWithResponse request returning *GetLegacyAuthorizationsIDResponse -func (c *ClientWithResponses) GetLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *GetLegacyAuthorizationsIDParams) (*GetLegacyAuthorizationsIDResponse, error) { - rsp, err := c.GetLegacyAuthorizationsID(ctx, authID, params) + operationPath := fmt.Sprintf("./orgs/%s/secrets", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetLegacyAuthorizationsIDResponse(rsp) -} -// PatchLegacyAuthorizationsIDWithBodyWithResponse request with arbitrary body returning *PatchLegacyAuthorizationsIDResponse -func (c *ClientWithResponses) PatchLegacyAuthorizationsIDWithBodyWithResponse(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, contentType string, body io.Reader) (*PatchLegacyAuthorizationsIDResponse, error) { - rsp, err := c.PatchLegacyAuthorizationsIDWithBody(ctx, authID, params, contentType, body) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { - return nil, err + return err } - return ParsePatchLegacyAuthorizationsIDResponse(rsp) -} -func (c *ClientWithResponses) PatchLegacyAuthorizationsIDWithResponse(ctx context.Context, authID string, params *PatchLegacyAuthorizationsIDParams, body PatchLegacyAuthorizationsIDJSONRequestBody) (*PatchLegacyAuthorizationsIDResponse, error) { - rsp, err := c.PatchLegacyAuthorizationsID(ctx, authID, params, body) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePatchLegacyAuthorizationsIDResponse(rsp) -} -// PostLegacyAuthorizationsIDPasswordWithBodyWithResponse request with arbitrary body returning *PostLegacyAuthorizationsIDPasswordResponse -func (c *ClientWithResponses) PostLegacyAuthorizationsIDPasswordWithBodyWithResponse(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, contentType string, body io.Reader) (*PostLegacyAuthorizationsIDPasswordResponse, error) { - rsp, err := c.PostLegacyAuthorizationsIDPasswordWithBody(ctx, authID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParsePostLegacyAuthorizationsIDPasswordResponse(rsp) -} -func (c *ClientWithResponses) PostLegacyAuthorizationsIDPasswordWithResponse(ctx context.Context, authID string, params *PostLegacyAuthorizationsIDPasswordParams, body PostLegacyAuthorizationsIDPasswordJSONRequestBody) (*PostLegacyAuthorizationsIDPasswordResponse, error) { - rsp, err := c.PostLegacyAuthorizationsIDPassword(ctx, authID, params, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePostLegacyAuthorizationsIDPasswordResponse(rsp) + return nil + } -// GetMeWithResponse request returning *GetMeResponse -func (c *ClientWithResponses) GetMeWithResponse(ctx context.Context, params *GetMeParams) (*GetMeResponse, error) { - rsp, err := c.GetMe(ctx, params) +// PostOrgsIDSecrets calls the POST on /orgs/{orgID}/secrets/delete +// Delete secrets from an organization +func (c *Client) PostOrgsIDSecrets(ctx context.Context, params *PostOrgsIDSecretsAllParams) error { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { - return nil, err + return err } - return ParseGetMeResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -// PutMePasswordWithBodyWithResponse request with arbitrary body returning *PutMePasswordResponse -func (c *ClientWithResponses) PutMePasswordWithBodyWithResponse(ctx context.Context, params *PutMePasswordParams, contentType string, body io.Reader) (*PutMePasswordResponse, error) { - rsp, err := c.PutMePasswordWithBody(ctx, params, contentType, body) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParsePutMePasswordResponse(rsp) -} -func (c *ClientWithResponses) PutMePasswordWithResponse(ctx context.Context, params *PutMePasswordParams, body PutMePasswordJSONRequestBody) (*PutMePasswordResponse, error) { - rsp, err := c.PutMePassword(ctx, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePutMePasswordResponse(rsp) -} -// GetMetricsWithResponse request returning *GetMetricsResponse -func (c *ClientWithResponses) GetMetricsWithResponse(ctx context.Context, params *GetMetricsParams) (*GetMetricsResponse, error) { - rsp, err := c.GetMetrics(ctx, params) + operationPath := fmt.Sprintf("./orgs/%s/secrets/delete", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetMetricsResponse(rsp) -} -// GetNotificationEndpointsWithResponse request returning *GetNotificationEndpointsResponse -func (c *ClientWithResponses) GetNotificationEndpointsWithResponse(ctx context.Context, params *GetNotificationEndpointsParams) (*GetNotificationEndpointsResponse, error) { - rsp, err := c.GetNotificationEndpoints(ctx, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { - return nil, err + return err } - return ParseGetNotificationEndpointsResponse(rsp) -} -// CreateNotificationEndpointWithBodyWithResponse request with arbitrary body returning *CreateNotificationEndpointResponse -func (c *ClientWithResponses) CreateNotificationEndpointWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateNotificationEndpointResponse, error) { - rsp, err := c.CreateNotificationEndpointWithBody(ctx, contentType, body) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseCreateNotificationEndpointResponse(rsp) -} -func (c *ClientWithResponses) CreateNotificationEndpointWithResponse(ctx context.Context, body CreateNotificationEndpointJSONRequestBody) (*CreateNotificationEndpointResponse, error) { - rsp, err := c.CreateNotificationEndpoint(ctx, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParseCreateNotificationEndpointResponse(rsp) -} -// DeleteNotificationEndpointsIDWithResponse request returning *DeleteNotificationEndpointsIDResponse -func (c *ClientWithResponses) DeleteNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *DeleteNotificationEndpointsIDParams) (*DeleteNotificationEndpointsIDResponse, error) { - rsp, err := c.DeleteNotificationEndpointsID(ctx, endpointID, params) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParseDeleteNotificationEndpointsIDResponse(rsp) + return nil + } -// GetNotificationEndpointsIDWithResponse request returning *GetNotificationEndpointsIDResponse -func (c *ClientWithResponses) GetNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDParams) (*GetNotificationEndpointsIDResponse, error) { - rsp, err := c.GetNotificationEndpointsID(ctx, endpointID, params) +// DeleteOrgsIDSecretsID calls the DELETE on /orgs/{orgID}/secrets/{secretID} +// Delete a secret from an organization +func (c *Client) DeleteOrgsIDSecretsID(ctx context.Context, params *DeleteOrgsIDSecretsIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "orgID", runtime.ParamLocationPath, params.OrgID) if err != nil { - return nil, err + return err } - return ParseGetNotificationEndpointsIDResponse(rsp) -} -// PatchNotificationEndpointsIDWithBodyWithResponse request with arbitrary body returning *PatchNotificationEndpointsIDResponse -func (c *ClientWithResponses) PatchNotificationEndpointsIDWithBodyWithResponse(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, contentType string, body io.Reader) (*PatchNotificationEndpointsIDResponse, error) { - rsp, err := c.PatchNotificationEndpointsIDWithBody(ctx, endpointID, params, contentType, body) + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "secretID", runtime.ParamLocationPath, params.SecretID) if err != nil { - return nil, err + return err } - return ParsePatchNotificationEndpointsIDResponse(rsp) -} -func (c *ClientWithResponses) PatchNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *PatchNotificationEndpointsIDParams, body PatchNotificationEndpointsIDJSONRequestBody) (*PatchNotificationEndpointsIDResponse, error) { - rsp, err := c.PatchNotificationEndpointsID(ctx, endpointID, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePatchNotificationEndpointsIDResponse(rsp) -} -// PutNotificationEndpointsIDWithBodyWithResponse request with arbitrary body returning *PutNotificationEndpointsIDResponse -func (c *ClientWithResponses) PutNotificationEndpointsIDWithBodyWithResponse(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, contentType string, body io.Reader) (*PutNotificationEndpointsIDResponse, error) { - rsp, err := c.PutNotificationEndpointsIDWithBody(ctx, endpointID, params, contentType, body) + operationPath := fmt.Sprintf("./orgs/%s/secrets/%s", pathParam0, pathParam1) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParsePutNotificationEndpointsIDResponse(rsp) -} -func (c *ClientWithResponses) PutNotificationEndpointsIDWithResponse(ctx context.Context, endpointID string, params *PutNotificationEndpointsIDParams, body PutNotificationEndpointsIDJSONRequestBody) (*PutNotificationEndpointsIDResponse, error) { - rsp, err := c.PutNotificationEndpointsID(ctx, endpointID, params, body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePutNotificationEndpointsIDResponse(rsp) -} -// GetNotificationEndpointsIDLabelsWithResponse request returning *GetNotificationEndpointsIDLabelsResponse -func (c *ClientWithResponses) GetNotificationEndpointsIDLabelsWithResponse(ctx context.Context, endpointID string, params *GetNotificationEndpointsIDLabelsParams) (*GetNotificationEndpointsIDLabelsResponse, error) { - rsp, err := c.GetNotificationEndpointsIDLabels(ctx, endpointID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetNotificationEndpointsIDLabelsResponse(rsp) -} -// PostNotificationEndpointIDLabelsWithBodyWithResponse request with arbitrary body returning *PostNotificationEndpointIDLabelsResponse -func (c *ClientWithResponses) PostNotificationEndpointIDLabelsWithBodyWithResponse(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, contentType string, body io.Reader) (*PostNotificationEndpointIDLabelsResponse, error) { - rsp, err := c.PostNotificationEndpointIDLabelsWithBody(ctx, endpointID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParsePostNotificationEndpointIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostNotificationEndpointIDLabelsWithResponse(ctx context.Context, endpointID string, params *PostNotificationEndpointIDLabelsParams, body PostNotificationEndpointIDLabelsJSONRequestBody) (*PostNotificationEndpointIDLabelsResponse, error) { - rsp, err := c.PostNotificationEndpointIDLabels(ctx, endpointID, params, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePostNotificationEndpointIDLabelsResponse(rsp) + return nil + } -// DeleteNotificationEndpointsIDLabelsIDWithResponse request returning *DeleteNotificationEndpointsIDLabelsIDResponse -func (c *ClientWithResponses) DeleteNotificationEndpointsIDLabelsIDWithResponse(ctx context.Context, endpointID string, labelID string, params *DeleteNotificationEndpointsIDLabelsIDParams) (*DeleteNotificationEndpointsIDLabelsIDResponse, error) { - rsp, err := c.DeleteNotificationEndpointsIDLabelsID(ctx, endpointID, labelID, params) +// GetPing calls the GET on /ping +// Get the status and version of the instance +func (c *Client) GetPing(ctx context.Context) error { + var err error + + serverURL, err := url.Parse(c.Server) if err != nil { - return nil, err + return err } - return ParseDeleteNotificationEndpointsIDLabelsIDResponse(rsp) -} -// GetNotificationRulesWithResponse request returning *GetNotificationRulesResponse -func (c *ClientWithResponses) GetNotificationRulesWithResponse(ctx context.Context, params *GetNotificationRulesParams) (*GetNotificationRulesResponse, error) { - rsp, err := c.GetNotificationRules(ctx, params) + operationPath := fmt.Sprintf("./ping") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetNotificationRulesResponse(rsp) -} -// CreateNotificationRuleWithBodyWithResponse request with arbitrary body returning *CreateNotificationRuleResponse -func (c *ClientWithResponses) CreateNotificationRuleWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateNotificationRuleResponse, error) { - rsp, err := c.CreateNotificationRuleWithBody(ctx, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParseCreateNotificationRuleResponse(rsp) -} -func (c *ClientWithResponses) CreateNotificationRuleWithResponse(ctx context.Context, body CreateNotificationRuleJSONRequestBody) (*CreateNotificationRuleResponse, error) { - rsp, err := c.CreateNotificationRule(ctx, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParseCreateNotificationRuleResponse(rsp) + return nil + } -// DeleteNotificationRulesIDWithResponse request returning *DeleteNotificationRulesIDResponse -func (c *ClientWithResponses) DeleteNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *DeleteNotificationRulesIDParams) (*DeleteNotificationRulesIDResponse, error) { - rsp, err := c.DeleteNotificationRulesID(ctx, ruleID, params) +// HeadPing calls the HEAD on /ping +// Get the status and version of the instance +func (c *Client) HeadPing(ctx context.Context) error { + var err error + + serverURL, err := url.Parse(c.Server) if err != nil { - return nil, err + return err } - return ParseDeleteNotificationRulesIDResponse(rsp) -} -// GetNotificationRulesIDWithResponse request returning *GetNotificationRulesIDResponse -func (c *ClientWithResponses) GetNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDParams) (*GetNotificationRulesIDResponse, error) { - rsp, err := c.GetNotificationRulesID(ctx, ruleID, params) + operationPath := fmt.Sprintf("./ping") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetNotificationRulesIDResponse(rsp) -} -// PatchNotificationRulesIDWithBodyWithResponse request with arbitrary body returning *PatchNotificationRulesIDResponse -func (c *ClientWithResponses) PatchNotificationRulesIDWithBodyWithResponse(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, contentType string, body io.Reader) (*PatchNotificationRulesIDResponse, error) { - rsp, err := c.PatchNotificationRulesIDWithBody(ctx, ruleID, params, contentType, body) + req, err := http.NewRequest("HEAD", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePatchNotificationRulesIDResponse(rsp) -} -func (c *ClientWithResponses) PatchNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *PatchNotificationRulesIDParams, body PatchNotificationRulesIDJSONRequestBody) (*PatchNotificationRulesIDResponse, error) { - rsp, err := c.PatchNotificationRulesID(ctx, ruleID, params, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePatchNotificationRulesIDResponse(rsp) + return nil + } -// PutNotificationRulesIDWithBodyWithResponse request with arbitrary body returning *PutNotificationRulesIDResponse -func (c *ClientWithResponses) PutNotificationRulesIDWithBodyWithResponse(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, contentType string, body io.Reader) (*PutNotificationRulesIDResponse, error) { - rsp, err := c.PutNotificationRulesIDWithBody(ctx, ruleID, params, contentType, body) +// PostQueryAnalyze calls the POST on /query/analyze +// Analyze a Flux query +func (c *Client) PostQueryAnalyze(ctx context.Context, params *PostQueryAnalyzeAllParams) (*AnalyzeQueryResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePutNotificationRulesIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -func (c *ClientWithResponses) PutNotificationRulesIDWithResponse(ctx context.Context, ruleID string, params *PutNotificationRulesIDParams, body PutNotificationRulesIDJSONRequestBody) (*PutNotificationRulesIDResponse, error) { - rsp, err := c.PutNotificationRulesID(ctx, ruleID, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePutNotificationRulesIDResponse(rsp) -} -// GetNotificationRulesIDLabelsWithResponse request returning *GetNotificationRulesIDLabelsResponse -func (c *ClientWithResponses) GetNotificationRulesIDLabelsWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDLabelsParams) (*GetNotificationRulesIDLabelsResponse, error) { - rsp, err := c.GetNotificationRulesIDLabels(ctx, ruleID, params) + operationPath := fmt.Sprintf("./query/analyze") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetNotificationRulesIDLabelsResponse(rsp) -} -// PostNotificationRuleIDLabelsWithBodyWithResponse request with arbitrary body returning *PostNotificationRuleIDLabelsResponse -func (c *ClientWithResponses) PostNotificationRuleIDLabelsWithBodyWithResponse(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, contentType string, body io.Reader) (*PostNotificationRuleIDLabelsResponse, error) { - rsp, err := c.PostNotificationRuleIDLabelsWithBody(ctx, ruleID, params, contentType, body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParsePostNotificationRuleIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostNotificationRuleIDLabelsWithResponse(ctx context.Context, ruleID string, params *PostNotificationRuleIDLabelsParams, body PostNotificationRuleIDLabelsJSONRequestBody) (*PostNotificationRuleIDLabelsResponse, error) { - rsp, err := c.PostNotificationRuleIDLabels(ctx, ruleID, params, body) + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + if params.ContentType != nil { + var headerParam1 string + + headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", headerParam1) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostNotificationRuleIDLabelsResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// DeleteNotificationRulesIDLabelsIDWithResponse request returning *DeleteNotificationRulesIDLabelsIDResponse -func (c *ClientWithResponses) DeleteNotificationRulesIDLabelsIDWithResponse(ctx context.Context, ruleID string, labelID string, params *DeleteNotificationRulesIDLabelsIDParams) (*DeleteNotificationRulesIDLabelsIDResponse, error) { - rsp, err := c.DeleteNotificationRulesIDLabelsID(ctx, ruleID, labelID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseDeleteNotificationRulesIDLabelsIDResponse(rsp) + + response := &AnalyzeQueryResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// GetNotificationRulesIDQueryWithResponse request returning *GetNotificationRulesIDQueryResponse -func (c *ClientWithResponses) GetNotificationRulesIDQueryWithResponse(ctx context.Context, ruleID string, params *GetNotificationRulesIDQueryParams) (*GetNotificationRulesIDQueryResponse, error) { - rsp, err := c.GetNotificationRulesIDQuery(ctx, ruleID, params) +// PostQueryAst calls the POST on /query/ast +// Generate a query Abstract Syntax Tree (AST) +func (c *Client) PostQueryAst(ctx context.Context, params *PostQueryAstAllParams) (*ASTResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseGetNotificationRulesIDQueryResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -// GetOrgsWithResponse request returning *GetOrgsResponse -func (c *ClientWithResponses) GetOrgsWithResponse(ctx context.Context, params *GetOrgsParams) (*GetOrgsResponse, error) { - rsp, err := c.GetOrgs(ctx, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetOrgsResponse(rsp) -} -// PostOrgsWithBodyWithResponse request with arbitrary body returning *PostOrgsResponse -func (c *ClientWithResponses) PostOrgsWithBodyWithResponse(ctx context.Context, params *PostOrgsParams, contentType string, body io.Reader) (*PostOrgsResponse, error) { - rsp, err := c.PostOrgsWithBody(ctx, params, contentType, body) + operationPath := fmt.Sprintf("./query/ast") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostOrgsResponse(rsp) -} -func (c *ClientWithResponses) PostOrgsWithResponse(ctx context.Context, params *PostOrgsParams, body PostOrgsJSONRequestBody) (*PostOrgsResponse, error) { - rsp, err := c.PostOrgs(ctx, params, body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParsePostOrgsResponse(rsp) -} -// DeleteOrgsIDWithResponse request returning *DeleteOrgsIDResponse -func (c *ClientWithResponses) DeleteOrgsIDWithResponse(ctx context.Context, orgID string, params *DeleteOrgsIDParams) (*DeleteOrgsIDResponse, error) { - rsp, err := c.DeleteOrgsID(ctx, orgID, params) + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + if params.ContentType != nil { + var headerParam1 string + + headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Content-Type", runtime.ParamLocationHeader, *params.ContentType) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", headerParam1) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteOrgsIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetOrgsIDWithResponse request returning *GetOrgsIDResponse -func (c *ClientWithResponses) GetOrgsIDWithResponse(ctx context.Context, orgID string, params *GetOrgsIDParams) (*GetOrgsIDResponse, error) { - rsp, err := c.GetOrgsID(ctx, orgID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetOrgsIDResponse(rsp) -} -// PatchOrgsIDWithBodyWithResponse request with arbitrary body returning *PatchOrgsIDResponse -func (c *ClientWithResponses) PatchOrgsIDWithBodyWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDParams, contentType string, body io.Reader) (*PatchOrgsIDResponse, error) { - rsp, err := c.PatchOrgsIDWithBody(ctx, orgID, params, contentType, body) - if err != nil { - return nil, err + response := &ASTResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePatchOrgsIDResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PatchOrgsIDWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDParams, body PatchOrgsIDJSONRequestBody) (*PatchOrgsIDResponse, error) { - rsp, err := c.PatchOrgsID(ctx, orgID, params, body) +// GetQuerySuggestions calls the GET on /query/suggestions +// Retrieve Flux query suggestions +func (c *Client) GetQuerySuggestions(ctx context.Context, params *GetQuerySuggestionsParams) (*FluxSuggestions, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePatchOrgsIDResponse(rsp) -} -// GetOrgsIDMembersWithResponse request returning *GetOrgsIDMembersResponse -func (c *ClientWithResponses) GetOrgsIDMembersWithResponse(ctx context.Context, orgID string, params *GetOrgsIDMembersParams) (*GetOrgsIDMembersResponse, error) { - rsp, err := c.GetOrgsIDMembers(ctx, orgID, params) + operationPath := fmt.Sprintf("./query/suggestions") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetOrgsIDMembersResponse(rsp) -} -// PostOrgsIDMembersWithBodyWithResponse request with arbitrary body returning *PostOrgsIDMembersResponse -func (c *ClientWithResponses) PostOrgsIDMembersWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, contentType string, body io.Reader) (*PostOrgsIDMembersResponse, error) { - rsp, err := c.PostOrgsIDMembersWithBody(ctx, orgID, params, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostOrgsIDMembersResponse(rsp) -} -func (c *ClientWithResponses) PostOrgsIDMembersWithResponse(ctx context.Context, orgID string, params *PostOrgsIDMembersParams, body PostOrgsIDMembersJSONRequestBody) (*PostOrgsIDMembersResponse, error) { - rsp, err := c.PostOrgsIDMembers(ctx, orgID, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostOrgsIDMembersResponse(rsp) -} -// DeleteOrgsIDMembersIDWithResponse request returning *DeleteOrgsIDMembersIDResponse -func (c *ClientWithResponses) DeleteOrgsIDMembersIDWithResponse(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDMembersIDParams) (*DeleteOrgsIDMembersIDResponse, error) { - rsp, err := c.DeleteOrgsIDMembersID(ctx, orgID, userID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteOrgsIDMembersIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetOrgsIDOwnersWithResponse request returning *GetOrgsIDOwnersResponse -func (c *ClientWithResponses) GetOrgsIDOwnersWithResponse(ctx context.Context, orgID string, params *GetOrgsIDOwnersParams) (*GetOrgsIDOwnersResponse, error) { - rsp, err := c.GetOrgsIDOwners(ctx, orgID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetOrgsIDOwnersResponse(rsp) -} -// PostOrgsIDOwnersWithBodyWithResponse request with arbitrary body returning *PostOrgsIDOwnersResponse -func (c *ClientWithResponses) PostOrgsIDOwnersWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, contentType string, body io.Reader) (*PostOrgsIDOwnersResponse, error) { - rsp, err := c.PostOrgsIDOwnersWithBody(ctx, orgID, params, contentType, body) - if err != nil { - return nil, err + response := &FluxSuggestions{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostOrgsIDOwnersResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PostOrgsIDOwnersWithResponse(ctx context.Context, orgID string, params *PostOrgsIDOwnersParams, body PostOrgsIDOwnersJSONRequestBody) (*PostOrgsIDOwnersResponse, error) { - rsp, err := c.PostOrgsIDOwners(ctx, orgID, params, body) +// GetQuerySuggestionsName calls the GET on /query/suggestions/{name} +// Retrieve a query suggestion for a branching suggestion +func (c *Client) GetQuerySuggestionsName(ctx context.Context, params *GetQuerySuggestionsNameAllParams) (*FluxSuggestion, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "name", runtime.ParamLocationPath, params.Name) if err != nil { return nil, err } - return ParsePostOrgsIDOwnersResponse(rsp) -} -// DeleteOrgsIDOwnersIDWithResponse request returning *DeleteOrgsIDOwnersIDResponse -func (c *ClientWithResponses) DeleteOrgsIDOwnersIDWithResponse(ctx context.Context, orgID string, userID string, params *DeleteOrgsIDOwnersIDParams) (*DeleteOrgsIDOwnersIDResponse, error) { - rsp, err := c.DeleteOrgsIDOwnersID(ctx, orgID, userID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseDeleteOrgsIDOwnersIDResponse(rsp) -} -// GetOrgsIDSecretsWithResponse request returning *GetOrgsIDSecretsResponse -func (c *ClientWithResponses) GetOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *GetOrgsIDSecretsParams) (*GetOrgsIDSecretsResponse, error) { - rsp, err := c.GetOrgsIDSecrets(ctx, orgID, params) + operationPath := fmt.Sprintf("./query/suggestions/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetOrgsIDSecretsResponse(rsp) -} -// PatchOrgsIDSecretsWithBodyWithResponse request with arbitrary body returning *PatchOrgsIDSecretsResponse -func (c *ClientWithResponses) PatchOrgsIDSecretsWithBodyWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, contentType string, body io.Reader) (*PatchOrgsIDSecretsResponse, error) { - rsp, err := c.PatchOrgsIDSecretsWithBody(ctx, orgID, params, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePatchOrgsIDSecretsResponse(rsp) -} -func (c *ClientWithResponses) PatchOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *PatchOrgsIDSecretsParams, body PatchOrgsIDSecretsJSONRequestBody) (*PatchOrgsIDSecretsResponse, error) { - rsp, err := c.PatchOrgsIDSecrets(ctx, orgID, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePatchOrgsIDSecretsResponse(rsp) -} -// PostOrgsIDSecretsWithBodyWithResponse request with arbitrary body returning *PostOrgsIDSecretsResponse -func (c *ClientWithResponses) PostOrgsIDSecretsWithBodyWithResponse(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, contentType string, body io.Reader) (*PostOrgsIDSecretsResponse, error) { - rsp, err := c.PostOrgsIDSecretsWithBody(ctx, orgID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostOrgsIDSecretsResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PostOrgsIDSecretsWithResponse(ctx context.Context, orgID string, params *PostOrgsIDSecretsParams, body PostOrgsIDSecretsJSONRequestBody) (*PostOrgsIDSecretsResponse, error) { - rsp, err := c.PostOrgsIDSecrets(ctx, orgID, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostOrgsIDSecretsResponse(rsp) -} -// DeleteOrgsIDSecretsIDWithResponse request returning *DeleteOrgsIDSecretsIDResponse -func (c *ClientWithResponses) DeleteOrgsIDSecretsIDWithResponse(ctx context.Context, orgID string, secretID string, params *DeleteOrgsIDSecretsIDParams) (*DeleteOrgsIDSecretsIDResponse, error) { - rsp, err := c.DeleteOrgsIDSecretsID(ctx, orgID, secretID, params) - if err != nil { - return nil, err + response := &FluxSuggestion{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseDeleteOrgsIDSecretsIDResponse(rsp) + return response, nil + } -// GetPingWithResponse request returning *GetPingResponse -func (c *ClientWithResponses) GetPingWithResponse(ctx context.Context) (*GetPingResponse, error) { - rsp, err := c.GetPing(ctx) +// GetReady calls the GET on /ready +// Get the readiness of an instance at startup +func (c *Client) GetReady(ctx context.Context, params *GetReadyParams) (*Ready, error) { + var err error + + serverURL, err := url.Parse(c.Server) if err != nil { return nil, err } - return ParseGetPingResponse(rsp) -} -// HeadPingWithResponse request returning *HeadPingResponse -func (c *ClientWithResponses) HeadPingWithResponse(ctx context.Context) (*HeadPingResponse, error) { - rsp, err := c.HeadPing(ctx) + operationPath := fmt.Sprintf("./ready") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseHeadPingResponse(rsp) -} -// PostQueryWithBodyWithResponse request with arbitrary body returning *PostQueryResponse -func (c *ClientWithResponses) PostQueryWithBodyWithResponse(ctx context.Context, params *PostQueryParams, contentType string, body io.Reader) (*PostQueryResponse, error) { - rsp, err := c.PostQueryWithBody(ctx, params, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostQueryResponse(rsp) -} -func (c *ClientWithResponses) PostQueryWithResponse(ctx context.Context, params *PostQueryParams, body PostQueryJSONRequestBody) (*PostQueryResponse, error) { - rsp, err := c.PostQuery(ctx, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostQueryResponse(rsp) -} -// PostQueryAnalyzeWithBodyWithResponse request with arbitrary body returning *PostQueryAnalyzeResponse -func (c *ClientWithResponses) PostQueryAnalyzeWithBodyWithResponse(ctx context.Context, params *PostQueryAnalyzeParams, contentType string, body io.Reader) (*PostQueryAnalyzeResponse, error) { - rsp, err := c.PostQueryAnalyzeWithBody(ctx, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostQueryAnalyzeResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PostQueryAnalyzeWithResponse(ctx context.Context, params *PostQueryAnalyzeParams, body PostQueryAnalyzeJSONRequestBody) (*PostQueryAnalyzeResponse, error) { - rsp, err := c.PostQueryAnalyze(ctx, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostQueryAnalyzeResponse(rsp) -} -// PostQueryAstWithBodyWithResponse request with arbitrary body returning *PostQueryAstResponse -func (c *ClientWithResponses) PostQueryAstWithBodyWithResponse(ctx context.Context, params *PostQueryAstParams, contentType string, body io.Reader) (*PostQueryAstResponse, error) { - rsp, err := c.PostQueryAstWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + response := &Ready{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostQueryAstResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PostQueryAstWithResponse(ctx context.Context, params *PostQueryAstParams, body PostQueryAstJSONRequestBody) (*PostQueryAstResponse, error) { - rsp, err := c.PostQueryAst(ctx, params, body) +// GetRemoteConnections calls the GET on /remotes +// List all remote connections +func (c *Client) GetRemoteConnections(ctx context.Context, params *GetRemoteConnectionsParams) (*RemoteConnections, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostQueryAstResponse(rsp) -} -// GetQuerySuggestionsWithResponse request returning *GetQuerySuggestionsResponse -func (c *ClientWithResponses) GetQuerySuggestionsWithResponse(ctx context.Context, params *GetQuerySuggestionsParams) (*GetQuerySuggestionsResponse, error) { - rsp, err := c.GetQuerySuggestions(ctx, params) + operationPath := fmt.Sprintf("./remotes") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetQuerySuggestionsResponse(rsp) -} -// GetQuerySuggestionsNameWithResponse request returning *GetQuerySuggestionsNameResponse -func (c *ClientWithResponses) GetQuerySuggestionsNameWithResponse(ctx context.Context, name string, params *GetQuerySuggestionsNameParams) (*GetQuerySuggestionsNameResponse, error) { - rsp, err := c.GetQuerySuggestionsName(ctx, name, params) - if err != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - return ParseGetQuerySuggestionsNameResponse(rsp) -} -// GetReadyWithResponse request returning *GetReadyResponse -func (c *ClientWithResponses) GetReadyWithResponse(ctx context.Context, params *GetReadyParams) (*GetReadyResponse, error) { - rsp, err := c.GetReady(ctx, params) - if err != nil { - return nil, err + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParseGetReadyResponse(rsp) -} -// GetRemoteConnectionsWithResponse request returning *GetRemoteConnectionsResponse -func (c *ClientWithResponses) GetRemoteConnectionsWithResponse(ctx context.Context, params *GetRemoteConnectionsParams) (*GetRemoteConnectionsResponse, error) { - rsp, err := c.GetRemoteConnections(ctx, params) - if err != nil { - return nil, err + if params.RemoteURL != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "remoteURL", runtime.ParamLocationQuery, *params.RemoteURL); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParseGetRemoteConnectionsResponse(rsp) -} -// PostRemoteConnectionWithBodyWithResponse request with arbitrary body returning *PostRemoteConnectionResponse -func (c *ClientWithResponses) PostRemoteConnectionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*PostRemoteConnectionResponse, error) { - rsp, err := c.PostRemoteConnectionWithBody(ctx, contentType, body) + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostRemoteConnectionResponse(rsp) -} -func (c *ClientWithResponses) PostRemoteConnectionWithResponse(ctx context.Context, body PostRemoteConnectionJSONRequestBody) (*PostRemoteConnectionResponse, error) { - rsp, err := c.PostRemoteConnection(ctx, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostRemoteConnectionResponse(rsp) -} -// DeleteRemoteConnectionByIDWithResponse request returning *DeleteRemoteConnectionByIDResponse -func (c *ClientWithResponses) DeleteRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *DeleteRemoteConnectionByIDParams) (*DeleteRemoteConnectionByIDResponse, error) { - rsp, err := c.DeleteRemoteConnectionByID(ctx, remoteID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteRemoteConnectionByIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetRemoteConnectionByIDWithResponse request returning *GetRemoteConnectionByIDResponse -func (c *ClientWithResponses) GetRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *GetRemoteConnectionByIDParams) (*GetRemoteConnectionByIDResponse, error) { - rsp, err := c.GetRemoteConnectionByID(ctx, remoteID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetRemoteConnectionByIDResponse(rsp) -} -// PatchRemoteConnectionByIDWithBodyWithResponse request with arbitrary body returning *PatchRemoteConnectionByIDResponse -func (c *ClientWithResponses) PatchRemoteConnectionByIDWithBodyWithResponse(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, contentType string, body io.Reader) (*PatchRemoteConnectionByIDResponse, error) { - rsp, err := c.PatchRemoteConnectionByIDWithBody(ctx, remoteID, params, contentType, body) - if err != nil { - return nil, err + response := &RemoteConnections{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePatchRemoteConnectionByIDResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PatchRemoteConnectionByIDWithResponse(ctx context.Context, remoteID string, params *PatchRemoteConnectionByIDParams, body PatchRemoteConnectionByIDJSONRequestBody) (*PatchRemoteConnectionByIDResponse, error) { - rsp, err := c.PatchRemoteConnectionByID(ctx, remoteID, params, body) +// PostRemoteConnection calls the POST on /remotes +// Register a new remote connection +func (c *Client) PostRemoteConnection(ctx context.Context, params *PostRemoteConnectionAllParams) (*RemoteConnection, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePatchRemoteConnectionByIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -// GetReplicationsWithResponse request returning *GetReplicationsResponse -func (c *ClientWithResponses) GetReplicationsWithResponse(ctx context.Context, params *GetReplicationsParams) (*GetReplicationsResponse, error) { - rsp, err := c.GetReplications(ctx, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetReplicationsResponse(rsp) -} -// PostReplicationWithBodyWithResponse request with arbitrary body returning *PostReplicationResponse -func (c *ClientWithResponses) PostReplicationWithBodyWithResponse(ctx context.Context, params *PostReplicationParams, contentType string, body io.Reader) (*PostReplicationResponse, error) { - rsp, err := c.PostReplicationWithBody(ctx, params, contentType, body) + operationPath := fmt.Sprintf("./remotes") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostReplicationResponse(rsp) -} -func (c *ClientWithResponses) PostReplicationWithResponse(ctx context.Context, params *PostReplicationParams, body PostReplicationJSONRequestBody) (*PostReplicationResponse, error) { - rsp, err := c.PostReplication(ctx, params, body) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParsePostReplicationResponse(rsp) -} -// DeleteReplicationByIDWithResponse request returning *DeleteReplicationByIDResponse -func (c *ClientWithResponses) DeleteReplicationByIDWithResponse(ctx context.Context, replicationID string, params *DeleteReplicationByIDParams) (*DeleteReplicationByIDResponse, error) { - rsp, err := c.DeleteReplicationByID(ctx, replicationID, params) + req.Header.Add("Content-Type", "application/json") + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteReplicationByIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetReplicationByIDWithResponse request returning *GetReplicationByIDResponse -func (c *ClientWithResponses) GetReplicationByIDWithResponse(ctx context.Context, replicationID string, params *GetReplicationByIDParams) (*GetReplicationByIDResponse, error) { - rsp, err := c.GetReplicationByID(ctx, replicationID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetReplicationByIDResponse(rsp) -} -// PatchReplicationByIDWithBodyWithResponse request with arbitrary body returning *PatchReplicationByIDResponse -func (c *ClientWithResponses) PatchReplicationByIDWithBodyWithResponse(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, contentType string, body io.Reader) (*PatchReplicationByIDResponse, error) { - rsp, err := c.PatchReplicationByIDWithBody(ctx, replicationID, params, contentType, body) - if err != nil { - return nil, err + response := &RemoteConnection{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePatchReplicationByIDResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PatchReplicationByIDWithResponse(ctx context.Context, replicationID string, params *PatchReplicationByIDParams, body PatchReplicationByIDJSONRequestBody) (*PatchReplicationByIDResponse, error) { - rsp, err := c.PatchReplicationByID(ctx, replicationID, params, body) +// DeleteRemoteConnectionByID calls the DELETE on /remotes/{remoteID} +// Delete a remote connection +func (c *Client) DeleteRemoteConnectionByID(ctx context.Context, params *DeleteRemoteConnectionByIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, params.RemoteID) if err != nil { - return nil, err + return err } - return ParsePatchReplicationByIDResponse(rsp) -} -// PostValidateReplicationByIDWithResponse request returning *PostValidateReplicationByIDResponse -func (c *ClientWithResponses) PostValidateReplicationByIDWithResponse(ctx context.Context, replicationID string, params *PostValidateReplicationByIDParams) (*PostValidateReplicationByIDResponse, error) { - rsp, err := c.PostValidateReplicationByID(ctx, replicationID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePostValidateReplicationByIDResponse(rsp) -} -// GetResourcesWithResponse request returning *GetResourcesResponse -func (c *ClientWithResponses) GetResourcesWithResponse(ctx context.Context, params *GetResourcesParams) (*GetResourcesResponse, error) { - rsp, err := c.GetResources(ctx, params) + operationPath := fmt.Sprintf("./remotes/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseGetResourcesResponse(rsp) -} -// PostRestoreBucketIDWithBodyWithResponse request with arbitrary body returning *PostRestoreBucketIDResponse -func (c *ClientWithResponses) PostRestoreBucketIDWithBodyWithResponse(ctx context.Context, bucketID string, params *PostRestoreBucketIDParams, contentType string, body io.Reader) (*PostRestoreBucketIDResponse, error) { - rsp, err := c.PostRestoreBucketIDWithBody(ctx, bucketID, params, contentType, body) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePostRestoreBucketIDResponse(rsp) -} -// PostRestoreBucketMetadataWithBodyWithResponse request with arbitrary body returning *PostRestoreBucketMetadataResponse -func (c *ClientWithResponses) PostRestoreBucketMetadataWithBodyWithResponse(ctx context.Context, params *PostRestoreBucketMetadataParams, contentType string, body io.Reader) (*PostRestoreBucketMetadataResponse, error) { - rsp, err := c.PostRestoreBucketMetadataWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostRestoreBucketMetadataResponse(rsp) -} -func (c *ClientWithResponses) PostRestoreBucketMetadataWithResponse(ctx context.Context, params *PostRestoreBucketMetadataParams, body PostRestoreBucketMetadataJSONRequestBody) (*PostRestoreBucketMetadataResponse, error) { - rsp, err := c.PostRestoreBucketMetadata(ctx, params, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParsePostRestoreBucketMetadataResponse(rsp) -} -// PostRestoreKVWithBodyWithResponse request with arbitrary body returning *PostRestoreKVResponse -func (c *ClientWithResponses) PostRestoreKVWithBodyWithResponse(ctx context.Context, params *PostRestoreKVParams, contentType string, body io.Reader) (*PostRestoreKVResponse, error) { - rsp, err := c.PostRestoreKVWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePostRestoreKVResponse(rsp) + return nil + } -// PostRestoreShardIdWithBodyWithResponse request with arbitrary body returning *PostRestoreShardIdResponse -func (c *ClientWithResponses) PostRestoreShardIdWithBodyWithResponse(ctx context.Context, shardID string, params *PostRestoreShardIdParams, contentType string, body io.Reader) (*PostRestoreShardIdResponse, error) { - rsp, err := c.PostRestoreShardIdWithBody(ctx, shardID, params, contentType, body) +// GetRemoteConnectionByID calls the GET on /remotes/{remoteID} +// Retrieve a remote connection +func (c *Client) GetRemoteConnectionByID(ctx context.Context, params *GetRemoteConnectionByIDAllParams) (*RemoteConnection, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, params.RemoteID) if err != nil { return nil, err } - return ParsePostRestoreShardIdResponse(rsp) -} -// PostRestoreSQLWithBodyWithResponse request with arbitrary body returning *PostRestoreSQLResponse -func (c *ClientWithResponses) PostRestoreSQLWithBodyWithResponse(ctx context.Context, params *PostRestoreSQLParams, contentType string, body io.Reader) (*PostRestoreSQLResponse, error) { - rsp, err := c.PostRestoreSQLWithBody(ctx, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostRestoreSQLResponse(rsp) -} -// GetScrapersWithResponse request returning *GetScrapersResponse -func (c *ClientWithResponses) GetScrapersWithResponse(ctx context.Context, params *GetScrapersParams) (*GetScrapersResponse, error) { - rsp, err := c.GetScrapers(ctx, params) + operationPath := fmt.Sprintf("./remotes/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetScrapersResponse(rsp) -} -// PostScrapersWithBodyWithResponse request with arbitrary body returning *PostScrapersResponse -func (c *ClientWithResponses) PostScrapersWithBodyWithResponse(ctx context.Context, params *PostScrapersParams, contentType string, body io.Reader) (*PostScrapersResponse, error) { - rsp, err := c.PostScrapersWithBody(ctx, params, contentType, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostScrapersResponse(rsp) -} -func (c *ClientWithResponses) PostScrapersWithResponse(ctx context.Context, params *PostScrapersParams, body PostScrapersJSONRequestBody) (*PostScrapersResponse, error) { - rsp, err := c.PostScrapers(ctx, params, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostScrapersResponse(rsp) -} -// DeleteScrapersIDWithResponse request returning *DeleteScrapersIDResponse -func (c *ClientWithResponses) DeleteScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *DeleteScrapersIDParams) (*DeleteScrapersIDResponse, error) { - rsp, err := c.DeleteScrapersID(ctx, scraperTargetID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteScrapersIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetScrapersIDWithResponse request returning *GetScrapersIDResponse -func (c *ClientWithResponses) GetScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDParams) (*GetScrapersIDResponse, error) { - rsp, err := c.GetScrapersID(ctx, scraperTargetID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetScrapersIDResponse(rsp) -} -// PatchScrapersIDWithBodyWithResponse request with arbitrary body returning *PatchScrapersIDResponse -func (c *ClientWithResponses) PatchScrapersIDWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, contentType string, body io.Reader) (*PatchScrapersIDResponse, error) { - rsp, err := c.PatchScrapersIDWithBody(ctx, scraperTargetID, params, contentType, body) - if err != nil { - return nil, err + response := &RemoteConnection{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePatchScrapersIDResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PatchScrapersIDWithResponse(ctx context.Context, scraperTargetID string, params *PatchScrapersIDParams, body PatchScrapersIDJSONRequestBody) (*PatchScrapersIDResponse, error) { - rsp, err := c.PatchScrapersID(ctx, scraperTargetID, params, body) +// PatchRemoteConnectionByID calls the PATCH on /remotes/{remoteID} +// Update a remote connection +func (c *Client) PatchRemoteConnectionByID(ctx context.Context, params *PatchRemoteConnectionByIDAllParams) (*RemoteConnection, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePatchScrapersIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -// GetScrapersIDLabelsWithResponse request returning *GetScrapersIDLabelsResponse -func (c *ClientWithResponses) GetScrapersIDLabelsWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDLabelsParams) (*GetScrapersIDLabelsResponse, error) { - rsp, err := c.GetScrapersIDLabels(ctx, scraperTargetID, params) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "remoteID", runtime.ParamLocationPath, params.RemoteID) if err != nil { return nil, err } - return ParseGetScrapersIDLabelsResponse(rsp) -} -// PostScrapersIDLabelsWithBodyWithResponse request with arbitrary body returning *PostScrapersIDLabelsResponse -func (c *ClientWithResponses) PostScrapersIDLabelsWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, contentType string, body io.Reader) (*PostScrapersIDLabelsResponse, error) { - rsp, err := c.PostScrapersIDLabelsWithBody(ctx, scraperTargetID, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostScrapersIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostScrapersIDLabelsWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDLabelsParams, body PostScrapersIDLabelsJSONRequestBody) (*PostScrapersIDLabelsResponse, error) { - rsp, err := c.PostScrapersIDLabels(ctx, scraperTargetID, params, body) + operationPath := fmt.Sprintf("./remotes/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostScrapersIDLabelsResponse(rsp) -} -// DeleteScrapersIDLabelsIDWithResponse request returning *DeleteScrapersIDLabelsIDResponse -func (c *ClientWithResponses) DeleteScrapersIDLabelsIDWithResponse(ctx context.Context, scraperTargetID string, labelID string, params *DeleteScrapersIDLabelsIDParams) (*DeleteScrapersIDLabelsIDResponse, error) { - rsp, err := c.DeleteScrapersIDLabelsID(ctx, scraperTargetID, labelID, params) + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseDeleteScrapersIDLabelsIDResponse(rsp) -} -// GetScrapersIDMembersWithResponse request returning *GetScrapersIDMembersResponse -func (c *ClientWithResponses) GetScrapersIDMembersWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDMembersParams) (*GetScrapersIDMembersResponse, error) { - rsp, err := c.GetScrapersIDMembers(ctx, scraperTargetID, params) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetScrapersIDMembersResponse(rsp) -} -// PostScrapersIDMembersWithBodyWithResponse request with arbitrary body returning *PostScrapersIDMembersResponse -func (c *ClientWithResponses) PostScrapersIDMembersWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, contentType string, body io.Reader) (*PostScrapersIDMembersResponse, error) { - rsp, err := c.PostScrapersIDMembersWithBody(ctx, scraperTargetID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostScrapersIDMembersResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PostScrapersIDMembersWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDMembersParams, body PostScrapersIDMembersJSONRequestBody) (*PostScrapersIDMembersResponse, error) { - rsp, err := c.PostScrapersIDMembers(ctx, scraperTargetID, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostScrapersIDMembersResponse(rsp) -} -// DeleteScrapersIDMembersIDWithResponse request returning *DeleteScrapersIDMembersIDResponse -func (c *ClientWithResponses) DeleteScrapersIDMembersIDWithResponse(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDMembersIDParams) (*DeleteScrapersIDMembersIDResponse, error) { - rsp, err := c.DeleteScrapersIDMembersID(ctx, scraperTargetID, userID, params) - if err != nil { - return nil, err + response := &RemoteConnection{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseDeleteScrapersIDMembersIDResponse(rsp) + return response, nil + } -// GetScrapersIDOwnersWithResponse request returning *GetScrapersIDOwnersResponse -func (c *ClientWithResponses) GetScrapersIDOwnersWithResponse(ctx context.Context, scraperTargetID string, params *GetScrapersIDOwnersParams) (*GetScrapersIDOwnersResponse, error) { - rsp, err := c.GetScrapersIDOwners(ctx, scraperTargetID, params) +// GetReplications calls the GET on /replications +// List all replications +func (c *Client) GetReplications(ctx context.Context, params *GetReplicationsParams) (*Replications, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetScrapersIDOwnersResponse(rsp) -} -// PostScrapersIDOwnersWithBodyWithResponse request with arbitrary body returning *PostScrapersIDOwnersResponse -func (c *ClientWithResponses) PostScrapersIDOwnersWithBodyWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, contentType string, body io.Reader) (*PostScrapersIDOwnersResponse, error) { - rsp, err := c.PostScrapersIDOwnersWithBody(ctx, scraperTargetID, params, contentType, body) + operationPath := fmt.Sprintf("./replications") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostScrapersIDOwnersResponse(rsp) -} -func (c *ClientWithResponses) PostScrapersIDOwnersWithResponse(ctx context.Context, scraperTargetID string, params *PostScrapersIDOwnersParams, body PostScrapersIDOwnersJSONRequestBody) (*PostScrapersIDOwnersResponse, error) { - rsp, err := c.PostScrapersIDOwners(ctx, scraperTargetID, params, body) - if err != nil { + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - return ParsePostScrapersIDOwnersResponse(rsp) -} -// DeleteScrapersIDOwnersIDWithResponse request returning *DeleteScrapersIDOwnersIDResponse -func (c *ClientWithResponses) DeleteScrapersIDOwnersIDWithResponse(ctx context.Context, scraperTargetID string, userID string, params *DeleteScrapersIDOwnersIDParams) (*DeleteScrapersIDOwnersIDResponse, error) { - rsp, err := c.DeleteScrapersIDOwnersID(ctx, scraperTargetID, userID, params) - if err != nil { - return nil, err + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParseDeleteScrapersIDOwnersIDResponse(rsp) -} -// GetSetupWithResponse request returning *GetSetupResponse -func (c *ClientWithResponses) GetSetupWithResponse(ctx context.Context, params *GetSetupParams) (*GetSetupResponse, error) { - rsp, err := c.GetSetup(ctx, params) - if err != nil { - return nil, err + if params.RemoteID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "remoteID", runtime.ParamLocationQuery, *params.RemoteID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParseGetSetupResponse(rsp) -} -// PostSetupWithBodyWithResponse request with arbitrary body returning *PostSetupResponse -func (c *ClientWithResponses) PostSetupWithBodyWithResponse(ctx context.Context, params *PostSetupParams, contentType string, body io.Reader) (*PostSetupResponse, error) { - rsp, err := c.PostSetupWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + if params.LocalBucketID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "localBucketID", runtime.ParamLocationQuery, *params.LocalBucketID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParsePostSetupResponse(rsp) -} -func (c *ClientWithResponses) PostSetupWithResponse(ctx context.Context, params *PostSetupParams, body PostSetupJSONRequestBody) (*PostSetupResponse, error) { - rsp, err := c.PostSetup(ctx, params, body) + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostSetupResponse(rsp) -} -// PostSigninWithResponse request returning *PostSigninResponse -func (c *ClientWithResponses) PostSigninWithResponse(ctx context.Context, params *PostSigninParams) (*PostSigninResponse, error) { - rsp, err := c.PostSignin(ctx, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostSigninResponse(rsp) -} -// PostSignoutWithResponse request returning *PostSignoutResponse -func (c *ClientWithResponses) PostSignoutWithResponse(ctx context.Context, params *PostSignoutParams) (*PostSignoutResponse, error) { - rsp, err := c.PostSignout(ctx, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostSignoutResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetSourcesWithResponse request returning *GetSourcesResponse -func (c *ClientWithResponses) GetSourcesWithResponse(ctx context.Context, params *GetSourcesParams) (*GetSourcesResponse, error) { - rsp, err := c.GetSources(ctx, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetSourcesResponse(rsp) -} -// PostSourcesWithBodyWithResponse request with arbitrary body returning *PostSourcesResponse -func (c *ClientWithResponses) PostSourcesWithBodyWithResponse(ctx context.Context, params *PostSourcesParams, contentType string, body io.Reader) (*PostSourcesResponse, error) { - rsp, err := c.PostSourcesWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + response := &Replications{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostSourcesResponse(rsp) + return response, nil + } -func (c *ClientWithResponses) PostSourcesWithResponse(ctx context.Context, params *PostSourcesParams, body PostSourcesJSONRequestBody) (*PostSourcesResponse, error) { - rsp, err := c.PostSources(ctx, params, body) +// PostReplication calls the POST on /replications +// Register a new replication +func (c *Client) PostReplication(ctx context.Context, params *PostReplicationAllParams) (*Replication, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePostSourcesResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -// DeleteSourcesIDWithResponse request returning *DeleteSourcesIDResponse -func (c *ClientWithResponses) DeleteSourcesIDWithResponse(ctx context.Context, sourceID string, params *DeleteSourcesIDParams) (*DeleteSourcesIDResponse, error) { - rsp, err := c.DeleteSourcesID(ctx, sourceID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseDeleteSourcesIDResponse(rsp) -} -// GetSourcesIDWithResponse request returning *GetSourcesIDResponse -func (c *ClientWithResponses) GetSourcesIDWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDParams) (*GetSourcesIDResponse, error) { - rsp, err := c.GetSourcesID(ctx, sourceID, params) + operationPath := fmt.Sprintf("./replications") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetSourcesIDResponse(rsp) -} -// PatchSourcesIDWithBodyWithResponse request with arbitrary body returning *PatchSourcesIDResponse -func (c *ClientWithResponses) PatchSourcesIDWithBodyWithResponse(ctx context.Context, sourceID string, params *PatchSourcesIDParams, contentType string, body io.Reader) (*PatchSourcesIDResponse, error) { - rsp, err := c.PatchSourcesIDWithBody(ctx, sourceID, params, contentType, body) - if err != nil { - return nil, err + queryValues := queryURL.Query() + + if params.Validate != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "validate", runtime.ParamLocationQuery, *params.Validate); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParsePatchSourcesIDResponse(rsp) -} -func (c *ClientWithResponses) PatchSourcesIDWithResponse(ctx context.Context, sourceID string, params *PatchSourcesIDParams, body PatchSourcesIDJSONRequestBody) (*PatchSourcesIDResponse, error) { - rsp, err := c.PatchSourcesID(ctx, sourceID, params, body) + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParsePatchSourcesIDResponse(rsp) -} -// GetSourcesIDBucketsWithResponse request returning *GetSourcesIDBucketsResponse -func (c *ClientWithResponses) GetSourcesIDBucketsWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDBucketsParams) (*GetSourcesIDBucketsResponse, error) { - rsp, err := c.GetSourcesIDBuckets(ctx, sourceID, params) + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseGetSourcesIDBucketsResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetSourcesIDHealthWithResponse request returning *GetSourcesIDHealthResponse -func (c *ClientWithResponses) GetSourcesIDHealthWithResponse(ctx context.Context, sourceID string, params *GetSourcesIDHealthParams) (*GetSourcesIDHealthResponse, error) { - rsp, err := c.GetSourcesIDHealth(ctx, sourceID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetSourcesIDHealthResponse(rsp) + + response := &Replication{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// ListStacksWithResponse request returning *ListStacksResponse -func (c *ClientWithResponses) ListStacksWithResponse(ctx context.Context, params *ListStacksParams) (*ListStacksResponse, error) { - rsp, err := c.ListStacks(ctx, params) +// DeleteReplicationByID calls the DELETE on /replications/{replicationID} +// Delete a replication +func (c *Client) DeleteReplicationByID(ctx context.Context, params *DeleteReplicationByIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, params.ReplicationID) if err != nil { - return nil, err + return err } - return ParseListStacksResponse(rsp) -} -// CreateStackWithBodyWithResponse request with arbitrary body returning *CreateStackResponse -func (c *ClientWithResponses) CreateStackWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*CreateStackResponse, error) { - rsp, err := c.CreateStackWithBody(ctx, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParseCreateStackResponse(rsp) -} -func (c *ClientWithResponses) CreateStackWithResponse(ctx context.Context, body CreateStackJSONRequestBody) (*CreateStackResponse, error) { - rsp, err := c.CreateStack(ctx, body) + operationPath := fmt.Sprintf("./replications/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseCreateStackResponse(rsp) -} -// DeleteStackWithResponse request returning *DeleteStackResponse -func (c *ClientWithResponses) DeleteStackWithResponse(ctx context.Context, stackId string, params *DeleteStackParams) (*DeleteStackResponse, error) { - rsp, err := c.DeleteStack(ctx, stackId, params) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err + } + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseDeleteStackResponse(rsp) -} -// ReadStackWithResponse request returning *ReadStackResponse -func (c *ClientWithResponses) ReadStackWithResponse(ctx context.Context, stackId string) (*ReadStackResponse, error) { - rsp, err := c.ReadStack(ctx, stackId) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParseReadStackResponse(rsp) + return nil + } -// UpdateStackWithBodyWithResponse request with arbitrary body returning *UpdateStackResponse -func (c *ClientWithResponses) UpdateStackWithBodyWithResponse(ctx context.Context, stackId string, contentType string, body io.Reader) (*UpdateStackResponse, error) { - rsp, err := c.UpdateStackWithBody(ctx, stackId, contentType, body) +// GetReplicationByID calls the GET on /replications/{replicationID} +// Retrieve a replication +func (c *Client) GetReplicationByID(ctx context.Context, params *GetReplicationByIDAllParams) (*Replication, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, params.ReplicationID) if err != nil { return nil, err } - return ParseUpdateStackResponse(rsp) -} -func (c *ClientWithResponses) UpdateStackWithResponse(ctx context.Context, stackId string, body UpdateStackJSONRequestBody) (*UpdateStackResponse, error) { - rsp, err := c.UpdateStack(ctx, stackId, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseUpdateStackResponse(rsp) -} -// UninstallStackWithResponse request returning *UninstallStackResponse -func (c *ClientWithResponses) UninstallStackWithResponse(ctx context.Context, stackId string) (*UninstallStackResponse, error) { - rsp, err := c.UninstallStack(ctx, stackId) + operationPath := fmt.Sprintf("./replications/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseUninstallStackResponse(rsp) -} -// GetTasksWithResponse request returning *GetTasksResponse -func (c *ClientWithResponses) GetTasksWithResponse(ctx context.Context, params *GetTasksParams) (*GetTasksResponse, error) { - rsp, err := c.GetTasks(ctx, params) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseGetTasksResponse(rsp) -} -// PostTasksWithBodyWithResponse request with arbitrary body returning *PostTasksResponse -func (c *ClientWithResponses) PostTasksWithBodyWithResponse(ctx context.Context, params *PostTasksParams, contentType string, body io.Reader) (*PostTasksResponse, error) { - rsp, err := c.PostTasksWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostTasksResponse(rsp) -} -func (c *ClientWithResponses) PostTasksWithResponse(ctx context.Context, params *PostTasksParams, body PostTasksJSONRequestBody) (*PostTasksResponse, error) { - rsp, err := c.PostTasks(ctx, params, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostTasksResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// DeleteTasksIDWithResponse request returning *DeleteTasksIDResponse -func (c *ClientWithResponses) DeleteTasksIDWithResponse(ctx context.Context, taskID string, params *DeleteTasksIDParams) (*DeleteTasksIDResponse, error) { - rsp, err := c.DeleteTasksID(ctx, taskID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseDeleteTasksIDResponse(rsp) -} -// GetTasksIDWithResponse request returning *GetTasksIDResponse -func (c *ClientWithResponses) GetTasksIDWithResponse(ctx context.Context, taskID string, params *GetTasksIDParams) (*GetTasksIDResponse, error) { - rsp, err := c.GetTasksID(ctx, taskID, params) - if err != nil { - return nil, err + response := &Replication{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParseGetTasksIDResponse(rsp) + return response, nil + } -// PatchTasksIDWithBodyWithResponse request with arbitrary body returning *PatchTasksIDResponse -func (c *ClientWithResponses) PatchTasksIDWithBodyWithResponse(ctx context.Context, taskID string, params *PatchTasksIDParams, contentType string, body io.Reader) (*PatchTasksIDResponse, error) { - rsp, err := c.PatchTasksIDWithBody(ctx, taskID, params, contentType, body) +// PatchReplicationByID calls the PATCH on /replications/{replicationID} +// Update a replication +func (c *Client) PatchReplicationByID(ctx context.Context, params *PatchReplicationByIDAllParams) (*Replication, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParsePatchTasksIDResponse(rsp) -} + bodyReader = bytes.NewReader(buf) + + var pathParam0 string -func (c *ClientWithResponses) PatchTasksIDWithResponse(ctx context.Context, taskID string, params *PatchTasksIDParams, body PatchTasksIDJSONRequestBody) (*PatchTasksIDResponse, error) { - rsp, err := c.PatchTasksID(ctx, taskID, params, body) + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, params.ReplicationID) if err != nil { return nil, err } - return ParsePatchTasksIDResponse(rsp) -} -// GetTasksIDLabelsWithResponse request returning *GetTasksIDLabelsResponse -func (c *ClientWithResponses) GetTasksIDLabelsWithResponse(ctx context.Context, taskID string, params *GetTasksIDLabelsParams) (*GetTasksIDLabelsResponse, error) { - rsp, err := c.GetTasksIDLabels(ctx, taskID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetTasksIDLabelsResponse(rsp) -} -// PostTasksIDLabelsWithBodyWithResponse request with arbitrary body returning *PostTasksIDLabelsResponse -func (c *ClientWithResponses) PostTasksIDLabelsWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, contentType string, body io.Reader) (*PostTasksIDLabelsResponse, error) { - rsp, err := c.PostTasksIDLabelsWithBody(ctx, taskID, params, contentType, body) + operationPath := fmt.Sprintf("./replications/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostTasksIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostTasksIDLabelsWithResponse(ctx context.Context, taskID string, params *PostTasksIDLabelsParams, body PostTasksIDLabelsJSONRequestBody) (*PostTasksIDLabelsResponse, error) { - rsp, err := c.PostTasksIDLabels(ctx, taskID, params, body) - if err != nil { - return nil, err + queryValues := queryURL.Query() + + if params.Validate != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "validate", runtime.ParamLocationQuery, *params.Validate); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParsePostTasksIDLabelsResponse(rsp) -} -// DeleteTasksIDLabelsIDWithResponse request returning *DeleteTasksIDLabelsIDResponse -func (c *ClientWithResponses) DeleteTasksIDLabelsIDWithResponse(ctx context.Context, taskID string, labelID string, params *DeleteTasksIDLabelsIDParams) (*DeleteTasksIDLabelsIDResponse, error) { - rsp, err := c.DeleteTasksIDLabelsID(ctx, taskID, labelID, params) + queryURL.RawQuery = queryValues.Encode() + + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseDeleteTasksIDLabelsIDResponse(rsp) -} -// GetTasksIDLogsWithResponse request returning *GetTasksIDLogsResponse -func (c *ClientWithResponses) GetTasksIDLogsWithResponse(ctx context.Context, taskID string, params *GetTasksIDLogsParams) (*GetTasksIDLogsResponse, error) { - rsp, err := c.GetTasksIDLogs(ctx, taskID, params) - if err != nil { - return nil, err + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetTasksIDLogsResponse(rsp) -} -// GetTasksIDMembersWithResponse request returning *GetTasksIDMembersResponse -func (c *ClientWithResponses) GetTasksIDMembersWithResponse(ctx context.Context, taskID string, params *GetTasksIDMembersParams) (*GetTasksIDMembersResponse, error) { - rsp, err := c.GetTasksIDMembers(ctx, taskID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseGetTasksIDMembersResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// PostTasksIDMembersWithBodyWithResponse request with arbitrary body returning *PostTasksIDMembersResponse -func (c *ClientWithResponses) PostTasksIDMembersWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDMembersParams, contentType string, body io.Reader) (*PostTasksIDMembersResponse, error) { - rsp, err := c.PostTasksIDMembersWithBody(ctx, taskID, params, contentType, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePostTasksIDMembersResponse(rsp) -} -func (c *ClientWithResponses) PostTasksIDMembersWithResponse(ctx context.Context, taskID string, params *PostTasksIDMembersParams, body PostTasksIDMembersJSONRequestBody) (*PostTasksIDMembersResponse, error) { - rsp, err := c.PostTasksIDMembers(ctx, taskID, params, body) - if err != nil { - return nil, err + response := &Replication{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostTasksIDMembersResponse(rsp) + return response, nil + } -// DeleteTasksIDMembersIDWithResponse request returning *DeleteTasksIDMembersIDResponse -func (c *ClientWithResponses) DeleteTasksIDMembersIDWithResponse(ctx context.Context, taskID string, userID string, params *DeleteTasksIDMembersIDParams) (*DeleteTasksIDMembersIDResponse, error) { - rsp, err := c.DeleteTasksIDMembersID(ctx, taskID, userID, params) +// PostValidateReplicationByID calls the POST on /replications/{replicationID}/validate +// Validate a replication +func (c *Client) PostValidateReplicationByID(ctx context.Context, params *PostValidateReplicationByIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "replicationID", runtime.ParamLocationPath, params.ReplicationID) if err != nil { - return nil, err + return err } - return ParseDeleteTasksIDMembersIDResponse(rsp) -} -// GetTasksIDOwnersWithResponse request returning *GetTasksIDOwnersResponse -func (c *ClientWithResponses) GetTasksIDOwnersWithResponse(ctx context.Context, taskID string, params *GetTasksIDOwnersParams) (*GetTasksIDOwnersResponse, error) { - rsp, err := c.GetTasksIDOwners(ctx, taskID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParseGetTasksIDOwnersResponse(rsp) -} -// PostTasksIDOwnersWithBodyWithResponse request with arbitrary body returning *PostTasksIDOwnersResponse -func (c *ClientWithResponses) PostTasksIDOwnersWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, contentType string, body io.Reader) (*PostTasksIDOwnersResponse, error) { - rsp, err := c.PostTasksIDOwnersWithBody(ctx, taskID, params, contentType, body) + operationPath := fmt.Sprintf("./replications/%s/validate", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParsePostTasksIDOwnersResponse(rsp) -} -func (c *ClientWithResponses) PostTasksIDOwnersWithResponse(ctx context.Context, taskID string, params *PostTasksIDOwnersParams, body PostTasksIDOwnersJSONRequestBody) (*PostTasksIDOwnersResponse, error) { - rsp, err := c.PostTasksIDOwners(ctx, taskID, params, body) + req, err := http.NewRequest("POST", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParsePostTasksIDOwnersResponse(rsp) -} -// DeleteTasksIDOwnersIDWithResponse request returning *DeleteTasksIDOwnersIDResponse -func (c *ClientWithResponses) DeleteTasksIDOwnersIDWithResponse(ctx context.Context, taskID string, userID string, params *DeleteTasksIDOwnersIDParams) (*DeleteTasksIDOwnersIDResponse, error) { - rsp, err := c.DeleteTasksIDOwnersID(ctx, taskID, userID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseDeleteTasksIDOwnersIDResponse(rsp) -} -// GetTasksIDRunsWithResponse request returning *GetTasksIDRunsResponse -func (c *ClientWithResponses) GetTasksIDRunsWithResponse(ctx context.Context, taskID string, params *GetTasksIDRunsParams) (*GetTasksIDRunsResponse, error) { - rsp, err := c.GetTasksIDRuns(ctx, taskID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParseGetTasksIDRunsResponse(rsp) -} -// PostTasksIDRunsWithBodyWithResponse request with arbitrary body returning *PostTasksIDRunsResponse -func (c *ClientWithResponses) PostTasksIDRunsWithBodyWithResponse(ctx context.Context, taskID string, params *PostTasksIDRunsParams, contentType string, body io.Reader) (*PostTasksIDRunsResponse, error) { - rsp, err := c.PostTasksIDRunsWithBody(ctx, taskID, params, contentType, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePostTasksIDRunsResponse(rsp) + return nil + } -func (c *ClientWithResponses) PostTasksIDRunsWithResponse(ctx context.Context, taskID string, params *PostTasksIDRunsParams, body PostTasksIDRunsJSONRequestBody) (*PostTasksIDRunsResponse, error) { - rsp, err := c.PostTasksIDRuns(ctx, taskID, params, body) +// GetResources calls the GET on /resources +// List all known resources +func (c *Client) GetResources(ctx context.Context, params *GetResourcesParams) (*[]string, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostTasksIDRunsResponse(rsp) -} -// DeleteTasksIDRunsIDWithResponse request returning *DeleteTasksIDRunsIDResponse -func (c *ClientWithResponses) DeleteTasksIDRunsIDWithResponse(ctx context.Context, taskID string, runID string, params *DeleteTasksIDRunsIDParams) (*DeleteTasksIDRunsIDResponse, error) { - rsp, err := c.DeleteTasksIDRunsID(ctx, taskID, runID, params) + operationPath := fmt.Sprintf("./resources") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseDeleteTasksIDRunsIDResponse(rsp) -} -// GetTasksIDRunsIDWithResponse request returning *GetTasksIDRunsIDResponse -func (c *ClientWithResponses) GetTasksIDRunsIDWithResponse(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDParams) (*GetTasksIDRunsIDResponse, error) { - rsp, err := c.GetTasksIDRunsID(ctx, taskID, runID, params) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseGetTasksIDRunsIDResponse(rsp) -} -// GetTasksIDRunsIDLogsWithResponse request returning *GetTasksIDRunsIDLogsResponse -func (c *ClientWithResponses) GetTasksIDRunsIDLogsWithResponse(ctx context.Context, taskID string, runID string, params *GetTasksIDRunsIDLogsParams) (*GetTasksIDRunsIDLogsResponse, error) { - rsp, err := c.GetTasksIDRunsIDLogs(ctx, taskID, runID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetTasksIDRunsIDLogsResponse(rsp) -} -// PostTasksIDRunsIDRetryWithBodyWithResponse request with arbitrary body returning *PostTasksIDRunsIDRetryResponse -func (c *ClientWithResponses) PostTasksIDRunsIDRetryWithBodyWithResponse(ctx context.Context, taskID string, runID string, params *PostTasksIDRunsIDRetryParams, contentType string, body io.Reader) (*PostTasksIDRunsIDRetryResponse, error) { - rsp, err := c.PostTasksIDRunsIDRetryWithBody(ctx, taskID, runID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostTasksIDRunsIDRetryResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetTelegrafPluginsWithResponse request returning *GetTelegrafPluginsResponse -func (c *ClientWithResponses) GetTelegrafPluginsWithResponse(ctx context.Context, params *GetTelegrafPluginsParams) (*GetTelegrafPluginsResponse, error) { - rsp, err := c.GetTelegrafPlugins(ctx, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetTelegrafPluginsResponse(rsp) + + response := &[]string{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -// GetTelegrafsWithResponse request returning *GetTelegrafsResponse -func (c *ClientWithResponses) GetTelegrafsWithResponse(ctx context.Context, params *GetTelegrafsParams) (*GetTelegrafsResponse, error) { - rsp, err := c.GetTelegrafs(ctx, params) +// PostRestoreBucketMetadata calls the POST on /restore/bucketMetadata +// Create a new bucket pre-seeded with shard info from a backup. +func (c *Client) PostRestoreBucketMetadata(ctx context.Context, params *PostRestoreBucketMetadataAllParams) (*RestoredBucketMappings, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseGetTelegrafsResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -// PostTelegrafsWithBodyWithResponse request with arbitrary body returning *PostTelegrafsResponse -func (c *ClientWithResponses) PostTelegrafsWithBodyWithResponse(ctx context.Context, params *PostTelegrafsParams, contentType string, body io.Reader) (*PostTelegrafsResponse, error) { - rsp, err := c.PostTelegrafsWithBody(ctx, params, contentType, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePostTelegrafsResponse(rsp) -} -func (c *ClientWithResponses) PostTelegrafsWithResponse(ctx context.Context, params *PostTelegrafsParams, body PostTelegrafsJSONRequestBody) (*PostTelegrafsResponse, error) { - rsp, err := c.PostTelegrafs(ctx, params, body) + operationPath := fmt.Sprintf("./restore/bucketMetadata") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostTelegrafsResponse(rsp) -} -// DeleteTelegrafsIDWithResponse request returning *DeleteTelegrafsIDResponse -func (c *ClientWithResponses) DeleteTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *DeleteTelegrafsIDParams) (*DeleteTelegrafsIDResponse, error) { - rsp, err := c.DeleteTelegrafsID(ctx, telegrafID, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseDeleteTelegrafsIDResponse(rsp) -} -// GetTelegrafsIDWithResponse request returning *GetTelegrafsIDResponse -func (c *ClientWithResponses) GetTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDParams) (*GetTelegrafsIDResponse, error) { - rsp, err := c.GetTelegrafsID(ctx, telegrafID, params) + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseGetTelegrafsIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// PutTelegrafsIDWithBodyWithResponse request with arbitrary body returning *PutTelegrafsIDResponse -func (c *ClientWithResponses) PutTelegrafsIDWithBodyWithResponse(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, contentType string, body io.Reader) (*PutTelegrafsIDResponse, error) { - rsp, err := c.PutTelegrafsIDWithBody(ctx, telegrafID, params, contentType, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePutTelegrafsIDResponse(rsp) + + response := &RestoredBucketMappings{} + + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) + } + return response, nil + } -func (c *ClientWithResponses) PutTelegrafsIDWithResponse(ctx context.Context, telegrafID string, params *PutTelegrafsIDParams, body PutTelegrafsIDJSONRequestBody) (*PutTelegrafsIDResponse, error) { - rsp, err := c.PutTelegrafsID(ctx, telegrafID, params, body) +// GetScrapers calls the GET on /scrapers +// List all scraper targets +func (c *Client) GetScrapers(ctx context.Context, params *GetScrapersParams) (*ScraperTargetResponses, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParsePutTelegrafsIDResponse(rsp) -} -// GetTelegrafsIDLabelsWithResponse request returning *GetTelegrafsIDLabelsResponse -func (c *ClientWithResponses) GetTelegrafsIDLabelsWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDLabelsParams) (*GetTelegrafsIDLabelsResponse, error) { - rsp, err := c.GetTelegrafsIDLabels(ctx, telegrafID, params) + operationPath := fmt.Sprintf("./scrapers") + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseGetTelegrafsIDLabelsResponse(rsp) -} -// PostTelegrafsIDLabelsWithBodyWithResponse request with arbitrary body returning *PostTelegrafsIDLabelsResponse -func (c *ClientWithResponses) PostTelegrafsIDLabelsWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, contentType string, body io.Reader) (*PostTelegrafsIDLabelsResponse, error) { - rsp, err := c.PostTelegrafsIDLabelsWithBody(ctx, telegrafID, params, contentType, body) - if err != nil { - return nil, err + queryValues := queryURL.Query() + + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Id != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.OrgID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Org != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + } - return ParsePostTelegrafsIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostTelegrafsIDLabelsWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDLabelsParams, body PostTelegrafsIDLabelsJSONRequestBody) (*PostTelegrafsIDLabelsResponse, error) { - rsp, err := c.PostTelegrafsIDLabels(ctx, telegrafID, params, body) - if err != nil { - return nil, err - } - return ParsePostTelegrafsIDLabelsResponse(rsp) -} + queryURL.RawQuery = queryValues.Encode() -// DeleteTelegrafsIDLabelsIDWithResponse request returning *DeleteTelegrafsIDLabelsIDResponse -func (c *ClientWithResponses) DeleteTelegrafsIDLabelsIDWithResponse(ctx context.Context, telegrafID string, labelID string, params *DeleteTelegrafsIDLabelsIDParams) (*DeleteTelegrafsIDLabelsIDResponse, error) { - rsp, err := c.DeleteTelegrafsIDLabelsID(ctx, telegrafID, labelID, params) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParseDeleteTelegrafsIDLabelsIDResponse(rsp) -} -// GetTelegrafsIDMembersWithResponse request returning *GetTelegrafsIDMembersResponse -func (c *ClientWithResponses) GetTelegrafsIDMembersWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDMembersParams) (*GetTelegrafsIDMembersResponse, error) { - rsp, err := c.GetTelegrafsIDMembers(ctx, telegrafID, params) - if err != nil { - return nil, err - } - return ParseGetTelegrafsIDMembersResponse(rsp) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// PostTelegrafsIDMembersWithBodyWithResponse request with arbitrary body returning *PostTelegrafsIDMembersResponse -func (c *ClientWithResponses) PostTelegrafsIDMembersWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, contentType string, body io.Reader) (*PostTelegrafsIDMembersResponse, error) { - rsp, err := c.PostTelegrafsIDMembersWithBody(ctx, telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - return ParsePostTelegrafsIDMembersResponse(rsp) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -func (c *ClientWithResponses) PostTelegrafsIDMembersWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDMembersParams, body PostTelegrafsIDMembersJSONRequestBody) (*PostTelegrafsIDMembersResponse, error) { - rsp, err := c.PostTelegrafsIDMembers(ctx, telegrafID, params, body) - if err != nil { - return nil, err + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePostTelegrafsIDMembersResponse(rsp) -} -// DeleteTelegrafsIDMembersIDWithResponse request returning *DeleteTelegrafsIDMembersIDResponse -func (c *ClientWithResponses) DeleteTelegrafsIDMembersIDWithResponse(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDMembersIDParams) (*DeleteTelegrafsIDMembersIDResponse, error) { - rsp, err := c.DeleteTelegrafsIDMembersID(ctx, telegrafID, userID, params) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParseDeleteTelegrafsIDMembersIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -// GetTelegrafsIDOwnersWithResponse request returning *GetTelegrafsIDOwnersResponse -func (c *ClientWithResponses) GetTelegrafsIDOwnersWithResponse(ctx context.Context, telegrafID string, params *GetTelegrafsIDOwnersParams) (*GetTelegrafsIDOwnersResponse, error) { - rsp, err := c.GetTelegrafsIDOwners(ctx, telegrafID, params) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParseGetTelegrafsIDOwnersResponse(rsp) -} -// PostTelegrafsIDOwnersWithBodyWithResponse request with arbitrary body returning *PostTelegrafsIDOwnersResponse -func (c *ClientWithResponses) PostTelegrafsIDOwnersWithBodyWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, contentType string, body io.Reader) (*PostTelegrafsIDOwnersResponse, error) { - rsp, err := c.PostTelegrafsIDOwnersWithBody(ctx, telegrafID, params, contentType, body) - if err != nil { - return nil, err - } - return ParsePostTelegrafsIDOwnersResponse(rsp) -} + response := &ScraperTargetResponses{} -func (c *ClientWithResponses) PostTelegrafsIDOwnersWithResponse(ctx context.Context, telegrafID string, params *PostTelegrafsIDOwnersParams, body PostTelegrafsIDOwnersJSONRequestBody) (*PostTelegrafsIDOwnersResponse, error) { - rsp, err := c.PostTelegrafsIDOwners(ctx, telegrafID, params, body) - if err != nil { - return nil, err + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostTelegrafsIDOwnersResponse(rsp) -} + return response, nil -// DeleteTelegrafsIDOwnersIDWithResponse request returning *DeleteTelegrafsIDOwnersIDResponse -func (c *ClientWithResponses) DeleteTelegrafsIDOwnersIDWithResponse(ctx context.Context, telegrafID string, userID string, params *DeleteTelegrafsIDOwnersIDParams) (*DeleteTelegrafsIDOwnersIDResponse, error) { - rsp, err := c.DeleteTelegrafsIDOwnersID(ctx, telegrafID, userID, params) - if err != nil { - return nil, err - } - return ParseDeleteTelegrafsIDOwnersIDResponse(rsp) } -// ApplyTemplateWithBodyWithResponse request with arbitrary body returning *ApplyTemplateResponse -func (c *ClientWithResponses) ApplyTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*ApplyTemplateResponse, error) { - rsp, err := c.ApplyTemplateWithBody(ctx, contentType, body) +// PostScrapers calls the POST on /scrapers +// Create a scraper target +func (c *Client) PostScrapers(ctx context.Context, params *PostScrapersAllParams) (*ScraperTargetResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } - return ParseApplyTemplateResponse(rsp) -} + bodyReader = bytes.NewReader(buf) -func (c *ClientWithResponses) ApplyTemplateWithResponse(ctx context.Context, body ApplyTemplateJSONRequestBody) (*ApplyTemplateResponse, error) { - rsp, err := c.ApplyTemplate(ctx, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseApplyTemplateResponse(rsp) -} -// ExportTemplateWithBodyWithResponse request with arbitrary body returning *ExportTemplateResponse -func (c *ClientWithResponses) ExportTemplateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader) (*ExportTemplateResponse, error) { - rsp, err := c.ExportTemplateWithBody(ctx, contentType, body) - if err != nil { - return nil, err - } - return ParseExportTemplateResponse(rsp) -} + operationPath := fmt.Sprintf("./scrapers") -func (c *ClientWithResponses) ExportTemplateWithResponse(ctx context.Context, body ExportTemplateJSONRequestBody) (*ExportTemplateResponse, error) { - rsp, err := c.ExportTemplate(ctx, body) + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParseExportTemplateResponse(rsp) -} -// GetUsersWithResponse request returning *GetUsersResponse -func (c *ClientWithResponses) GetUsersWithResponse(ctx context.Context, params *GetUsersParams) (*GetUsersResponse, error) { - rsp, err := c.GetUsers(ctx, params) + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - return ParseGetUsersResponse(rsp) -} -// PostUsersWithBodyWithResponse request with arbitrary body returning *PostUsersResponse -func (c *ClientWithResponses) PostUsersWithBodyWithResponse(ctx context.Context, params *PostUsersParams, contentType string, body io.Reader) (*PostUsersResponse, error) { - rsp, err := c.PostUsersWithBody(ctx, params, contentType, body) - if err != nil { - return nil, err - } - return ParsePostUsersResponse(rsp) -} + req.Header.Add("Content-Type", "application/json") -func (c *ClientWithResponses) PostUsersWithResponse(ctx context.Context, params *PostUsersParams, body PostUsersJSONRequestBody) (*PostUsersResponse, error) { - rsp, err := c.PostUsers(ctx, params, body) - if err != nil { - return nil, err - } - return ParsePostUsersResponse(rsp) -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// DeleteUsersIDWithResponse request returning *DeleteUsersIDResponse -func (c *ClientWithResponses) DeleteUsersIDWithResponse(ctx context.Context, userID string, params *DeleteUsersIDParams) (*DeleteUsersIDResponse, error) { - rsp, err := c.DeleteUsersID(ctx, userID, params) - if err != nil { - return nil, err - } - return ParseDeleteUsersIDResponse(rsp) -} + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } -// GetUsersIDWithResponse request returning *GetUsersIDResponse -func (c *ClientWithResponses) GetUsersIDWithResponse(ctx context.Context, userID string, params *GetUsersIDParams) (*GetUsersIDResponse, error) { - rsp, err := c.GetUsersID(ctx, userID, params) - if err != nil { - return nil, err + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseGetUsersIDResponse(rsp) -} -// PatchUsersIDWithBodyWithResponse request with arbitrary body returning *PatchUsersIDResponse -func (c *ClientWithResponses) PatchUsersIDWithBodyWithResponse(ctx context.Context, userID string, params *PatchUsersIDParams, contentType string, body io.Reader) (*PatchUsersIDResponse, error) { - rsp, err := c.PatchUsersIDWithBody(ctx, userID, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePatchUsersIDResponse(rsp) -} + bodyBytes, err := ioutil.ReadAll(rsp.Body) -func (c *ClientWithResponses) PatchUsersIDWithResponse(ctx context.Context, userID string, params *PatchUsersIDParams, body PatchUsersIDJSONRequestBody) (*PatchUsersIDResponse, error) { - rsp, err := c.PatchUsersID(ctx, userID, params, body) + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - return ParsePatchUsersIDResponse(rsp) -} -// PostUsersIDPasswordWithBodyWithResponse request with arbitrary body returning *PostUsersIDPasswordResponse -func (c *ClientWithResponses) PostUsersIDPasswordWithBodyWithResponse(ctx context.Context, userID string, params *PostUsersIDPasswordParams, contentType string, body io.Reader) (*PostUsersIDPasswordResponse, error) { - rsp, err := c.PostUsersIDPasswordWithBody(ctx, userID, params, contentType, body) - if err != nil { - return nil, err - } - return ParsePostUsersIDPasswordResponse(rsp) -} + response := &ScraperTargetResponse{} -func (c *ClientWithResponses) PostUsersIDPasswordWithResponse(ctx context.Context, userID string, params *PostUsersIDPasswordParams, body PostUsersIDPasswordJSONRequestBody) (*PostUsersIDPasswordResponse, error) { - rsp, err := c.PostUsersIDPassword(ctx, userID, params, body) - if err != nil { - return nil, err + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return ParsePostUsersIDPasswordResponse(rsp) -} + return response, nil -// GetVariablesWithResponse request returning *GetVariablesResponse -func (c *ClientWithResponses) GetVariablesWithResponse(ctx context.Context, params *GetVariablesParams) (*GetVariablesResponse, error) { - rsp, err := c.GetVariables(ctx, params) - if err != nil { - return nil, err - } - return ParseGetVariablesResponse(rsp) } -// PostVariablesWithBodyWithResponse request with arbitrary body returning *PostVariablesResponse -func (c *ClientWithResponses) PostVariablesWithBodyWithResponse(ctx context.Context, params *PostVariablesParams, contentType string, body io.Reader) (*PostVariablesResponse, error) { - rsp, err := c.PostVariablesWithBody(ctx, params, contentType, body) +// DeleteScrapersID calls the DELETE on /scrapers/{scraperTargetID} +// Delete a scraper target +func (c *Client) DeleteScrapersID(ctx context.Context, params *DeleteScrapersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) if err != nil { - return nil, err + return err } - return ParsePostVariablesResponse(rsp) -} -func (c *ClientWithResponses) PostVariablesWithResponse(ctx context.Context, params *PostVariablesParams, body PostVariablesJSONRequestBody) (*PostVariablesResponse, error) { - rsp, err := c.PostVariables(ctx, params, body) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err } - return ParsePostVariablesResponse(rsp) -} -// DeleteVariablesIDWithResponse request returning *DeleteVariablesIDResponse -func (c *ClientWithResponses) DeleteVariablesIDWithResponse(ctx context.Context, variableID string, params *DeleteVariablesIDParams) (*DeleteVariablesIDResponse, error) { - rsp, err := c.DeleteVariablesID(ctx, variableID, params) + operationPath := fmt.Sprintf("./scrapers/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - return ParseDeleteVariablesIDResponse(rsp) -} -// GetVariablesIDWithResponse request returning *GetVariablesIDResponse -func (c *ClientWithResponses) GetVariablesIDWithResponse(ctx context.Context, variableID string, params *GetVariablesIDParams) (*GetVariablesIDResponse, error) { - rsp, err := c.GetVariablesID(ctx, variableID, params) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - return ParseGetVariablesIDResponse(rsp) -} -// PatchVariablesIDWithBodyWithResponse request with arbitrary body returning *PatchVariablesIDResponse -func (c *ClientWithResponses) PatchVariablesIDWithBodyWithResponse(ctx context.Context, variableID string, params *PatchVariablesIDParams, contentType string, body io.Reader) (*PatchVariablesIDResponse, error) { - rsp, err := c.PatchVariablesIDWithBody(ctx, variableID, params, contentType, body) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParsePatchVariablesIDResponse(rsp) -} -func (c *ClientWithResponses) PatchVariablesIDWithResponse(ctx context.Context, variableID string, params *PatchVariablesIDParams, body PatchVariablesIDJSONRequestBody) (*PatchVariablesIDResponse, error) { - rsp, err := c.PatchVariablesID(ctx, variableID, params, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - return ParsePatchVariablesIDResponse(rsp) -} -// PutVariablesIDWithBodyWithResponse request with arbitrary body returning *PutVariablesIDResponse -func (c *ClientWithResponses) PutVariablesIDWithBodyWithResponse(ctx context.Context, variableID string, params *PutVariablesIDParams, contentType string, body io.Reader) (*PutVariablesIDResponse, error) { - rsp, err := c.PutVariablesIDWithBody(ctx, variableID, params, contentType, body) - if err != nil { - return nil, err + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) } - return ParsePutVariablesIDResponse(rsp) + return nil + } -func (c *ClientWithResponses) PutVariablesIDWithResponse(ctx context.Context, variableID string, params *PutVariablesIDParams, body PutVariablesIDJSONRequestBody) (*PutVariablesIDResponse, error) { - rsp, err := c.PutVariablesID(ctx, variableID, params, body) +// GetScrapersID calls the GET on /scrapers/{scraperTargetID} +// Retrieve a scraper target +func (c *Client) GetScrapersID(ctx context.Context, params *GetScrapersIDAllParams) (*ScraperTargetResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) if err != nil { return nil, err } - return ParsePutVariablesIDResponse(rsp) -} -// GetVariablesIDLabelsWithResponse request returning *GetVariablesIDLabelsResponse -func (c *ClientWithResponses) GetVariablesIDLabelsWithResponse(ctx context.Context, variableID string, params *GetVariablesIDLabelsParams) (*GetVariablesIDLabelsResponse, error) { - rsp, err := c.GetVariablesIDLabels(ctx, variableID, params) + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - return ParseGetVariablesIDLabelsResponse(rsp) -} -// PostVariablesIDLabelsWithBodyWithResponse request with arbitrary body returning *PostVariablesIDLabelsResponse -func (c *ClientWithResponses) PostVariablesIDLabelsWithBodyWithResponse(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, contentType string, body io.Reader) (*PostVariablesIDLabelsResponse, error) { - rsp, err := c.PostVariablesIDLabelsWithBody(ctx, variableID, params, contentType, body) + operationPath := fmt.Sprintf("./scrapers/%s", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - return ParsePostVariablesIDLabelsResponse(rsp) -} -func (c *ClientWithResponses) PostVariablesIDLabelsWithResponse(ctx context.Context, variableID string, params *PostVariablesIDLabelsParams, body PostVariablesIDLabelsJSONRequestBody) (*PostVariablesIDLabelsResponse, error) { - rsp, err := c.PostVariablesIDLabels(ctx, variableID, params, body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - return ParsePostVariablesIDLabelsResponse(rsp) -} -// DeleteVariablesIDLabelsIDWithResponse request returning *DeleteVariablesIDLabelsIDResponse -func (c *ClientWithResponses) DeleteVariablesIDLabelsIDWithResponse(ctx context.Context, variableID string, labelID string, params *DeleteVariablesIDLabelsIDParams) (*DeleteVariablesIDLabelsIDResponse, error) { - rsp, err := c.DeleteVariablesIDLabelsID(ctx, variableID, labelID, params) - if err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - return ParseDeleteVariablesIDLabelsIDResponse(rsp) -} -// PostWriteWithBodyWithResponse request with arbitrary body returning *PostWriteResponse -func (c *ClientWithResponses) PostWriteWithBodyWithResponse(ctx context.Context, params *PostWriteParams, contentType string, body io.Reader) (*PostWriteResponse, error) { - rsp, err := c.PostWriteWithBody(ctx, params, contentType, body) + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } - return ParsePostWriteResponse(rsp) -} - -// ParseGetRoutesResponse parses an HTTP response from a GetRoutesWithResponse call -func ParseGetRoutesResponse(rsp *http.Response) (*GetRoutesResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetRoutesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + response := &ScraperTargetResponse{} - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Routes - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetAuthorizationsResponse parses an HTTP response from a GetAuthorizationsWithResponse call -func ParseGetAuthorizationsResponse(rsp *http.Response) (*GetAuthorizationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PatchScrapersID calls the PATCH on /scrapers/{scraperTargetID} +// Update a scraper target +func (c *Client) PatchScrapersID(ctx context.Context, params *PatchScrapersIDAllParams) (*ScraperTargetResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetAuthorizationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorizations - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s", pathParam0) -// ParsePostAuthorizationsResponse parses an HTTP response from a PostAuthorizationsWithResponse call -func ParsePostAuthorizationsResponse(rsp *http.Response) (*PostAuthorizationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PostAuthorizationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteAuthorizationsIDResponse parses an HTTP response from a DeleteAuthorizationsIDWithResponse call -func ParseDeleteAuthorizationsIDResponse(rsp *http.Response) (*DeleteAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &ScraperTargetResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetAuthorizationsIDResponse parses an HTTP response from a GetAuthorizationsIDWithResponse call -func ParseGetAuthorizationsIDResponse(rsp *http.Response) (*GetAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetScrapersIDLabels calls the GET on /scrapers/{scraperTargetID}/labels +// List all labels for a scraper target +func (c *Client) GetScrapersIDLabels(ctx context.Context, params *GetScrapersIDLabelsAllParams) (*LabelsResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) if err != nil { return nil, err } - response := &GetAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/labels", pathParam0) -// ParsePatchAuthorizationsIDResponse parses an HTTP response from a PatchAuthorizationsIDWithResponse call -func ParsePatchAuthorizationsIDResponse(rsp *http.Response) (*PatchAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PatchAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetBackupKVResponse parses an HTTP response from a GetBackupKVWithResponse call -func ParseGetBackupKVResponse(rsp *http.Response) (*GetBackupKVResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetBackupKVResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &LabelsResponse{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetBackupMetadataResponse parses an HTTP response from a GetBackupMetadataWithResponse call -func ParseGetBackupMetadataResponse(rsp *http.Response) (*GetBackupMetadataResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostScrapersIDLabels calls the POST on /scrapers/{scraperTargetID}/labels +// Add a label to a scraper target +func (c *Client) PostScrapersIDLabels(ctx context.Context, params *PostScrapersIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetBackupMetadataResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/labels", pathParam0) -// ParseGetBackupShardIdResponse parses an HTTP response from a GetBackupShardIdWithResponse call -func ParseGetBackupShardIdResponse(rsp *http.Response) (*GetBackupShardIdResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetBackupShardIdResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetBucketsResponse parses an HTTP response from a GetBucketsWithResponse call -func ParseGetBucketsResponse(rsp *http.Response) (*GetBucketsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetBucketsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Buckets - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &LabelResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostBucketsResponse parses an HTTP response from a PostBucketsWithResponse call -func ParsePostBucketsResponse(rsp *http.Response) (*PostBucketsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteScrapersIDLabelsID calls the DELETE on /scrapers/{scraperTargetID}/labels/{labelID} +// Delete a label from a scraper target +func (c *Client) DeleteScrapersIDLabelsID(ctx context.Context, params *DeleteScrapersIDLabelsIDAllParams) error { + var err error - response := &PostBucketsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Bucket - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON422 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/labels/%s", pathParam0, pathParam1) -// ParseDeleteBucketsIDResponse parses an HTTP response from a DeleteBucketsIDWithResponse call -func ParseDeleteBucketsIDResponse(rsp *http.Response) (*DeleteBucketsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &DeleteBucketsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetBucketsIDResponse parses an HTTP response from a GetBucketsIDWithResponse call -func ParseGetBucketsIDResponse(rsp *http.Response) (*GetBucketsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err - } - - response := &GetBucketsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Bucket - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + defer func() { _ = rsp.Body.Close() }() - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePatchBucketsIDResponse parses an HTTP response from a PatchBucketsIDWithResponse call -func ParsePatchBucketsIDResponse(rsp *http.Response) (*PatchBucketsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetScrapersIDMembers calls the GET on /scrapers/{scraperTargetID}/members +// List all users with member privileges for a scraper target +func (c *Client) GetScrapersIDMembers(ctx context.Context, params *GetScrapersIDMembersAllParams) (*ResourceMembers, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) if err != nil { return nil, err } - response := &PatchBucketsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Bucket - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/members", pathParam0) -// ParseGetBucketsIDLabelsResponse parses an HTTP response from a GetBucketsIDLabelsWithResponse call -func ParseGetBucketsIDLabelsResponse(rsp *http.Response) (*GetBucketsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetBucketsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostBucketsIDLabelsResponse parses an HTTP response from a PostBucketsIDLabelsWithResponse call -func ParsePostBucketsIDLabelsResponse(rsp *http.Response) (*PostBucketsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostBucketsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &ResourceMembers{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteBucketsIDLabelsIDResponse parses an HTTP response from a DeleteBucketsIDLabelsIDWithResponse call -func ParseDeleteBucketsIDLabelsIDResponse(rsp *http.Response) (*DeleteBucketsIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostScrapersIDMembers calls the POST on /scrapers/{scraperTargetID}/members +// Add a member to a scraper target +func (c *Client) PostScrapersIDMembers(ctx context.Context, params *PostScrapersIDMembersAllParams) (*ResourceMember, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteBucketsIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/members", pathParam0) -// ParseGetBucketsIDMembersResponse parses an HTTP response from a GetBucketsIDMembersWithResponse call -func ParseGetBucketsIDMembersResponse(rsp *http.Response) (*GetBucketsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetBucketsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostBucketsIDMembersResponse parses an HTTP response from a PostBucketsIDMembersWithResponse call -func ParsePostBucketsIDMembersResponse(rsp *http.Response) (*PostBucketsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostBucketsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &ResourceMember{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteBucketsIDMembersIDResponse parses an HTTP response from a DeleteBucketsIDMembersIDWithResponse call -func ParseDeleteBucketsIDMembersIDResponse(rsp *http.Response) (*DeleteBucketsIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteScrapersIDMembersID calls the DELETE on /scrapers/{scraperTargetID}/members/{userID} +// Remove a member from a scraper target +func (c *Client) DeleteScrapersIDMembersID(ctx context.Context, params *DeleteScrapersIDMembersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) if err != nil { - return nil, err + return err } - response := &DeleteBucketsIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam1 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/members/%s", pathParam0, pathParam1) -// ParseGetBucketsIDOwnersResponse parses an HTTP response from a GetBucketsIDOwnersWithResponse call -func ParseGetBucketsIDOwnersResponse(rsp *http.Response) (*GetBucketsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetBucketsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostBucketsIDOwnersResponse parses an HTTP response from a PostBucketsIDOwnersWithResponse call -func ParsePostBucketsIDOwnersResponse(rsp *http.Response) (*PostBucketsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - response := &PostBucketsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + defer func() { _ = rsp.Body.Close() }() - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } - response.JSON201 = &dest + return decodeError(bodyBytes, rsp) + } + return nil - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest +} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } +// GetScrapersIDOwners calls the GET on /scrapers/{scraperTargetID}/owners +// List all owners of a scraper target +func (c *Client) GetScrapersIDOwners(ctx context.Context, params *GetScrapersIDOwnersAllParams) (*ResourceOwners, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return nil, err } - return response, nil -} + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } -// ParseDeleteBucketsIDOwnersIDResponse parses an HTTP response from a DeleteBucketsIDOwnersIDWithResponse call -func ParseDeleteBucketsIDOwnersIDResponse(rsp *http.Response) (*DeleteBucketsIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + operationPath := fmt.Sprintf("./scrapers/%s/owners", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteBucketsIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetChecksResponse parses an HTTP response from a GetChecksWithResponse call -func ParseGetChecksResponse(rsp *http.Response) (*GetChecksResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetChecksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Checks - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &ResourceOwners{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseCreateCheckResponse parses an HTTP response from a CreateCheckWithResponse call -func ParseCreateCheckResponse(rsp *http.Response) (*CreateCheckResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostScrapersIDOwners calls the POST on /scrapers/{scraperTargetID}/owners +// Add an owner to a scraper target +func (c *Client) PostScrapersIDOwners(ctx context.Context, params *PostScrapersIDOwnersAllParams) (*ResourceOwner, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &CreateCheckResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Check - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/owners", pathParam0) -// ParseDeleteChecksIDResponse parses an HTTP response from a DeleteChecksIDWithResponse call -func ParseDeleteChecksIDResponse(rsp *http.Response) (*DeleteChecksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteChecksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetChecksIDResponse parses an HTTP response from a GetChecksIDWithResponse call -func ParseGetChecksIDResponse(rsp *http.Response) (*GetChecksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetChecksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Check - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &ResourceOwner{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchChecksIDResponse parses an HTTP response from a PatchChecksIDWithResponse call -func ParsePatchChecksIDResponse(rsp *http.Response) (*PatchChecksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteScrapersIDOwnersID calls the DELETE on /scrapers/{scraperTargetID}/owners/{userID} +// Remove an owner from a scraper target +func (c *Client) DeleteScrapersIDOwnersID(ctx context.Context, params *DeleteScrapersIDOwnersIDAllParams) error { + var err error - response := &PatchChecksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Check - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "scraperTargetID", runtime.ParamLocationPath, params.ScraperTargetID) + if err != nil { + return err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./scrapers/%s/owners/%s", pathParam0, pathParam1) -// ParsePutChecksIDResponse parses an HTTP response from a PutChecksIDWithResponse call -func ParsePutChecksIDResponse(rsp *http.Response) (*PutChecksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PutChecksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Check - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetChecksIDLabelsResponse parses an HTTP response from a GetChecksIDLabelsWithResponse call -func ParseGetChecksIDLabelsResponse(rsp *http.Response) (*GetChecksIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - response := &GetChecksIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + defer func() { _ = rsp.Body.Close() }() - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } - response.JSON200 = &dest + return decodeError(bodyBytes, rsp) + } + return nil - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest +} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } +// GetSetup calls the GET on /setup +// Check if database has default user, org, bucket +func (c *Client) GetSetup(ctx context.Context, params *GetSetupParams) (*IsOnboarding, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./setup") -// ParsePostChecksIDLabelsResponse parses an HTTP response from a PostChecksIDLabelsWithResponse call -func ParsePostChecksIDLabelsResponse(rsp *http.Response) (*PostChecksIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PostChecksIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteChecksIDLabelsIDResponse parses an HTTP response from a DeleteChecksIDLabelsIDWithResponse call -func ParseDeleteChecksIDLabelsIDResponse(rsp *http.Response) (*DeleteChecksIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteChecksIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &IsOnboarding{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetChecksIDQueryResponse parses an HTTP response from a GetChecksIDQueryWithResponse call -func ParseGetChecksIDQueryResponse(rsp *http.Response) (*GetChecksIDQueryResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostSetup calls the POST on /setup +// Set up initial user, org and bucket +func (c *Client) PostSetup(ctx context.Context, params *PostSetupAllParams) (*OnboardingResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetChecksIDQueryResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest FluxResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./setup") -// ParseGetConfigResponse parses an HTTP response from a GetConfigWithResponse call -func ParseGetConfigResponse(rsp *http.Response) (*GetConfigResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetConfigResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Config - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON401 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDashboardsResponse parses an HTTP response from a GetDashboardsWithResponse call -func ParseGetDashboardsResponse(rsp *http.Response) (*GetDashboardsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDashboardsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Dashboards - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &OnboardingResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostDashboardsResponse parses an HTTP response from a PostDashboardsWithResponse call -func ParsePostDashboardsResponse(rsp *http.Response) (*PostDashboardsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostSignin calls the POST on /signin +// Create a user session. +func (c *Client) PostSignin(ctx context.Context, params *PostSigninParams) error { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { - return nil, err + return err + } + + operationPath := fmt.Sprintf("./signin") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - response := &PostDashboardsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest interface{} - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteDashboardsIDResponse parses an HTTP response from a DeleteDashboardsIDWithResponse call -func ParseDeleteDashboardsIDResponse(rsp *http.Response) (*DeleteDashboardsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - response := &DeleteDashboardsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + defer func() { _ = rsp.Body.Close() }() - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } - response.JSON404 = &dest + return decodeError(bodyBytes, rsp) + } + return nil - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest +} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } +// PostSignout calls the POST on /signout +// Expire the current UI session +func (c *Client) PostSignout(ctx context.Context, params *PostSignoutParams) error { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./signout") -// ParseGetDashboardsIDResponse parses an HTTP response from a GetDashboardsIDWithResponse call -func ParseGetDashboardsIDResponse(rsp *http.Response) (*GetDashboardsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetDashboardsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest interface{} - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePatchDashboardsIDResponse parses an HTTP response from a PatchDashboardsIDWithResponse call -func ParsePatchDashboardsIDResponse(rsp *http.Response) (*PatchDashboardsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetSources calls the GET on /sources +// List all sources +func (c *Client) GetSources(ctx context.Context, params *GetSourcesParams) (*Sources, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &PatchDashboardsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./sources") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Dashboard - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + queryValues := queryURL.Query() - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.Org != nil { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParsePostDashboardsIDCellsResponse parses an HTTP response from a PostDashboardsIDCellsWithResponse call -func ParsePostDashboardsIDCellsResponse(rsp *http.Response) (*PostDashboardsIDCellsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &PostDashboardsIDCellsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Cell - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePutDashboardsIDCellsResponse parses an HTTP response from a PutDashboardsIDCellsWithResponse call -func ParsePutDashboardsIDCellsResponse(rsp *http.Response) (*PutDashboardsIDCellsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PutDashboardsIDCellsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Dashboard - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &Sources{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteDashboardsIDCellsIDResponse parses an HTTP response from a DeleteDashboardsIDCellsIDWithResponse call -func ParseDeleteDashboardsIDCellsIDResponse(rsp *http.Response) (*DeleteDashboardsIDCellsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostSources calls the POST on /sources +// Create a source +func (c *Client) PostSources(ctx context.Context, params *PostSourcesAllParams) (*Source, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteDashboardsIDCellsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./sources") -// ParsePatchDashboardsIDCellsIDResponse parses an HTTP response from a PatchDashboardsIDCellsIDWithResponse call -func ParsePatchDashboardsIDCellsIDResponse(rsp *http.Response) (*PatchDashboardsIDCellsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PatchDashboardsIDCellsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Cell - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDashboardsIDCellsIDViewResponse parses an HTTP response from a GetDashboardsIDCellsIDViewWithResponse call -func ParseGetDashboardsIDCellsIDViewResponse(rsp *http.Response) (*GetDashboardsIDCellsIDViewResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDashboardsIDCellsIDViewResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest View - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &Source{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchDashboardsIDCellsIDViewResponse parses an HTTP response from a PatchDashboardsIDCellsIDViewWithResponse call -func ParsePatchDashboardsIDCellsIDViewResponse(rsp *http.Response) (*PatchDashboardsIDCellsIDViewResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteSourcesID calls the DELETE on /sources/{sourceID} +// Delete a source +func (c *Client) DeleteSourcesID(ctx context.Context, params *DeleteSourcesIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, params.SourceID) if err != nil { - return nil, err + return err } - response := &PatchDashboardsIDCellsIDViewResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest View - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./sources/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return response, nil -} - -// ParseGetDashboardsIDLabelsResponse parses an HTTP response from a GetDashboardsIDLabelsWithResponse call -func ParseGetDashboardsIDLabelsResponse(rsp *http.Response) (*GetDashboardsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - response := &GetDashboardsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePostDashboardsIDLabelsResponse parses an HTTP response from a PostDashboardsIDLabelsWithResponse call -func ParsePostDashboardsIDLabelsResponse(rsp *http.Response) (*PostDashboardsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetSourcesID calls the GET on /sources/{sourceID} +// Retrieve a source +func (c *Client) GetSourcesID(ctx context.Context, params *GetSourcesIDAllParams) (*Source, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, params.SourceID) if err != nil { return nil, err } - response := &PostDashboardsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./sources/%s", pathParam0) -// ParseDeleteDashboardsIDLabelsIDResponse parses an HTTP response from a DeleteDashboardsIDLabelsIDWithResponse call -func ParseDeleteDashboardsIDLabelsIDResponse(rsp *http.Response) (*DeleteDashboardsIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteDashboardsIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDashboardsIDMembersResponse parses an HTTP response from a GetDashboardsIDMembersWithResponse call -func ParseGetDashboardsIDMembersResponse(rsp *http.Response) (*GetDashboardsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDashboardsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Source{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostDashboardsIDMembersResponse parses an HTTP response from a PostDashboardsIDMembersWithResponse call -func ParsePostDashboardsIDMembersResponse(rsp *http.Response) (*PostDashboardsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PatchSourcesID calls the PATCH on /sources/{sourceID} +// Update a Source +func (c *Client) PatchSourcesID(ctx context.Context, params *PatchSourcesIDAllParams) (*Source, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostDashboardsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, params.SourceID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./sources/%s", pathParam0) -// ParseDeleteDashboardsIDMembersIDResponse parses an HTTP response from a DeleteDashboardsIDMembersIDWithResponse call -func ParseDeleteDashboardsIDMembersIDResponse(rsp *http.Response) (*DeleteDashboardsIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteDashboardsIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDashboardsIDOwnersResponse parses an HTTP response from a GetDashboardsIDOwnersWithResponse call -func ParseGetDashboardsIDOwnersResponse(rsp *http.Response) (*GetDashboardsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDashboardsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Source{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostDashboardsIDOwnersResponse parses an HTTP response from a PostDashboardsIDOwnersWithResponse call -func ParsePostDashboardsIDOwnersResponse(rsp *http.Response) (*PostDashboardsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetSourcesIDBuckets calls the GET on /sources/{sourceID}/buckets +// Get buckets in a source +func (c *Client) GetSourcesIDBuckets(ctx context.Context, params *GetSourcesIDBucketsAllParams) (*Buckets, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, params.SourceID) if err != nil { return nil, err } - response := &PostDashboardsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + operationPath := fmt.Sprintf("./sources/%s/buckets", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + queryValues := queryURL.Query() + + if params.Org != nil { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParseDeleteDashboardsIDOwnersIDResponse parses an HTTP response from a DeleteDashboardsIDOwnersIDWithResponse call -func ParseDeleteDashboardsIDOwnersIDResponse(rsp *http.Response) (*DeleteDashboardsIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &DeleteDashboardsIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDBRPsResponse parses an HTTP response from a GetDBRPsWithResponse call -func ParseGetDBRPsResponse(rsp *http.Response) (*GetDBRPsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDBRPsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DBRPs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + response := &Buckets{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostDBRPResponse parses an HTTP response from a PostDBRPWithResponse call -func ParsePostDBRPResponse(rsp *http.Response) (*PostDBRPResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetSourcesIDHealth calls the GET on /sources/{sourceID}/health +// Get the health of a source +func (c *Client) GetSourcesIDHealth(ctx context.Context, params *GetSourcesIDHealthAllParams) (*HealthCheck, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "sourceID", runtime.ParamLocationPath, params.SourceID) if err != nil { return nil, err } - response := &PostDBRPResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest DBRP - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./sources/%s/health", pathParam0) -// ParseDeleteDBRPIDResponse parses an HTTP response from a DeleteDBRPIDWithResponse call -func ParseDeleteDBRPIDResponse(rsp *http.Response) (*DeleteDBRPIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteDBRPIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetDBRPsIDResponse parses an HTTP response from a GetDBRPsIDWithResponse call -func ParseGetDBRPsIDResponse(rsp *http.Response) (*GetDBRPsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetDBRPsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DBRPGet - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + response := &HealthCheck{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchDBRPIDResponse parses an HTTP response from a PatchDBRPIDWithResponse call -func ParsePatchDBRPIDResponse(rsp *http.Response) (*PatchDBRPIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// ListStacks calls the GET on /stacks +// List installed stacks +func (c *Client) ListStacks(ctx context.Context, params *ListStacksParams) (*struct { + Stacks *[]Stack `json:"stacks,omitempty"` +}, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &PatchDBRPIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./stacks") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest DBRPGet - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + queryValues := queryURL.Query() - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } } - response.JSON400 = &dest + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.StackID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "stackID", runtime.ParamLocationQuery, *params.StackID); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParsePostDeleteResponse parses an HTTP response from a PostDeleteWithResponse call -func ParsePostDeleteResponse(rsp *http.Response) (*PostDeleteResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &PostDeleteResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON403 = &dest + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &struct { + Stacks *[]Stack `json:"stacks,omitempty"` + }{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetFlagsResponse parses an HTTP response from a GetFlagsWithResponse call -func ParseGetFlagsResponse(rsp *http.Response) (*GetFlagsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// CreateStack calls the POST on /stacks +// Create a stack +func (c *Client) CreateStack(ctx context.Context, params *CreateStackAllParams) (*Stack, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetFlagsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Flags - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + operationPath := fmt.Sprintf("./stacks") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return response, nil -} + req.Header.Add("Content-Type", "application/json") -// ParseGetHealthResponse parses an HTTP response from a GetHealthWithResponse call -func ParseGetHealthResponse(rsp *http.Response) (*GetHealthResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetHealthResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HealthCheck - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: - var dest HealthCheck - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON503 = &dest + response := &Stack{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetLabelsResponse parses an HTTP response from a GetLabelsWithResponse call -func ParseGetLabelsResponse(rsp *http.Response) (*GetLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteStack calls the DELETE on /stacks/{stack_id} +// Delete a stack and associated resources +func (c *Client) DeleteStack(ctx context.Context, params *DeleteStackAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, params.StackId) if err != nil { - return nil, err + return err } - response := &GetLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + operationPath := fmt.Sprintf("./stacks/%s", pathParam0) - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + queryValues := queryURL.Query() + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, params.OrgID); err != nil { + return err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParsePostLabelsResponse parses an HTTP response from a PostLabelsWithResponse call -func ParsePostLabelsResponse(rsp *http.Response) (*PostLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - response := &PostLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + defer func() { _ = rsp.Body.Close() }() - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseDeleteLabelsIDResponse parses an HTTP response from a DeleteLabelsIDWithResponse call -func ParseDeleteLabelsIDResponse(rsp *http.Response) (*DeleteLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// ReadStack calls the GET on /stacks/{stack_id} +// Retrieve a stack +func (c *Client) ReadStack(ctx context.Context, params *ReadStackAllParams) (*Stack, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, params.StackId) if err != nil { return nil, err } - response := &DeleteLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./stacks/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } -// ParseGetLabelsIDResponse parses an HTTP response from a GetLabelsIDWithResponse call -func ParseGetLabelsIDResponse(rsp *http.Response) (*GetLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Stack{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchLabelsIDResponse parses an HTTP response from a PatchLabelsIDWithResponse call -func ParsePatchLabelsIDResponse(rsp *http.Response) (*PatchLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// UpdateStack calls the PATCH on /stacks/{stack_id} +// Update a stack +func (c *Client) UpdateStack(ctx context.Context, params *UpdateStackAllParams) (*Stack, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PatchLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } - } - - return response, nil -} + var pathParam0 string -// ParseGetLegacyAuthorizationsResponse parses an HTTP response from a GetLegacyAuthorizationsWithResponse call -func ParseGetLegacyAuthorizationsResponse(rsp *http.Response) (*GetLegacyAuthorizationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, params.StackId) if err != nil { return nil, err } - response := &GetLegacyAuthorizationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorizations - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + operationPath := fmt.Sprintf("./stacks/%s", pathParam0) - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return response, nil -} + req.Header.Add("Content-Type", "application/json") -// ParsePostLegacyAuthorizationsResponse parses an HTTP response from a PostLegacyAuthorizationsWithResponse call -func ParsePostLegacyAuthorizationsResponse(rsp *http.Response) (*PostLegacyAuthorizationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostLegacyAuthorizationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + response := &Stack{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteLegacyAuthorizationsIDResponse parses an HTTP response from a DeleteLegacyAuthorizationsIDWithResponse call -func ParseDeleteLegacyAuthorizationsIDResponse(rsp *http.Response) (*DeleteLegacyAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// UninstallStack calls the POST on /stacks/{stack_id}/uninstall +// Uninstall a stack +func (c *Client) UninstallStack(ctx context.Context, params *UninstallStackAllParams) (*Stack, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "stack_id", runtime.ParamLocationPath, params.StackId) if err != nil { return nil, err } - response := &DeleteLegacyAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./stacks/%s/uninstall", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } -// ParseGetLegacyAuthorizationsIDResponse parses an HTTP response from a GetLegacyAuthorizationsIDWithResponse call -func ParseGetLegacyAuthorizationsIDResponse(rsp *http.Response) (*GetLegacyAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetLegacyAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Stack{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchLegacyAuthorizationsIDResponse parses an HTTP response from a PatchLegacyAuthorizationsIDWithResponse call -func ParsePatchLegacyAuthorizationsIDResponse(rsp *http.Response) (*PatchLegacyAuthorizationsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasks calls the GET on /tasks +// List tasks +func (c *Client) GetTasks(ctx context.Context, params *GetTasksParams) (*Tasks, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &PatchLegacyAuthorizationsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./tasks") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Authorization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + queryValues := queryURL.Query() - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + if params.After != nil { -// ParsePostLegacyAuthorizationsIDPasswordResponse parses an HTTP response from a PostLegacyAuthorizationsIDPasswordWithResponse call -func ParsePostLegacyAuthorizationsIDPasswordResponse(rsp *http.Response) (*PostLegacyAuthorizationsIDPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - response := &PostLegacyAuthorizationsIDPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.User != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "user", runtime.ParamLocationQuery, *params.User); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + if params.Org != nil { -// ParseGetMeResponse parses an HTTP response from a GetMeWithResponse call -func ParseGetMeResponse(rsp *http.Response) (*GetMeResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - response := &GetMeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest UserResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.OrgID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.Status != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "status", runtime.ParamLocationQuery, *params.Status); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + if params.Limit != nil { -// ParsePutMePasswordResponse parses an HTTP response from a PutMePasswordWithResponse call -func ParsePutMePasswordResponse(rsp *http.Response) (*PutMePasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - response := &PutMePasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.Type != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParseGetMetricsResponse parses an HTTP response from a GetMetricsWithResponse call -func ParseGetMetricsResponse(rsp *http.Response) (*GetMetricsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &GetMetricsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationEndpointsResponse parses an HTTP response from a GetNotificationEndpointsWithResponse call -func ParseGetNotificationEndpointsResponse(rsp *http.Response) (*GetNotificationEndpointsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationEndpointsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationEndpoints - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Tasks{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseCreateNotificationEndpointResponse parses an HTTP response from a CreateNotificationEndpointWithResponse call -func ParseCreateNotificationEndpointResponse(rsp *http.Response) (*CreateNotificationEndpointResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasks calls the POST on /tasks +// Create a task +func (c *Client) PostTasks(ctx context.Context, params *PostTasksAllParams) (*Task, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &CreateNotificationEndpointResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest NotificationEndpoint - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./tasks") - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseDeleteNotificationEndpointsIDResponse parses an HTTP response from a DeleteNotificationEndpointsIDWithResponse call -func ParseDeleteNotificationEndpointsIDResponse(rsp *http.Response) (*DeleteNotificationEndpointsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &DeleteNotificationEndpointsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json") - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationEndpointsIDResponse parses an HTTP response from a GetNotificationEndpointsIDWithResponse call -func ParseGetNotificationEndpointsIDResponse(rsp *http.Response) (*GetNotificationEndpointsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationEndpointsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationEndpoint - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Task{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil -} - -// ParsePatchNotificationEndpointsIDResponse parses an HTTP response from a PatchNotificationEndpointsIDWithResponse call -func ParsePatchNotificationEndpointsIDResponse(rsp *http.Response) (*PatchNotificationEndpointsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } - response := &PatchNotificationEndpointsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } +} - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationEndpoint - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest +// DeleteTasksID calls the DELETE on /tasks/{taskID} +// Delete a task +func (c *Client) DeleteTasksID(ctx context.Context, params *DeleteTasksIDAllParams) error { + var err error - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s", pathParam0) -// ParsePutNotificationEndpointsIDResponse parses an HTTP response from a PutNotificationEndpointsIDWithResponse call -func ParsePutNotificationEndpointsIDResponse(rsp *http.Response) (*PutNotificationEndpointsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PutNotificationEndpointsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationEndpoint - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationEndpointsIDLabelsResponse parses an HTTP response from a GetNotificationEndpointsIDLabelsWithResponse call -func ParseGetNotificationEndpointsIDLabelsResponse(rsp *http.Response) (*GetNotificationEndpointsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - response := &GetNotificationEndpointsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + defer func() { _ = rsp.Body.Close() }() - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePostNotificationEndpointIDLabelsResponse parses an HTTP response from a PostNotificationEndpointIDLabelsWithResponse call -func ParsePostNotificationEndpointIDLabelsResponse(rsp *http.Response) (*PostNotificationEndpointIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksID calls the GET on /tasks/{taskID} +// Retrieve a task +func (c *Client) GetTasksID(ctx context.Context, params *GetTasksIDAllParams) (*Task, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &PostNotificationEndpointIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s", pathParam0) -// ParseDeleteNotificationEndpointsIDLabelsIDResponse parses an HTTP response from a DeleteNotificationEndpointsIDLabelsIDWithResponse call -func ParseDeleteNotificationEndpointsIDLabelsIDResponse(rsp *http.Response) (*DeleteNotificationEndpointsIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteNotificationEndpointsIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationRulesResponse parses an HTTP response from a GetNotificationRulesWithResponse call -func ParseGetNotificationRulesResponse(rsp *http.Response) (*GetNotificationRulesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationRulesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationRules - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Task{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseCreateNotificationRuleResponse parses an HTTP response from a CreateNotificationRuleWithResponse call -func ParseCreateNotificationRuleResponse(rsp *http.Response) (*CreateNotificationRuleResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PatchTasksID calls the PATCH on /tasks/{taskID} +// Update a task +func (c *Client) PatchTasksID(ctx context.Context, params *PatchTasksIDAllParams) (*Task, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &CreateNotificationRuleResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest NotificationRule - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s", pathParam0) -// ParseDeleteNotificationRulesIDResponse parses an HTTP response from a DeleteNotificationRulesIDWithResponse call -func ParseDeleteNotificationRulesIDResponse(rsp *http.Response) (*DeleteNotificationRulesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteNotificationRulesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationRulesIDResponse parses an HTTP response from a GetNotificationRulesIDWithResponse call -func ParseGetNotificationRulesIDResponse(rsp *http.Response) (*GetNotificationRulesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationRulesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationRule - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Task{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePatchNotificationRulesIDResponse parses an HTTP response from a PatchNotificationRulesIDWithResponse call -func ParsePatchNotificationRulesIDResponse(rsp *http.Response) (*PatchNotificationRulesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDLabels calls the GET on /tasks/{taskID}/labels +// List labels for a task +func (c *Client) GetTasksIDLabels(ctx context.Context, params *GetTasksIDLabelsAllParams) (*LabelsResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &PatchNotificationRulesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationRule - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/labels", pathParam0) -// ParsePutNotificationRulesIDResponse parses an HTTP response from a PutNotificationRulesIDWithResponse call -func ParsePutNotificationRulesIDResponse(rsp *http.Response) (*PutNotificationRulesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PutNotificationRulesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest NotificationRule - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationRulesIDLabelsResponse parses an HTTP response from a GetNotificationRulesIDLabelsWithResponse call -func ParseGetNotificationRulesIDLabelsResponse(rsp *http.Response) (*GetNotificationRulesIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationRulesIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &LabelsResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostNotificationRuleIDLabelsResponse parses an HTTP response from a PostNotificationRuleIDLabelsWithResponse call -func ParsePostNotificationRuleIDLabelsResponse(rsp *http.Response) (*PostNotificationRuleIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasksIDLabels calls the POST on /tasks/{taskID}/labels +// Add a label to a task +func (c *Client) PostTasksIDLabels(ctx context.Context, params *PostTasksIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostNotificationRuleIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/labels", pathParam0) -// ParseDeleteNotificationRulesIDLabelsIDResponse parses an HTTP response from a DeleteNotificationRulesIDLabelsIDWithResponse call -func ParseDeleteNotificationRulesIDLabelsIDResponse(rsp *http.Response) (*DeleteNotificationRulesIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &DeleteNotificationRulesIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetNotificationRulesIDQueryResponse parses an HTTP response from a GetNotificationRulesIDQueryWithResponse call -func ParseGetNotificationRulesIDQueryResponse(rsp *http.Response) (*GetNotificationRulesIDQueryResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetNotificationRulesIDQueryResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest FluxResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &LabelResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetOrgsResponse parses an HTTP response from a GetOrgsWithResponse call -func ParseGetOrgsResponse(rsp *http.Response) (*GetOrgsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTasksIDLabelsID calls the DELETE on /tasks/{taskID}/labels/{labelID} +// Delete a label from a task +func (c *Client) DeleteTasksIDLabelsID(ctx context.Context, params *DeleteTasksIDLabelsIDAllParams) error { + var err error + + var pathParam0 string - response := &GetOrgsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Organizations - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/labels/%s", pathParam0, pathParam1) -// ParsePostOrgsResponse parses an HTTP response from a PostOrgsWithResponse call -func ParsePostOrgsResponse(rsp *http.Response) (*PostOrgsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PostOrgsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Organization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteOrgsIDResponse parses an HTTP response from a DeleteOrgsIDWithResponse call -func ParseDeleteOrgsIDResponse(rsp *http.Response) (*DeleteOrgsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err + return err } - response := &DeleteOrgsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + defer func() { _ = rsp.Body.Close() }() - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } - response.JSON404 = &dest + return decodeError(bodyBytes, rsp) + } + return nil - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest +} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } +// GetTasksIDLogs calls the GET on /tasks/{taskID}/logs +// Retrieve all logs for a task +func (c *Client) GetTasksIDLogs(ctx context.Context, params *GetTasksIDLogsAllParams) (*Logs, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err } - return response, nil -} + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err + } -// ParseGetOrgsIDResponse parses an HTTP response from a GetOrgsIDWithResponse call -func ParseGetOrgsIDResponse(rsp *http.Response) (*GetOrgsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + operationPath := fmt.Sprintf("./tasks/%s/logs", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetOrgsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Organization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchOrgsIDResponse parses an HTTP response from a PatchOrgsIDWithResponse call -func ParsePatchOrgsIDResponse(rsp *http.Response) (*PatchOrgsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchOrgsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Organization - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Logs{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetOrgsIDMembersResponse parses an HTTP response from a GetOrgsIDMembersWithResponse call -func ParseGetOrgsIDMembersResponse(rsp *http.Response) (*GetOrgsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDMembers calls the GET on /tasks/{taskID}/members +// List all task members +func (c *Client) GetTasksIDMembers(ctx context.Context, params *GetTasksIDMembersAllParams) (*ResourceMembers, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &GetOrgsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + operationPath := fmt.Sprintf("./tasks/%s/members", pathParam0) - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostOrgsIDMembersResponse parses an HTTP response from a PostOrgsIDMembersWithResponse call -func ParsePostOrgsIDMembersResponse(rsp *http.Response) (*PostOrgsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostOrgsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &ResourceMembers{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteOrgsIDMembersIDResponse parses an HTTP response from a DeleteOrgsIDMembersIDWithResponse call -func ParseDeleteOrgsIDMembersIDResponse(rsp *http.Response) (*DeleteOrgsIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasksIDMembers calls the POST on /tasks/{taskID}/members +// Add a member to a task +func (c *Client) PostTasksIDMembers(ctx context.Context, params *PostTasksIDMembersAllParams) (*ResourceMember, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteOrgsIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/members", pathParam0) -// ParseGetOrgsIDOwnersResponse parses an HTTP response from a GetOrgsIDOwnersWithResponse call -func ParseGetOrgsIDOwnersResponse(rsp *http.Response) (*GetOrgsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetOrgsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostOrgsIDOwnersResponse parses an HTTP response from a PostOrgsIDOwnersWithResponse call -func ParsePostOrgsIDOwnersResponse(rsp *http.Response) (*PostOrgsIDOwnersResponse, error) { + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return nil, err + } bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &PostOrgsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &ResourceMember{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteOrgsIDOwnersIDResponse parses an HTTP response from a DeleteOrgsIDOwnersIDWithResponse call -func ParseDeleteOrgsIDOwnersIDResponse(rsp *http.Response) (*DeleteOrgsIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteTasksIDMembersID calls the DELETE on /tasks/{taskID}/members/{userID} +// Remove a member from a task +func (c *Client) DeleteTasksIDMembersID(ctx context.Context, params *DeleteTasksIDMembersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { - return nil, err + return err } - response := &DeleteOrgsIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam1 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/members/%s", pathParam0, pathParam1) -// ParseGetOrgsIDSecretsResponse parses an HTTP response from a GetOrgsIDSecretsWithResponse call -func ParseGetOrgsIDSecretsResponse(rsp *http.Response) (*GetOrgsIDSecretsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetOrgsIDSecretsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest SecretKeysResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchOrgsIDSecretsResponse parses an HTTP response from a PatchOrgsIDSecretsWithResponse call -func ParsePatchOrgsIDSecretsResponse(rsp *http.Response) (*PatchOrgsIDSecretsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { - return nil, err - } - - response := &PatchOrgsIDSecretsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + defer func() { _ = rsp.Body.Close() }() - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePostOrgsIDSecretsResponse parses an HTTP response from a PostOrgsIDSecretsWithResponse call -func ParsePostOrgsIDSecretsResponse(rsp *http.Response) (*PostOrgsIDSecretsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDOwners calls the GET on /tasks/{taskID}/owners +// List all owners of a task +func (c *Client) GetTasksIDOwners(ctx context.Context, params *GetTasksIDOwnersAllParams) (*ResourceOwners, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &PostOrgsIDSecretsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./tasks/%s/owners", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseDeleteOrgsIDSecretsIDResponse parses an HTTP response from a DeleteOrgsIDSecretsIDWithResponse call -func ParseDeleteOrgsIDSecretsIDResponse(rsp *http.Response) (*DeleteOrgsIDSecretsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &DeleteOrgsIDSecretsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetPingResponse parses an HTTP response from a GetPingWithResponse call -func ParseGetPingResponse(rsp *http.Response) (*GetPingResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetPingResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { + response := &ResourceOwners{} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err } + default: + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseHeadPingResponse parses an HTTP response from a HeadPingWithResponse call -func ParseHeadPingResponse(rsp *http.Response) (*HeadPingResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasksIDOwners calls the POST on /tasks/{taskID}/owners +// Add an owner for a task +func (c *Client) PostTasksIDOwners(ctx context.Context, params *PostTasksIDOwnersAllParams) (*ResourceOwner, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &HeadPingResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/owners", pathParam0) -// ParsePostQueryResponse parses an HTTP response from a PostQueryWithResponse call -func ParsePostQueryResponse(rsp *http.Response) (*PostQueryResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PostQueryResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostQueryAnalyzeResponse parses an HTTP response from a PostQueryAnalyzeWithResponse call -func ParsePostQueryAnalyzeResponse(rsp *http.Response) (*PostQueryAnalyzeResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostQueryAnalyzeResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest AnalyzeQueryResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &ResourceOwner{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostQueryAstResponse parses an HTTP response from a PostQueryAstWithResponse call -func ParsePostQueryAstResponse(rsp *http.Response) (*PostQueryAstResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTasksIDOwnersID calls the DELETE on /tasks/{taskID}/owners/{userID} +// Remove an owner from a task +func (c *Client) DeleteTasksIDOwnersID(ctx context.Context, params *DeleteTasksIDOwnersIDAllParams) error { + var err error - response := &PostQueryAstResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ASTResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/owners/%s", pathParam0, pathParam1) -// ParseGetQuerySuggestionsResponse parses an HTTP response from a GetQuerySuggestionsWithResponse call -func ParseGetQuerySuggestionsResponse(rsp *http.Response) (*GetQuerySuggestionsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetQuerySuggestionsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest FluxSuggestions - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseGetQuerySuggestionsNameResponse parses an HTTP response from a GetQuerySuggestionsNameWithResponse call -func ParseGetQuerySuggestionsNameResponse(rsp *http.Response) (*GetQuerySuggestionsNameResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDRuns calls the GET on /tasks/{taskID}/runs +// List runs for a task +func (c *Client) GetTasksIDRuns(ctx context.Context, params *GetTasksIDRunsAllParams) (*Runs, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &GetQuerySuggestionsNameResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest FluxSuggestion - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + operationPath := fmt.Sprintf("./tasks/%s/runs", pathParam0) + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + queryValues := queryURL.Query() + + if params.After != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + if params.Limit != nil { -// ParseGetReadyResponse parses an HTTP response from a GetReadyWithResponse call -func ParseGetReadyResponse(rsp *http.Response) (*GetReadyResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - response := &GetReadyResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Ready - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.AfterTime != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "afterTime", runtime.ParamLocationQuery, *params.AfterTime); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.BeforeTime != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "beforeTime", runtime.ParamLocationQuery, *params.BeforeTime); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParseGetRemoteConnectionsResponse parses an HTTP response from a GetRemoteConnectionsWithResponse call -func ParseGetRemoteConnectionsResponse(rsp *http.Response) (*GetRemoteConnectionsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &GetRemoteConnectionsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest RemoteConnections - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostRemoteConnectionResponse parses an HTTP response from a PostRemoteConnectionWithResponse call -func ParsePostRemoteConnectionResponse(rsp *http.Response) (*PostRemoteConnectionResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostRemoteConnectionResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest RemoteConnection - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + response := &Runs{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteRemoteConnectionByIDResponse parses an HTTP response from a DeleteRemoteConnectionByIDWithResponse call -func ParseDeleteRemoteConnectionByIDResponse(rsp *http.Response) (*DeleteRemoteConnectionByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasksIDRuns calls the POST on /tasks/{taskID}/runs +// Start a task run, overriding the schedule +func (c *Client) PostTasksIDRuns(ctx context.Context, params *PostTasksIDRunsAllParams) (*Run, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteRemoteConnectionByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/runs", pathParam0) -// ParseGetRemoteConnectionByIDResponse parses an HTTP response from a GetRemoteConnectionByIDWithResponse call -func ParseGetRemoteConnectionByIDResponse(rsp *http.Response) (*GetRemoteConnectionByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetRemoteConnectionByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest RemoteConnection - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchRemoteConnectionByIDResponse parses an HTTP response from a PatchRemoteConnectionByIDWithResponse call -func ParsePatchRemoteConnectionByIDResponse(rsp *http.Response) (*PatchRemoteConnectionByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchRemoteConnectionByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest RemoteConnection - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &Run{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetReplicationsResponse parses an HTTP response from a GetReplicationsWithResponse call -func ParseGetReplicationsResponse(rsp *http.Response) (*GetReplicationsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTasksIDRunsID calls the DELETE on /tasks/{taskID}/runs/{runID} +// Cancel a running task +func (c *Client) DeleteTasksIDRunsID(ctx context.Context, params *DeleteTasksIDRunsIDAllParams) error { + var err error - response := &GetReplicationsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Replications - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, params.RunID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/runs/%s", pathParam0, pathParam1) -// ParsePostReplicationResponse parses an HTTP response from a PostReplicationWithResponse call -func ParsePostReplicationResponse(rsp *http.Response) (*PostReplicationResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PostReplicationResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Replication - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON400 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseDeleteReplicationByIDResponse parses an HTTP response from a DeleteReplicationByIDWithResponse call -func ParseDeleteReplicationByIDResponse(rsp *http.Response) (*DeleteReplicationByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDRunsID calls the GET on /tasks/{taskID}/runs/{runID} +// Retrieve a run for a task. +func (c *Client) GetTasksIDRunsID(ctx context.Context, params *GetTasksIDRunsIDAllParams) (*Run, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &DeleteReplicationByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, params.RunID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/runs/%s", pathParam0, pathParam1) -// ParseGetReplicationByIDResponse parses an HTTP response from a GetReplicationByIDWithResponse call -func ParseGetReplicationByIDResponse(rsp *http.Response) (*GetReplicationByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetReplicationByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Replication - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchReplicationByIDResponse parses an HTTP response from a PatchReplicationByIDWithResponse call -func ParsePatchReplicationByIDResponse(rsp *http.Response) (*PatchReplicationByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchReplicationByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Replication - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &Run{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostValidateReplicationByIDResponse parses an HTTP response from a PostValidateReplicationByIDWithResponse call -func ParsePostValidateReplicationByIDResponse(rsp *http.Response) (*PostValidateReplicationByIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTasksIDRunsIDLogs calls the GET on /tasks/{taskID}/runs/{runID}/logs +// Retrieve all logs for a run +func (c *Client) GetTasksIDRunsIDLogs(ctx context.Context, params *GetTasksIDRunsIDLogsAllParams) (*Logs, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) if err != nil { return nil, err } - response := &PostValidateReplicationByIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, params.RunID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./tasks/%s/runs/%s/logs", pathParam0, pathParam1) -// ParseGetResourcesResponse parses an HTTP response from a GetResourcesWithResponse call -func ParseGetResourcesResponse(rsp *http.Response) (*GetResourcesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetResourcesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []string - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostRestoreBucketIDResponse parses an HTTP response from a PostRestoreBucketIDWithResponse call -func ParsePostRestoreBucketIDResponse(rsp *http.Response) (*PostRestoreBucketIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostRestoreBucketIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest []byte - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Logs{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostRestoreBucketMetadataResponse parses an HTTP response from a PostRestoreBucketMetadataWithResponse call -func ParsePostRestoreBucketMetadataResponse(rsp *http.Response) (*PostRestoreBucketMetadataResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTasksIDRunsIDRetry calls the POST on /tasks/{taskID}/runs/{runID}/retry +// Retry a task run +func (c *Client) PostTasksIDRunsIDRetry(ctx context.Context, params *PostTasksIDRunsIDRetryAllParams) (*Run, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostRestoreBucketMetadataResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest RestoredBucketMappings - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + var pathParam0 string - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "taskID", runtime.ParamLocationPath, params.TaskID) + if err != nil { + return nil, err } - return response, nil -} + var pathParam1 string -// ParsePostRestoreKVResponse parses an HTTP response from a PostRestoreKVWithResponse call -func ParsePostRestoreKVResponse(rsp *http.Response) (*PostRestoreKVResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "runID", runtime.ParamLocationPath, params.RunID) if err != nil { return nil, err } - response := &PostRestoreKVResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - // token is the root token for the instance after restore (this is overwritten during the restore) - Token *string `json:"token,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./tasks/%s/runs/%s/retry", pathParam0, pathParam1) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParsePostRestoreShardIdResponse parses an HTTP response from a PostRestoreShardIdWithResponse call -func ParsePostRestoreShardIdResponse(rsp *http.Response) (*PostRestoreShardIdResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &PostRestoreShardIdResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json; charset=utf-8") + + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostRestoreSQLResponse parses an HTTP response from a PostRestoreSQLWithResponse call -func ParsePostRestoreSQLResponse(rsp *http.Response) (*PostRestoreSQLResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostRestoreSQLResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &Run{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetScrapersResponse parses an HTTP response from a GetScrapersWithResponse call -func ParseGetScrapersResponse(rsp *http.Response) (*GetScrapersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafPlugins calls the GET on /telegraf/plugins +// List all Telegraf plugins +func (c *Client) GetTelegrafPlugins(ctx context.Context, params *GetTelegrafPluginsParams) (*TelegrafPlugins, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &GetScrapersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./telegraf/plugins") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ScraperTargetResponses - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + queryValues := queryURL.Query() + + if params.Type != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "type", runtime.ParamLocationQuery, *params.Type); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON200 = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParsePostScrapersResponse parses an HTTP response from a PostScrapersWithResponse call -func ParsePostScrapersResponse(rsp *http.Response) (*PostScrapersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &PostScrapersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ScraperTargetResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteScrapersIDResponse parses an HTTP response from a DeleteScrapersIDWithResponse call -func ParseDeleteScrapersIDResponse(rsp *http.Response) (*DeleteScrapersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteScrapersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &TelegrafPlugins{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetScrapersIDResponse parses an HTTP response from a GetScrapersIDWithResponse call -func ParseGetScrapersIDResponse(rsp *http.Response) (*GetScrapersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafs calls the GET on /telegrafs +// List all Telegraf configurations +func (c *Client) GetTelegrafs(ctx context.Context, params *GetTelegrafsParams) (*Telegrafs, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &GetScrapersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./telegrafs") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ScraperTargetResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + queryValues := queryURL.Query() - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.OrgID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParsePatchScrapersIDResponse parses an HTTP response from a PatchScrapersIDWithResponse call -func ParsePatchScrapersIDResponse(rsp *http.Response) (*PatchScrapersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &PatchScrapersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ScraperTargetResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetScrapersIDLabelsResponse parses an HTTP response from a GetScrapersIDLabelsWithResponse call -func ParseGetScrapersIDLabelsResponse(rsp *http.Response) (*GetScrapersIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetScrapersIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Telegrafs{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostScrapersIDLabelsResponse parses an HTTP response from a PostScrapersIDLabelsWithResponse call -func ParsePostScrapersIDLabelsResponse(rsp *http.Response) (*PostScrapersIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTelegrafs calls the POST on /telegrafs +// Create a Telegraf configuration +func (c *Client) PostTelegrafs(ctx context.Context, params *PostTelegrafsAllParams) (*Telegraf, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostScrapersIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./telegrafs") - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseDeleteScrapersIDLabelsIDResponse parses an HTTP response from a DeleteScrapersIDLabelsIDWithResponse call -func ParseDeleteScrapersIDLabelsIDResponse(rsp *http.Response) (*DeleteScrapersIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &DeleteScrapersIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json") - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetScrapersIDMembersResponse parses an HTTP response from a GetScrapersIDMembersWithResponse call -func ParseGetScrapersIDMembersResponse(rsp *http.Response) (*GetScrapersIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetScrapersIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Telegraf{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostScrapersIDMembersResponse parses an HTTP response from a PostScrapersIDMembersWithResponse call -func ParsePostScrapersIDMembersResponse(rsp *http.Response) (*PostScrapersIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteTelegrafsID calls the DELETE on /telegrafs/{telegrafID} +// Delete a Telegraf configuration +func (c *Client) DeleteTelegrafsID(ctx context.Context, params *DeleteTelegrafsIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) if err != nil { - return nil, err + return err } - response := &PostScrapersIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + operationPath := fmt.Sprintf("./telegrafs/%s", pathParam0) - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - return response, nil -} + if params.ZapTraceSpan != nil { + var headerParam0 string -// ParseDeleteScrapersIDMembersIDResponse parses an HTTP response from a DeleteScrapersIDMembersIDWithResponse call -func ParseDeleteScrapersIDMembersIDResponse(rsp *http.Response) (*DeleteScrapersIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - response := &DeleteScrapersIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + defer func() { _ = rsp.Body.Close() }() - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseGetScrapersIDOwnersResponse parses an HTTP response from a GetScrapersIDOwnersWithResponse call -func ParseGetScrapersIDOwnersResponse(rsp *http.Response) (*GetScrapersIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafsID calls the GET on /telegrafs/{telegrafID} +// Retrieve a Telegraf configuration +func (c *Client) GetTelegrafsID(ctx context.Context, params *GetTelegrafsIDAllParams) (*Telegraf, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) if err != nil { return nil, err } - response := &GetScrapersIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./telegrafs/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParsePostScrapersIDOwnersResponse parses an HTTP response from a PostScrapersIDOwnersWithResponse call -func ParsePostScrapersIDOwnersResponse(rsp *http.Response) (*PostScrapersIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &PostScrapersIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return nil, err + } + + req.Header.Set("Zap-Trace-Span", headerParam0) } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.Accept != nil { + var headerParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam1, err = runtime.StyleParamWithLocation("simple", false, "Accept", runtime.ParamLocationHeader, *params.Accept) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Accept", headerParam1) } - return response, nil -} - -// ParseDeleteScrapersIDOwnersIDResponse parses an HTTP response from a DeleteScrapersIDOwnersIDWithResponse call -func ParseDeleteScrapersIDOwnersIDResponse(rsp *http.Response) (*DeleteScrapersIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteScrapersIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &Telegraf{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetSetupResponse parses an HTTP response from a GetSetupWithResponse call -func ParseGetSetupResponse(rsp *http.Response) (*GetSetupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PutTelegrafsID calls the PUT on /telegrafs/{telegrafID} +// Update a Telegraf configuration +func (c *Client) PutTelegrafsID(ctx context.Context, params *PutTelegrafsIDAllParams) (*Telegraf, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetSetupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest IsOnboarding - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s", pathParam0) -// ParsePostSetupResponse parses an HTTP response from a PostSetupWithResponse call -func ParsePostSetupResponse(rsp *http.Response) (*PostSetupResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PostSetupResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest OnboardingResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostSigninResponse parses an HTTP response from a PostSigninWithResponse call -func ParsePostSigninResponse(rsp *http.Response) (*PostSigninResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostSigninResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON401 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON403 = &dest + response := &Telegraf{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostSignoutResponse parses an HTTP response from a PostSignoutWithResponse call -func ParsePostSignoutResponse(rsp *http.Response) (*PostSignoutResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafsIDLabels calls the GET on /telegrafs/{telegrafID}/labels +// List all labels for a Telegraf config +func (c *Client) GetTelegrafsIDLabels(ctx context.Context, params *GetTelegrafsIDLabelsAllParams) (*LabelsResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) if err != nil { return nil, err } - response := &PostSignoutResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON401 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/labels", pathParam0) -// ParseGetSourcesResponse parses an HTTP response from a GetSourcesWithResponse call -func ParseGetSourcesResponse(rsp *http.Response) (*GetSourcesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetSourcesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Sources - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostSourcesResponse parses an HTTP response from a PostSourcesWithResponse call -func ParsePostSourcesResponse(rsp *http.Response) (*PostSourcesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostSourcesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Source - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &LabelsResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteSourcesIDResponse parses an HTTP response from a DeleteSourcesIDWithResponse call -func ParseDeleteSourcesIDResponse(rsp *http.Response) (*DeleteSourcesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTelegrafsIDLabels calls the POST on /telegrafs/{telegrafID}/labels +// Add a label to a Telegraf config +func (c *Client) PostTelegrafsIDLabels(ctx context.Context, params *PostTelegrafsIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteSourcesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/labels", pathParam0) -// ParseGetSourcesIDResponse parses an HTTP response from a GetSourcesIDWithResponse call -func ParseGetSourcesIDResponse(rsp *http.Response) (*GetSourcesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetSourcesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Source - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchSourcesIDResponse parses an HTTP response from a PatchSourcesIDWithResponse call -func ParsePatchSourcesIDResponse(rsp *http.Response) (*PatchSourcesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchSourcesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Source - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &LabelResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetSourcesIDBucketsResponse parses an HTTP response from a GetSourcesIDBucketsWithResponse call -func ParseGetSourcesIDBucketsResponse(rsp *http.Response) (*GetSourcesIDBucketsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTelegrafsIDLabelsID calls the DELETE on /telegrafs/{telegrafID}/labels/{labelID} +// Delete a label from a Telegraf config +func (c *Client) DeleteTelegrafsIDLabelsID(ctx context.Context, params *DeleteTelegrafsIDLabelsIDAllParams) error { + var err error - response := &GetSourcesIDBucketsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Buckets - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return err + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/labels/%s", pathParam0, pathParam1) -// ParseGetSourcesIDHealthResponse parses an HTTP response from a GetSourcesIDHealthWithResponse call -func ParseGetSourcesIDHealthResponse(rsp *http.Response) (*GetSourcesIDHealthResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetSourcesIDHealthResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest HealthCheck - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 503: - var dest HealthCheck - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON503 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseListStacksResponse parses an HTTP response from a ListStacksWithResponse call -func ParseListStacksResponse(rsp *http.Response) (*ListStacksResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafsIDMembers calls the GET on /telegrafs/{telegrafID}/members +// List all users with member privileges for a Telegraf config +func (c *Client) GetTelegrafsIDMembers(ctx context.Context, params *GetTelegrafsIDMembersAllParams) (*ResourceMembers, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) if err != nil { return nil, err } - response := &ListStacksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Stacks *[]Stack `json:"stacks,omitempty"` - } - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/members", pathParam0) -// ParseCreateStackResponse parses an HTTP response from a CreateStackWithResponse call -func ParseCreateStackResponse(rsp *http.Response) (*CreateStackResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &CreateStackResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Stack - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteStackResponse parses an HTTP response from a DeleteStackWithResponse call -func ParseDeleteStackResponse(rsp *http.Response) (*DeleteStackResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteStackResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &ResourceMembers{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseReadStackResponse parses an HTTP response from a ReadStackWithResponse call -func ParseReadStackResponse(rsp *http.Response) (*ReadStackResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTelegrafsIDMembers calls the POST on /telegrafs/{telegrafID}/members +// Add a member to a Telegraf config +func (c *Client) PostTelegrafsIDMembers(ctx context.Context, params *PostTelegrafsIDMembersAllParams) (*ResourceMember, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &ReadStackResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Stack - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/members", pathParam0) -// ParseUpdateStackResponse parses an HTTP response from a UpdateStackWithResponse call -func ParseUpdateStackResponse(rsp *http.Response) (*UpdateStackResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &UpdateStackResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Stack - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseUninstallStackResponse parses an HTTP response from a UninstallStackWithResponse call -func ParseUninstallStackResponse(rsp *http.Response) (*UninstallStackResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &UninstallStackResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Stack - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &ResourceMember{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTasksResponse parses an HTTP response from a GetTasksWithResponse call -func ParseGetTasksResponse(rsp *http.Response) (*GetTasksResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTelegrafsIDMembersID calls the DELETE on /telegrafs/{telegrafID}/members/{userID} +// Remove a member from a Telegraf config +func (c *Client) DeleteTelegrafsIDMembersID(ctx context.Context, params *DeleteTelegrafsIDMembersIDAllParams) error { + var err error + + var pathParam0 string - response := &GetTasksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Tasks - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/members/%s", pathParam0, pathParam1) -// ParsePostTasksResponse parses an HTTP response from a PostTasksWithResponse call -func ParsePostTasksResponse(rsp *http.Response) (*PostTasksResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PostTasksResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Task - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseDeleteTasksIDResponse parses an HTTP response from a DeleteTasksIDWithResponse call -func ParseDeleteTasksIDResponse(rsp *http.Response) (*DeleteTasksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetTelegrafsIDOwners calls the GET on /telegrafs/{telegrafID}/owners +// List all owners of a Telegraf configuration +func (c *Client) GetTelegrafsIDOwners(ctx context.Context, params *GetTelegrafsIDOwnersAllParams) (*ResourceOwners, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) if err != nil { return nil, err } - response := &DeleteTasksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/owners", pathParam0) -// ParseGetTasksIDResponse parses an HTTP response from a GetTasksIDWithResponse call -func ParseGetTasksIDResponse(rsp *http.Response) (*GetTasksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetTasksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Task - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchTasksIDResponse parses an HTTP response from a PatchTasksIDWithResponse call -func ParsePatchTasksIDResponse(rsp *http.Response) (*PatchTasksIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchTasksIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Task - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &ResourceOwners{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTasksIDLabelsResponse parses an HTTP response from a GetTasksIDLabelsWithResponse call -func ParseGetTasksIDLabelsResponse(rsp *http.Response) (*GetTasksIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostTelegrafsIDOwners calls the POST on /telegrafs/{telegrafID}/owners +// Add an owner to a Telegraf configuration +func (c *Client) PostTelegrafsIDOwners(ctx context.Context, params *PostTelegrafsIDOwnersAllParams) (*ResourceOwner, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &GetTasksIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/owners", pathParam0) -// ParsePostTasksIDLabelsResponse parses an HTTP response from a PostTasksIDLabelsWithResponse call -func ParsePostTasksIDLabelsResponse(rsp *http.Response) (*PostTasksIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &PostTasksIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseDeleteTasksIDLabelsIDResponse parses an HTTP response from a DeleteTasksIDLabelsIDWithResponse call -func ParseDeleteTasksIDLabelsIDResponse(rsp *http.Response) (*DeleteTasksIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteTasksIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + response := &ResourceOwner{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTasksIDLogsResponse parses an HTTP response from a GetTasksIDLogsWithResponse call -func ParseGetTasksIDLogsResponse(rsp *http.Response) (*GetTasksIDLogsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteTelegrafsIDOwnersID calls the DELETE on /telegrafs/{telegrafID}/owners/{userID} +// Remove an owner from a Telegraf config +func (c *Client) DeleteTelegrafsIDOwnersID(ctx context.Context, params *DeleteTelegrafsIDOwnersIDAllParams) error { + var err error + + var pathParam0 string - response := &GetTasksIDLogsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "telegrafID", runtime.ParamLocationPath, params.TelegrafID) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Logs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./telegrafs/%s/owners/%s", pathParam0, pathParam1) -// ParseGetTasksIDMembersResponse parses an HTTP response from a GetTasksIDMembersWithResponse call -func ParseGetTasksIDMembersResponse(rsp *http.Response) (*GetTasksIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &GetTasksIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParsePostTasksIDMembersResponse parses an HTTP response from a PostTasksIDMembersWithResponse call -func ParsePostTasksIDMembersResponse(rsp *http.Response) (*PostTasksIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// ExportTemplate calls the POST on /templates/export +// Export a new template +func (c *Client) ExportTemplate(ctx context.Context, params *ExportTemplateAllParams) (*Template, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostTasksIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + operationPath := fmt.Sprintf("./templates/export") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - return response, nil -} + req.Header.Add("Content-Type", "application/json") -// ParseDeleteTasksIDMembersIDResponse parses an HTTP response from a DeleteTasksIDMembersIDWithResponse call -func ParseDeleteTasksIDMembersIDResponse(rsp *http.Response) (*DeleteTasksIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &DeleteTasksIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + response := &Template{} + + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTasksIDOwnersResponse parses an HTTP response from a GetTasksIDOwnersWithResponse call -func ParseGetTasksIDOwnersResponse(rsp *http.Response) (*GetTasksIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetUsers calls the GET on /users +// List users +func (c *Client) GetUsers(ctx context.Context, params *GetUsersParams) (*Users, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &GetTasksIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./users") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + queryValues := queryURL.Query() + + if params.Offset != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + if params.After != nil { -// ParsePostTasksIDOwnersResponse parses an HTTP response from a PostTasksIDOwnersWithResponse call -func ParsePostTasksIDOwnersResponse(rsp *http.Response) (*PostTasksIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "after", runtime.ParamLocationQuery, *params.After); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } - response := &PostTasksIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + if params.Name != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "name", runtime.ParamLocationQuery, *params.Name); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON201 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.Id != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "id", runtime.ParamLocationQuery, *params.Id); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParseDeleteTasksIDOwnersIDResponse parses an HTTP response from a DeleteTasksIDOwnersIDWithResponse call -func ParseDeleteTasksIDOwnersIDResponse(rsp *http.Response) (*DeleteTasksIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &DeleteTasksIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetTasksIDRunsResponse parses an HTTP response from a GetTasksIDRunsWithResponse call -func ParseGetTasksIDRunsResponse(rsp *http.Response) (*GetTasksIDRunsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetTasksIDRunsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Runs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Users{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostTasksIDRunsResponse parses an HTTP response from a PostTasksIDRunsWithResponse call -func ParsePostTasksIDRunsResponse(rsp *http.Response) (*PostTasksIDRunsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostUsers calls the POST on /users +// Create a user +func (c *Client) PostUsers(ctx context.Context, params *PostUsersAllParams) (*UserResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostTasksIDRunsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Run - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./users") - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseDeleteTasksIDRunsIDResponse parses an HTTP response from a DeleteTasksIDRunsIDWithResponse call -func ParseDeleteTasksIDRunsIDResponse(rsp *http.Response) (*DeleteTasksIDRunsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &DeleteTasksIDRunsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParseGetTasksIDRunsIDResponse parses an HTTP response from a GetTasksIDRunsIDWithResponse call -func ParseGetTasksIDRunsIDResponse(rsp *http.Response) (*GetTasksIDRunsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &GetTasksIDRunsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Run - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &UserResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTasksIDRunsIDLogsResponse parses an HTTP response from a GetTasksIDRunsIDLogsWithResponse call -func ParseGetTasksIDRunsIDLogsResponse(rsp *http.Response) (*GetTasksIDRunsIDLogsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteUsersID calls the DELETE on /users/{userID} +// Delete a user +func (c *Client) DeleteUsersID(ctx context.Context, params *DeleteUsersIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { - return nil, err + return err } - response := &GetTasksIDRunsIDLogsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Logs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./users/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return response, nil -} - -// ParsePostTasksIDRunsIDRetryResponse parses an HTTP response from a PostTasksIDRunsIDRetryWithResponse call -func ParsePostTasksIDRunsIDRetryResponse(rsp *http.Response) (*PostTasksIDRunsIDRetryResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - response := &PostTasksIDRunsIDRetryResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Run - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseGetTelegrafPluginsResponse parses an HTTP response from a GetTelegrafPluginsWithResponse call -func ParseGetTelegrafPluginsResponse(rsp *http.Response) (*GetTelegrafPluginsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetUsersID calls the GET on /users/{userID} +// Retrieve a user +func (c *Client) GetUsersID(ctx context.Context, params *GetUsersIDAllParams) (*UserResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { return nil, err } - response := &GetTelegrafPluginsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest TelegrafPlugins - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./users/%s", pathParam0) -// ParseGetTelegrafsResponse parses an HTTP response from a GetTelegrafsWithResponse call -func ParseGetTelegrafsResponse(rsp *http.Response) (*GetTelegrafsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetTelegrafsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Telegrafs - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostTelegrafsResponse parses an HTTP response from a PostTelegrafsWithResponse call -func ParsePostTelegrafsResponse(rsp *http.Response) (*PostTelegrafsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostTelegrafsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Telegraf - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &UserResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteTelegrafsIDResponse parses an HTTP response from a DeleteTelegrafsIDWithResponse call -func ParseDeleteTelegrafsIDResponse(rsp *http.Response) (*DeleteTelegrafsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PatchUsersID calls the PATCH on /users/{userID} +// Update a user +func (c *Client) PatchUsersID(ctx context.Context, params *PatchUsersIDAllParams) (*UserResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) if err != nil { return nil, err } - response := &DeleteTelegrafsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./users/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseGetTelegrafsIDResponse parses an HTTP response from a GetTelegrafsIDWithResponse call -func ParseGetTelegrafsIDResponse(rsp *http.Response) (*GetTelegrafsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &GetTelegrafsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json") - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Telegraf - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - case rsp.StatusCode == 200: - // Content-type (application/toml) unsupported - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePutTelegrafsIDResponse parses an HTTP response from a PutTelegrafsIDWithResponse call -func ParsePutTelegrafsIDResponse(rsp *http.Response) (*PutTelegrafsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PutTelegrafsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Telegraf - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &UserResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseGetTelegrafsIDLabelsResponse parses an HTTP response from a GetTelegrafsIDLabelsWithResponse call -func ParseGetTelegrafsIDLabelsResponse(rsp *http.Response) (*GetTelegrafsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostUsersIDPassword calls the POST on /users/{userID}/password +// Update a password +func (c *Client) PostUsersIDPassword(ctx context.Context, params *PostUsersIDPasswordAllParams) error { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { - return nil, err - } - - response := &GetTelegrafsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + return err } + bodyReader = bytes.NewReader(buf) - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "userID", runtime.ParamLocationPath, params.UserID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./users/%s/password", pathParam0) -// ParsePostTelegrafsIDLabelsResponse parses an HTTP response from a PostTelegrafsIDLabelsWithResponse call -func ParsePostTelegrafsIDLabelsResponse(rsp *http.Response) (*PostTelegrafsIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PostTelegrafsIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + if params.ZapTraceSpan != nil { + var headerParam0 string + + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + req.Header.Set("Zap-Trace-Span", headerParam0) + } + + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } + + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseDeleteTelegrafsIDLabelsIDResponse parses an HTTP response from a DeleteTelegrafsIDLabelsIDWithResponse call -func ParseDeleteTelegrafsIDLabelsIDResponse(rsp *http.Response) (*DeleteTelegrafsIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetVariables calls the GET on /variables +// List all variables +func (c *Client) GetVariables(ctx context.Context, params *GetVariablesParams) (*Variables, error) { + var err error + + serverURL, err := url.Parse(c.APIEndpoint) if err != nil { return nil, err } - response := &DeleteTelegrafsIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + operationPath := fmt.Sprintf("./variables") + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + queryValues := queryURL.Query() + + if params.Org != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "org", runtime.ParamLocationQuery, *params.Org); err != nil { return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSON404 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + } + + if params.OrgID != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "orgID", runtime.ParamLocationQuery, *params.OrgID); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } } - return response, nil -} + queryURL.RawQuery = queryValues.Encode() -// ParseGetTelegrafsIDMembersResponse parses an HTTP response from a GetTelegrafsIDMembersWithResponse call -func ParseGetTelegrafsIDMembersResponse(rsp *http.Response) (*GetTelegrafsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - response := &GetTelegrafsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceMembers - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostTelegrafsIDMembersResponse parses an HTTP response from a PostTelegrafsIDMembersWithResponse call -func ParsePostTelegrafsIDMembersResponse(rsp *http.Response) (*PostTelegrafsIDMembersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostTelegrafsIDMembersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceMember - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &Variables{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteTelegrafsIDMembersIDResponse parses an HTTP response from a DeleteTelegrafsIDMembersIDWithResponse call -func ParseDeleteTelegrafsIDMembersIDResponse(rsp *http.Response) (*DeleteTelegrafsIDMembersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostVariables calls the POST on /variables +// Create a variable +func (c *Client) PostVariables(ctx context.Context, params *PostVariablesAllParams) (*Variable, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteTelegrafsIDMembersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./variables") - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err } - return response, nil -} - -// ParseGetTelegrafsIDOwnersResponse parses an HTTP response from a GetTelegrafsIDOwnersWithResponse call -func ParseGetTelegrafsIDOwnersResponse(rsp *http.Response) (*GetTelegrafsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) if err != nil { return nil, err } - response := &GetTelegrafsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + req.Header.Add("Content-Type", "application/json") - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest ResourceOwners - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostTelegrafsIDOwnersResponse parses an HTTP response from a PostTelegrafsIDOwnersWithResponse call -func ParsePostTelegrafsIDOwnersResponse(rsp *http.Response) (*PostTelegrafsIDOwnersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostTelegrafsIDOwnersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest ResourceOwner - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &Variable{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteTelegrafsIDOwnersIDResponse parses an HTTP response from a DeleteTelegrafsIDOwnersIDWithResponse call -func ParseDeleteTelegrafsIDOwnersIDResponse(rsp *http.Response) (*DeleteTelegrafsIDOwnersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// DeleteVariablesID calls the DELETE on /variables/{variableID} +// Delete a variable +func (c *Client) DeleteVariablesID(ctx context.Context, params *DeleteVariablesIDAllParams) error { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) if err != nil { - return nil, err + return err } - response := &DeleteTelegrafsIDOwnersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + operationPath := fmt.Sprintf("./variables/%s", pathParam0) - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return err } - return response, nil -} - -// ParseApplyTemplateResponse parses an HTTP response from a ApplyTemplateWithResponse call -func ParseApplyTemplateResponse(rsp *http.Response) (*ApplyTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { - return nil, err + return err } - response := &ApplyTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + if params.ZapTraceSpan != nil { + var headerParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest TemplateSummary - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest TemplateSummary - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + defer func() { _ = rsp.Body.Close() }() + + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } -// ParseExportTemplateResponse parses an HTTP response from a ExportTemplateWithResponse call -func ParseExportTemplateResponse(rsp *http.Response) (*ExportTemplateResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetVariablesID calls the GET on /variables/{variableID} +// Retrieve a variable +func (c *Client) GetVariablesID(ctx context.Context, params *GetVariablesIDAllParams) (*Variable, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) if err != nil { return nil, err } - response := &ExportTemplateResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Template - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "yaml") && rsp.StatusCode == 200: - var dest Template - if err := yaml.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.YAML200 = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s", pathParam0) -// ParseGetUsersResponse parses an HTTP response from a GetUsersWithResponse call -func ParseGetUsersResponse(rsp *http.Response) (*GetUsersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetUsersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Users - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostUsersResponse parses an HTTP response from a PostUsersWithResponse call -func ParsePostUsersResponse(rsp *http.Response) (*PostUsersResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostUsersResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest UserResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &Variable{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteUsersIDResponse parses an HTTP response from a DeleteUsersIDWithResponse call -func ParseDeleteUsersIDResponse(rsp *http.Response) (*DeleteUsersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PatchVariablesID calls the PATCH on /variables/{variableID} +// Update a variable +func (c *Client) PatchVariablesID(ctx context.Context, params *PatchVariablesIDAllParams) (*Variable, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &DeleteUsersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s", pathParam0) -// ParseGetUsersIDResponse parses an HTTP response from a GetUsersIDWithResponse call -func ParseGetUsersIDResponse(rsp *http.Response) (*GetUsersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetUsersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PATCH", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest UserResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchUsersIDResponse parses an HTTP response from a PatchUsersIDWithResponse call -func ParsePatchUsersIDResponse(rsp *http.Response) (*PatchUsersIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchUsersIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest UserResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &Variable{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePostUsersIDPasswordResponse parses an HTTP response from a PostUsersIDPasswordWithResponse call -func ParsePostUsersIDPasswordResponse(rsp *http.Response) (*PostUsersIDPasswordResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PutVariablesID calls the PUT on /variables/{variableID} +// Replace a variable +func (c *Client) PutVariablesID(ctx context.Context, params *PutVariablesIDAllParams) (*Variable, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PostUsersIDPasswordResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } + var pathParam0 string - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s", pathParam0) -// ParseGetVariablesResponse parses an HTTP response from a GetVariablesWithResponse call -func ParseGetVariablesResponse(rsp *http.Response) (*GetVariablesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetVariablesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("PUT", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Variables - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostVariablesResponse parses an HTTP response from a PostVariablesWithResponse call -func ParsePostVariablesResponse(rsp *http.Response) (*PostVariablesResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostVariablesResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Variable - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &Variable{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteVariablesIDResponse parses an HTTP response from a DeleteVariablesIDWithResponse call -func ParseDeleteVariablesIDResponse(rsp *http.Response) (*DeleteVariablesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// GetVariablesIDLabels calls the GET on /variables/{variableID}/labels +// List all labels for a variable +func (c *Client) GetVariablesIDLabels(ctx context.Context, params *GetVariablesIDLabelsAllParams) (*LabelsResponse, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) if err != nil { return nil, err } - response := &DeleteVariablesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest - - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s/labels", pathParam0) -// ParseGetVariablesIDResponse parses an HTTP response from a GetVariablesIDWithResponse call -func ParseGetVariablesIDResponse(rsp *http.Response) (*GetVariablesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetVariablesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Variable - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePatchVariablesIDResponse parses an HTTP response from a PatchVariablesIDWithResponse call -func ParsePatchVariablesIDResponse(rsp *http.Response) (*PatchVariablesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PatchVariablesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Variable - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + response := &LabelsResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 200: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParsePutVariablesIDResponse parses an HTTP response from a PutVariablesIDWithResponse call -func ParsePutVariablesIDResponse(rsp *http.Response) (*PutVariablesIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +// PostVariablesIDLabels calls the POST on /variables/{variableID}/labels +// Add a label to a variable +func (c *Client) PostVariablesIDLabels(ctx context.Context, params *PostVariablesIDLabelsAllParams) (*LabelResponse, error) { + var err error + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) if err != nil { return nil, err } + bodyReader = bytes.NewReader(buf) - response := &PutVariablesIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, - } - - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Variable - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + var pathParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) + if err != nil { + return nil, err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return nil, err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s/labels", pathParam0) -// ParseGetVariablesIDLabelsResponse parses an HTTP response from a GetVariablesIDLabelsWithResponse call -func ParseGetVariablesIDLabelsResponse(rsp *http.Response) (*GetVariablesIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } - response := &GetVariablesIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("POST", queryURL.String(), bodyReader) + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest LabelsResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest + req.Header.Add("Content-Type", "application/json") + + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { return nil, err } - response.JSONDefault = &dest - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + req.Header.Set("Zap-Trace-Span", headerParam0) } - return response, nil -} - -// ParsePostVariablesIDLabelsResponse parses an HTTP response from a PostVariablesIDLabelsWithResponse call -func ParsePostVariablesIDLabelsResponse(rsp *http.Response) (*PostVariablesIDLabelsResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) if err != nil { return nil, err } + bodyBytes, err := ioutil.ReadAll(rsp.Body) - response := &PostVariablesIDLabelsResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest LabelResponse - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest + response := &LabelResponse{} - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { + switch rsp.StatusCode { + case 201: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { return nil, err } - response.JSONDefault = &dest - - // Fallback for unexpected error default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + return nil, decodeError(bodyBytes, rsp) } - return response, nil + } -// ParseDeleteVariablesIDLabelsIDResponse parses an HTTP response from a DeleteVariablesIDLabelsIDWithResponse call -func ParseDeleteVariablesIDLabelsIDResponse(rsp *http.Response) (*DeleteVariablesIDLabelsIDResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() - if err != nil { - return nil, err - } +// DeleteVariablesIDLabelsID calls the DELETE on /variables/{variableID}/labels/{labelID} +// Delete a label from a variable +func (c *Client) DeleteVariablesIDLabelsID(ctx context.Context, params *DeleteVariablesIDLabelsIDAllParams) error { + var err error + + var pathParam0 string - response := &DeleteVariablesIDLabelsIDResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "variableID", runtime.ParamLocationPath, params.VariableID) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + var pathParam1 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "labelID", runtime.ParamLocationPath, params.LabelID) + if err != nil { + return err + } - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + serverURL, err := url.Parse(c.APIEndpoint) + if err != nil { + return err } - return response, nil -} + operationPath := fmt.Sprintf("./variables/%s/labels/%s", pathParam0, pathParam1) -// ParsePostWriteResponse parses an HTTP response from a PostWriteWithResponse call -func ParsePostWriteResponse(rsp *http.Response) (*PostWriteResponse, error) { - bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + queryURL, err := serverURL.Parse(operationPath) if err != nil { - return nil, err + return err } - response := &PostWriteResponse{ - Body: bodyBytes, - HTTPResponse: rsp, + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return err } - switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest LineProtocolError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON400 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON401 = &dest - - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON404 = &dest + if params.ZapTraceSpan != nil { + var headerParam0 string - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 413: - var dest LineProtocolLengthError - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err + headerParam0, err = runtime.StyleParamWithLocation("simple", false, "Zap-Trace-Span", runtime.ParamLocationHeader, *params.ZapTraceSpan) + if err != nil { + return err } - response.JSON413 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON500 = &dest + req.Header.Set("Zap-Trace-Span", headerParam0) + } - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && true: - var dest Error - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSONDefault = &dest + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return err + } - case rsp.StatusCode == 413: - // Content-type (text/html) unsupported + defer func() { _ = rsp.Body.Close() }() - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err } + return decodeError(bodyBytes, rsp) } + return nil - return response, nil } + +/* + + */ diff --git a/domain/oss.yml b/domain/oss.yml index eb891a19..bb966ba6 100644 --- a/domain/oss.yml +++ b/domain/oss.yml @@ -7,28 +7,152 @@ info: servers: - url: /api/v2 tags: - - name: Authentication + - name: Authorizations + description: | + Create and manage _API tokens_. + An _authorization_ contains a list of `read` and `write` + permissions for organization resources and provides an API token for authentication. + An authorization belongs to an organization and only contains permissions for that organization. + + An authorization is only visible to the user that created it. + Optionally, when creating an authorization, you can scope it to a specific user. + A _user session_ carries all the permissions granted by all the user's authorizations. + To create a user session, use the [`POST /api/v2/signin`](#operation/PostSignin) endpoint. + + ### Related endpoints + + - [Signin](#tag/Signin) + - [Signout](#tag/Signout) + + ### Related guides + + - [Authorize API requests](https://docs.influxdata.com/influxdb/v2.3/api-guide/api_intro/#authentication). + - [Manage API tokens](https://docs.influxdata.com/influxdb/v2.3/security/tokens/). + - [Assign a token to a specific user](https://docs.influxdata.com/influxdb/v2.3/security/tokens/create-token/). + - name: Buckets + description: | + Store your data in InfluxDB [buckets](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#bucket). + A bucket is a named location where time series data is stored. All buckets + have a [retention period](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#retention-period), + a duration of time that each data point persists. InfluxDB drops all + points with timestamps older than the bucket’s retention period. + A bucket belongs to an organization. + + ### Related guides + + - [Manage buckets](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/) + - name: Debug + description: | + Generate profiling and trace reports. + + Use routes under `/debug/pprof` to analyze the Go runtime of InfluxDB. + These endpoints generate [Go runtime profiles](https://pkg.go.dev/runtime/pprof) + and **trace** reports. + **Profiles** are collections of stack traces that show call sequences + leading to instances of a particular event, such as allocation. + + For more information about **pprof profile** and **trace** reports, + see the following resources: + - [Google pprof tool](https://github.com/google/pprof) + - [Golang diagnostics](https://go.dev/doc/diagnostics) + - name: Delete + description: | + Delete data from an InfluxDB bucket. + - name: Query description: | - The InfluxDB `/api/v2` API requires authentication for all requests. - Use InfluxDB API tokens to authenticate requests to the `/api/v2` API. + Retrieve data, analyze queries, and get query suggestions. + - name: Tasks + description: | + Process and analyze your data with tasks in the InfluxDB task engine. + With tasks, you can schedule Flux scripts to query, analyze, modify, and act on data. + + Use the `/api/v2/tasks` endpoints to create and manage tasks, retry task runs, and retrieve run logs. + + #### Related guides + + - [Get started with tasks](https://docs.influxdata.com/influxdb/v2.3/process-data/get-started/) + - [Common data processing tasks](https://docs.influxdata.com/influxdb/v2.3/process-data/common-tasks/) + - name: Templates + description: | + Export and apply InfluxDB **templates**. + Manage **stacks** of templated InfluxDB resources. + + InfluxDB templates are prepackaged configurations for + everything from dashboards and Telegraf to notifications and alerts. + Use InfluxDB templates to quickly configure a fresh instance of InfluxDB, + back up your dashboard configuration, or share your configuration with the + InfluxData community. + + Use the `/api/v2/templates` endpoints to export templates and apply templates. + **InfluxDB stacks** are stateful InfluxDB templates that let you + add, update, and remove installed template resources over time, avoid duplicating + resources when applying the same or similar templates more than once, and + apply changes to distributed instances of InfluxDB OSS or InfluxDB Cloud. - For examples and more information, see - [Token authentication](#section/Authentication/TokenAuthentication) + Use the `/api/v2/stacks` endpoints to manage installed template resources. + #### Related guides + + - [InfluxDB stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) + - [InfluxDB templates](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/) + - name: Write + description: | + Write time series data to buckets. + - name: Authentication + description: | + Use one of the following schemes to authenticate to the InfluxDB API: + + - [Token authentication](#section/Authentication/TokenAuthentication) + - [Basic authentication](#section/Authentication/BasicAuthentication) + - [Querystring authentication](#section/Authentication/QuerystringAuthentication) x-traitTag: true - name: Quick start x-traitTag: true description: | - See the [**API Quick Start**](https://docs.influxdata.com/influxdb/v2.1/api-guide/api_intro/) to get up and running authenticating with tokens, writing to buckets, and querying data. + See the [**API Quick Start**](https://docs.influxdata.com/influxdb/v2.3/api-guide/api_intro/) + to get up and running authenticating with tokens, writing to buckets, and querying data. + + [**InfluxDB API client libraries**](https://docs.influxdata.com/influxdb/v2.3/api-guide/client-libraries/) + are available for popular languages and ready to import into your application. + - name: Common parameters + x-traitTag: true + description: | + Many InfluxDB API endpoints require parameters to specify resources--for example, + writing to a **bucket** in an **organization**. + + ### Common query parameters + + | Query parameter | Value type | Description | + |:------------------------ |:--------------------- |:-------------------------------------------| + | `bucket` | string | The bucket name or ID ([find your bucket](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/view-buckets/). | + | `bucketID` | string | The bucket ID ([find your bucket](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/view-buckets/). | + | `org` | string | The organization name or ID ([find your organization](https://docs.influxdata.com/influxdb/v2.3/organizations/view-orgs/). | + | `orgID` | 16-byte string | The organization ID ([find your organization](https://docs.influxdata.com/influxdb/v2.3/organizations/view-orgs/). | + - name: Headers + x-traitTag: true + description: | + InfluxDB API endpoints use standard HTTP request and response headers. + + **Note**: Not all operations support all headers. + + ### Request headers - [**InfluxDB API client libraries**](https://docs.influxdata.com/influxdb/v2.1/api-guide/client-libraries/) are available for popular languages and ready to import into your application. + | Header | Value type | Description | + |:------------------------ |:--------------------- |:-------------------------------------------| + | `Accept` | string | The content type that the client can understand. | + | `Authorization` | string | The authorization scheme and credential. | + | `Content-Encoding` | string | The compression applied to the line protocol in the request payload. | + | `Content-Length` | integer | The size of the entity-body, in bytes, sent to the database. | + | `Content-Type` | string | The format of the data in the request body. | - name: Response codes x-traitTag: true description: | - The InfluxDB API uses standard HTTP status codes for success and failure responses. - The response body may include additional details. For details about a specific operation's response, see **Responses** and **Response Samples** for that operation. + InfluxDB API endpoints use standard HTTP status codes for success and failure responses. + The response body may include additional details. + For details about a specific operation's response, + see **Responses** and **Response Samples** for that operation. API operations may return the following HTTP status codes: @@ -36,96 +160,28 @@ tags: |:-----------:|:------------------------ |:--------------------- | | `200` | Success | | | `204` | No content | For a `POST` request, `204` indicates that InfluxDB accepted the request and request data is valid. Asynchronous operations, such as `write`, might not have completed yet. | - | `400` | Bad request | `Authorization` header is missing or malformed or the API token does not have permission for the operation. | - | `401` | Unauthorized | May indicate one of the following:
  • `Authorization: Token` header is missing or malformed
  • API token value is missing from the header
  • API token does not have permission. For more information about token types and permissions, see [Manage API tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/)
  • | + | `400` | Bad request | May indicate one of the following: | + | `401` | Unauthorized | May indicate one of the following: | | `404` | Not found | Requested resource was not found. `message` in the response body provides details about the requested resource. | | `413` | Request entity too large | Request payload exceeds the size limit. | - | `422` | Unprocessible entity | Request data is invalid. `code` and `message` in the response body provide details about the problem. | + | `422` | Unprocessable entity | Request data is invalid. `code` and `message` in the response body provide details about the problem. | | `429` | Too many requests | API token is temporarily over the request quota. The `Retry-After` header describes when to try the request again. | | `500` | Internal server error | | | `503` | Service unavailable | Server is temporarily unavailable to process the request. The `Retry-After` header describes when to try the request again. | - - name: Query - description: | - Retrieve data, analyze queries, and get query suggestions. - - name: Write - description: | - Write time series data to buckets. - - name: Authorizations - description: | - Create and manage API tokens. An **authorization** associates a list of permissions to an **organization** and provides a token for API access. Optionally, you can restrict an authorization and its token to a specific user. - - For more information and examples, see the following: - - [Authorize API requests](https://docs.influxdata.com/influxdb/v2.1/api-guide/api_intro/#authentication). - - [Manage API tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/). - - [Assign a token to a specific user](https://docs.influxdata.com/influxdb/v2.1/security/tokens/create-token/). x-tagGroups: - name: Overview tags: - Quick start - Authentication + - Headers - Response codes - - name: Data I/O endpoints - tags: - - Write - - Query - - name: Resource endpoints - tags: - - Buckets - - Dashboards - - Tasks - - Resources - - name: Security and access endpoints - tags: - - Authorizations - - Organizations - - Users - - name: System information endpoints + - name: Popular endpoints tags: - - Health - - Metrics - - Ping - - Ready - - Routes + - Data I/O endpoints + - Security and access endpoints + - System information endpoints - name: All endpoints - tags: - - Authorizations - - Backup - - Buckets - - Cells - - Checks - - Config - - DBRPs - - Dashboards - - Delete - - Health - - Metrics - - Labels - - Legacy Authorizations - - NotificationEndpoints - - NotificationRules - - Organizations - - Ping - - Query - - Ready - - RemoteConnections - - Replications - - Resources - - Restore - - Routes - - Rules - - Scraper Targets - - Secrets - - Setup - - Signin - - Signout - - Sources - - Tasks - - Telegraf Plugins - - Telegrafs - - Templates - - Users - - Variables - - Write + tags: [] paths: /signin: post: @@ -186,14 +242,18 @@ paths: /ping: get: operationId: GetPing - summary: Checks the status of InfluxDB instance and version of InfluxDB. + summary: Get the status and version of the instance + description: Returns the status and InfluxDB version of the instance. servers: - url: '' tags: - Ping + - System information endpoints responses: '204': - description: OK + description: | + OK. + Headers contain InfluxDB version information. headers: X-Influxdb-Build: schema: @@ -205,14 +265,17 @@ paths: description: The version of InfluxDB. head: operationId: HeadPing - summary: Checks the status of InfluxDB instance and version of InfluxDB. + summary: Get the status and version of the instance + description: Returns the status and InfluxDB version of the instance. servers: - url: '' tags: - Ping responses: '204': - description: OK + description: | + OK. + Headers contain InfluxDB version information. headers: X-Influxdb-Build: schema: @@ -228,6 +291,7 @@ paths: summary: List all top level routes tags: - Routes + - System information endpoints parameters: - $ref: '#/components/parameters/TraceSpan' responses: @@ -1023,152 +1087,256 @@ paths: post: operationId: PostWrite tags: + - Data I/O endpoints - Write summary: Write data description: | Writes data to a bucket. - To write data into InfluxDB, you need the following: + Use this endpoint to send data in [line protocol](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/line-protocol/) format to InfluxDB. - - **organization name or ID** – _See [View organizations](https://docs.influxdata.com/influxdb/v2.1/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._ - - **bucket** – _See [View buckets](https://docs.influxdata.com/influxdb/v2.1/organizations/buckets/view-buckets/) for - instructions on viewing your bucket ID._ - - **API token** – _See [View tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/view-tokens/) - for instructions on viewing your API token._ - - **InfluxDB URL** – _See [InfluxDB URLs](https://docs.influxdata.com/influxdb/v2.1/reference/urls/)_. - - data in [line protocol](https://docs.influxdata.com/influxdb/v2.1/reference/syntax/line-protocol) format. + #### InfluxDB Cloud - InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. + - Takes the following steps when you send a write request: - For more information and examples, see the following: - - [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.1/write-data/developer-tools/api). - - [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/v2.1/write-data/best-practices/optimize-writes/). + 1. Validates the request and queues the write. + 2. If the write is queued, responds with an HTTP `204` status code. + 3. Handles the write asynchronously and reaches eventual consistency. + + An HTTP `2xx` status code acknowledges that the write or delete is queued. + To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, + wait for a response before you send the next request. + + Because writes are asynchronous, data might not yet be written + when you receive the response. + + #### InfluxDB OSS + + - Validates the request, handles the write synchronously, + and then responds with success or failure. + - If all points were written successfully, responds with HTTP `204` status code; + otherwise, returns the first line that failed. + + #### Required permissions + + - `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + + #### Rate limits (with InfluxDB Cloud) + + `write` rate limits apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides + + - [Write data with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.3/write-data/developer-tools/api). + - [Optimize writes to InfluxDB](https://docs.influxdata.com/influxdb/v2.3/write-data/best-practices/optimize-writes/). + - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.3/write-data/troubleshoot/) requestBody: - description: Data in line protocol format. + description: | + Data in line protocol format. + + To send compressed data, do the following: + + 1. Use [GZIP](https://www.gzip.org/) to compress the line protocol data. + 2. In your request, send the compressed data and the + `Content-Encoding: gzip` header. + + #### Related guides + + - [Best practices for optimizing writes](https://docs.influxdata.com/influxdb/v2.3/write-data/best-practices/optimize-writes/). required: true content: text/plain: schema: type: string format: byte + examples: + plain-utf8: + value: | + airSensors,sensor_id=TLM0201 temperature=73.97038159354763,humidity=35.23103248356096,co=0.48445310567793615 1630424257000000000 + airSensors,sensor_id=TLM0202 temperature=75.30007505999716,humidity=35.651929918691714,co=0.5141876544505826 1630424257000000000 parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Content-Encoding description: | - The value tells InfluxDB what compression is applied to the line protocol in the request payload. - To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. + The compression applied to the line protocol in the request payload. + To send a GZIP payload, pass `Content-Encoding: gzip` header. schema: type: string - description: 'The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data.' + description: | + Content coding. + Use `gzip` for compressed data or `identity` for unmodified, uncompressed data. default: identity enum: - gzip - identity - in: header name: Content-Type - description: The header value indicates the format of the data in the request body. + description: | + The format of the data in the request body. + To send a line protocol payload, pass `Content-Type: text/plain; charset=utf-8`. schema: type: string description: | - `text/plain` specifies line protocol. `UTF-8` is the default character set. + `text/plain` is the content type for line protocol. `UTF-8` is the default character set. default: text/plain; charset=utf-8 enum: - text/plain - text/plain; charset=utf-8 - - application/vnd.influx.arrow - in: header name: Content-Length - description: 'The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database''s `max body` configuration option, the server responds with status code `413`.' + description: | + The size of the entity-body, in bytes, sent to InfluxDB. + If the length is greater than the `max body` configuration option, + the server responds with status code `413`. schema: type: integer description: The length in decimal number of octets. - in: header name: Accept - description: The header value specifies the response format. + description: | + The content type that the client can understand. + Writes only return a response body if they fail--for example, + due to a formatting problem or quota limit. + + #### InfluxDB Cloud + + - Returns only `application/json` for format and limit errors. + - Returns only `text/html` for some quota limit errors. + + #### InfluxDB OSS + + - Returns only `application/json` for format and limit errors. + + #### Related guides + - [Troubleshoot issues writing data](https://docs.influxdata.com/influxdb/v2.3/write-data/troubleshoot/). schema: type: string - description: The response format for errors. + description: Error content type. default: application/json enum: - application/json - in: query name: org - description: 'The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both `orgID` and `org` parameters, `org` takes precedence.' + description: | + The destination organization for writes. + InfluxDB writes all points in the batch to this organization. + If you pass both `orgID` and `org`, they must both be valid. + + #### InfluxDB Cloud + + - Doesn't require `org` or `orgID`. + - Writes to the bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. + - InfluxDB writes all points in the batch to this organization. required: true schema: type: string - description: Organization name or ID. + description: The organization name or ID. - in: query name: orgID - description: 'The parameter value specifies the ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence.' + description: | + The ID of the destination organization for writes. + If you pass both `orgID` and `org`, they must both be valid. + + #### InfluxDB Cloud + + - Doesn't require `org` or `orgID`. + - Writes to the bucket in the organization associated with the authorization (API token). + + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. + - InfluxDB writes all points in the batch to this organization. schema: type: string - in: query name: bucket - description: The destination bucket for writes. + description: | + The destination bucket for writes. + InfluxDB writes all points in the batch to this bucket. required: true schema: type: string - description: All points within batch are written to this bucket. + description: The bucket name or ID. - in: query name: precision - description: The precision for the unix timestamps within the body line-protocol. + description: The precision for unix timestamps in the line protocol batch. schema: $ref: '#/components/schemas/WritePrecision' responses: '204': - description: 'InfluxDB validated the request data format and accepted the data for writing to the bucket. `204` doesn''t indicate a successful write operation since writes are asynchronous. See [how to check for write errors](https://docs.influxdata.com/influxdb/v2.1/write-data/troubleshoot/).' + description: | + Success. + + #### InfluxDB Cloud + + - Validated and queued the request. + - Handles the write asynchronously - the write might not have completed yet. + + #### InfluxDB OSS + + - Successfully wrote all points in the batch. + + #### Related guides + + - [How to check for write errors](https://docs.influxdata.com/influxdb/v2.3/write-data/troubleshoot/). '400': - description: Bad request. The line protocol data in the request is malformed. The response body contains the first malformed line in the data. InfluxDB rejected the batch and did not write any data. + description: | + Bad request. The response body contains detail about the error. + + InfluxDB returns this error if the line protocol data in the request is malformed. + The response body contains the first malformed line in the data, and indicates what was expected. + For partial writes, the number of points written and the number of points rejected are also included. + For more information, check the `rejected_points` measurement in your `_monitoring` bucket. + + #### InfluxDB Cloud + + - Returns this error for bucket schema conflicts. + + #### InfluxDB OSS + + - Returns this error if `org` or `orgID` doesn't match an organization. content: application/json: schema: $ref: '#/components/schemas/LineProtocolError' examples: measurementSchemaFieldTypeConflict: - summary: Field type conflict thrown by an explicit bucket schema + summary: (Cloud) field type conflict thrown by an explicit bucket schema value: code: invalid message: 'partial write error (2 written): unable to parse ''air_sensor,service=S1,sensor=L1 temperature="90.5",humidity=70.0 1632850122'': schema: field type for field "temperature" not permitted by schema; got String but expected Float' - '401': - description: | - Unauthorized. The error may indicate one of the following: - * The `Authorization: Token` header is missing or malformed. - * The API token value is missing from the header. - * The token does not have sufficient permissions to write to this organization and bucket. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - tokenNotAuthorized: - summary: Token is not authorized to access the organization or resource + orgNotFound: + summary: (OSS) organization not found value: - code: unauthorized - message: unauthorized access + code: invalid + message: 'failed to decode request body: organization not found' + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: 'Not found. A requested resource was not found. The response body contains the requested resource type, e.g. `organization name` or `bucket`, and name.' - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - resource-not-found: - summary: Not found error - value: - code: not found - message: bucket "air_sensor" not found + $ref: '#/components/responses/ResourceNotFoundError' '413': description: | - The request payload is too large. InfluxDB rejected the batch and did not write any data. + The request payload is too large. + InfluxDB rejected the batch and did not write any data. + #### InfluxDB Cloud: - - returns this error if the payload exceeds the 50MB size limit. - - returns `Content-Type: text/html` for this error. + + - Returns this error if the payload exceeds the 50MB size limit. + - Returns `Content-Type: text/html` for this error. #### InfluxDB OSS: - - returns this error only if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error. - - returns `Content-Type: application/json` for this error. + + - Returns this error only if the [Go (golang) `ioutil.ReadAll()`](https://pkg.go.dev/io/ioutil#ReadAll) function raises an error. + - Returns `Content-Type: application/json` for this error. content: application/json: schema: @@ -1194,42 +1362,112 @@ paths: '429': - description: InfluxDB Cloud only. The token is temporarily over quota. The Retry-After header describes when to try the write again. + description: | + Too many requests. + + #### InfluxDB Cloud + + - Returns this error if a **read** or **write** request exceeds your plan's [adjustable service quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#adjustable-service-quotas) + or if a **delete** request exceeds the maximum [global limit](https://docs.influxdata.com/influxdb/cloud/account-management/limits/#global-limits). + - For rate limits that reset automatically, returns a `Retry-After` header that describes when to try the write again. + - For limits that can't reset (for example, **cardinality limit**), doesn't return a `Retry-After` header. + + Rates (data-in (writes), queries (reads), and deletes) accrue within a fixed five-minute window. + Once a rate limit is exceeded, InfluxDB returns an error response until the current five-minute window resets. + + #### InfluxDB OSS + + - Doesn't return this error. headers: Retry-After: - description: A non-negative decimal integer indicating the seconds to delay after the response is received. + description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 '500': - description: Internal server error. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - internalError: - summary: Internal error example - value: - code: internal error + $ref: '#/components/responses/InternalServerError' '503': - description: The server is temporarily unavailable to accept writes. The `Retry-After` header describes when to try the write again. + description: | + Service unavailable. + + - Returns this error if + the server is temporarily unavailable to accept writes. + - Returns a `Retry-After` header that describes when to try the write again. headers: Retry-After: - description: A non-negative decimal integer indicating the seconds to delay after the response is received. + description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /delete: post: operationId: PostDelete tags: + - Data I/O endpoints - Delete summary: Delete data + description: | + Deletes data from a bucket. + + Use this endpoint to delete points from a bucket in a specified time range. + + #### InfluxDB Cloud + + - Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns _success_ if queued; _error_ otherwise. + 3. Handles the delete asynchronously. + + #### InfluxDB OSS + + - Validates the request, handles the delete synchronously, + and then responds with success or failure. + + #### Required permissions + + - `write-buckets` or `write-bucket BUCKET_ID`. + + `BUCKET_ID` is the ID of the destination bucket. + + #### Rate limits (with InfluxDB Cloud) + + `write` rate limits apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides + + - [Delete data](https://docs.influxdata.com/influxdb/v2.3/write-data/delete-data/). + - Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/delete-predicate/). + - Learn how InfluxDB handles [deleted tags](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementtagkeys/) + and [deleted fields](https://docs.influxdata.com/flux/v0.x/stdlib/influxdata/influxdb/schema/measurementfieldkeys/). + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request POST INFLUX_URL/api/v2/delete?org=INFLUX_ORG&bucket=INFLUX_BUCKET \ + --header 'Authorization: Token INFLUX_API_TOKEN' \ + --header 'Content-Type: application/json' \ + --data '{ + "start": "2020-03-01T00:00:00Z", + "stop": "2020-11-14T00:00:00Z", + "predicate": "tag1=\"value1\" and (tag2=\"value2\" and tag3!=\"value3\")" + }' requestBody: - description: Deletes data from an InfluxDB bucket. + description: | + Time range parameters and an optional **delete predicate expression**. + + To select points to delete within the specified time range, pass a + **delete predicate expression** in the `predicate` property of the request body. + If you don't pass a `predicate`, InfluxDB deletes all data with timestamps + in the specified time range. + + #### Related guides + + - [Delete data](https://docs.influxdata.com/influxdb/v2.3/write-data/delete-data/). + - Learn how to use [delete predicate syntax](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/delete-predicate/). required: true content: application/json: @@ -1239,54 +1477,100 @@ paths: - $ref: '#/components/parameters/TraceSpan' - in: query name: org - description: Specifies the organization to delete data from. + description: | + The organization to delete data from. + If you pass both `orgID` and `org`, they must both be valid. + + #### InfluxDB Cloud + + - Doesn't require `org` or `orgID`. + - Deletes data from the bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. schema: type: string - description: Only points from this organization are deleted. + description: The organization name or ID. - in: query name: bucket - description: Specifies the bucket to delete data from. + description: | + The name or ID of the bucket to delete data from. + If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. schema: type: string - description: Only points from this bucket are deleted. + description: The bucket name or ID. - in: query name: orgID - description: Specifies the organization ID of the resource. + description: | + The ID of the organization to delete data from. + If you pass both `orgID` and `org`, they must both be valid. + + #### InfluxDB Cloud + + - Doesn't require `org` or `orgID`. + - Deletes data from the bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. schema: type: string + description: The organization ID. - in: query name: bucketID - description: Specifies the bucket ID to delete data from. + description: | + The ID of the bucket to delete data from. + If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. schema: type: string - description: Only points from this bucket ID are deleted. + description: The bucket ID. responses: '204': - description: delete has been accepted + description: | + Success. + + #### InfluxDB Cloud + + - Validated and queued the request. + - Handles the delete asynchronously - the deletion might not have completed yet. + + An HTTP `2xx` status code acknowledges that the write or delete is queued. + To ensure that InfluxDB Cloud handles writes and deletes in the order you request them, + wait for a response before you send the next request. + + Because writes are asynchronous, data might not yet be written + when you receive the response. + + #### InfluxDB OSS + + - Deleted the data. '400': - description: Invalid request. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - '403': - description: no token was sent or does not have sufficient permissions. + description: | + Bad request. + The response body contains detail about the error. + + #### InfluxDB OSS + + - Returns this error if `org` or `orgID` doesn't match an organization. content: application/json: schema: $ref: '#/components/schemas/Error' + examples: + orgNotFound: + summary: Organization not found + value: + code: invalid + message: 'failed to decode request body: organization not found' + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: the bucket or organization is not found. - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: internal server error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' /labels: post: operationId: PostLabels @@ -1294,7 +1578,7 @@ paths: - Labels summary: Create a label requestBody: - description: Label to create + description: The label to create. required: true content: application/json: @@ -1302,17 +1586,15 @@ paths: $ref: '#/components/schemas/LabelCreateRequest' responses: '201': - description: Added label + description: Success. The label was created. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' get: operationId: GetLabels tags: @@ -1327,17 +1609,15 @@ paths: type: string responses: '200': - description: A list of labels + description: Success. The response body contains a list of labels. content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/labels/{labelID}': get: operationId: GetLabelsID @@ -1354,24 +1634,22 @@ paths: description: The ID of the label to update. responses: '200': - description: A label + description: Success. The response body contains the label. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' patch: operationId: PatchLabelsID tags: - Labels summary: Update a label requestBody: - description: Label update + description: A label update. required: true content: application/json: @@ -1387,23 +1665,19 @@ paths: description: The ID of the label to update. responses: '200': - description: Updated label + description: Success. The response body contains the updated label. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: Label not found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' delete: operationId: DeleteLabelsID tags: @@ -1419,25 +1693,21 @@ paths: description: The ID of the label to delete. responses: '204': - description: Delete has been accepted + description: Success. The delete was accepted. + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: Label not found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/dashboards/{dashboardID}': get: operationId: GetDashboardsID tags: - Dashboards - summary: Retrieve a Dashboard + summary: Retrieve a dashboard parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -1453,7 +1723,7 @@ paths: type: string enum: - properties - description: Includes the cell view properties in the response if set to `properties` + description: 'If `properties`, includes the cell view properties in the response.' responses: '200': description: Retrieve a single dashboard @@ -2079,10 +2349,51 @@ paths: /query/ast: post: operationId: PostQueryAst - description: Analyzes flux query and generates a query specification. tags: - Query - summary: Generate an Abstract Syntax Tree (AST) from a query + summary: Generate a query Abstract Syntax Tree (AST) + description: | + Analyzes a Flux query and returns a complete package source [Abstract Syntax + Tree (AST)](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#abstract-syntax-tree-ast) + for the query. + + Use this endpoint for deep query analysis such as debugging unexpected query + results. + + A Flux query AST provides a semantic, tree-like representation with contextual + information about the query. The AST illustrates how the query is distributed + into different components for execution. + + #### Limitations + + - The endpoint doesn't validate values in the query--for example: + + The following sample Flux query has correct syntax, but contains an incorrect `from()` property key: + + ```js + from(foo: "iot_center") + |> range(start: -90d) + |> filter(fn: (r) => r._measurement == "environment") + ``` + + The following sample JSON shows how to pass the query in the request body: + + ```js + from(foo: "iot_center") + |> range(start: -90d) + |> filter(fn: (r) => r._measurement == "environment") + ``` + + The following code sample shows how to pass the query as JSON in the request body: + ```json + { "query": "from(foo: \"iot_center\")\ + |> range(start: -90d)\ + |> filter(fn: (r) => r._measurement == \"environment\")" + } + ``` + + Passing this to `/api/v2/query/ast` will return a successful response + with a generated AST. parameters: - $ref: '#/components/parameters/TraceSpan' - in: header @@ -2092,20 +2403,388 @@ paths: enum: - application/json requestBody: - description: Analyzed Flux query to generate abstract syntax tree. + description: The Flux query to analyze. content: application/json: schema: $ref: '#/components/schemas/LanguageRequest' + x-codeSamples: + - lang: Shell + label: 'cURL: Analyze and generate AST for the query' + source: | + curl --request POST "http://localhost:8086/api/v2/query/ast" \ + --header 'Content-Type: application/json' \ + --header 'Accept: application/json' \ + --header "Authorization: Token INFLUX_TOKEN" \ + --data-binary @- << EOL + { + "query": "from(bucket: \"INFLUX_BUCKET_NAME\")\ + |> range(start: -5m)\ + |> filter(fn: (r) => r._measurement == \"example-measurement\")" + } + EOL responses: '200': - description: Abstract syntax tree of the flux query. + description: | + Success. + The response body contains an Abstract Syntax Tree (AST) of the Flux query. content: application/json: schema: $ref: '#/components/schemas/ASTResponse' - default: - description: Any response other than 200 is an internal server error + examples: + successResponse: + value: + ast: + type: Package + package: main + files: + - type: File + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 109 + source: 'from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement")' + metadata: parser-type=rust + package: null + imports: null + body: + - type: ExpressionStatement + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 109 + source: 'from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement")' + expression: + type: PipeExpression + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 109 + source: 'from(bucket: "example-bucket") |> range(start: -5m) |> filter(fn: (r) => r._measurement == "example-measurement")' + argument: + type: PipeExpression + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 47 + source: 'from(bucket: "example-bucket") |> range(start: -5m)' + argument: + type: CallExpression + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 26 + source: 'from(bucket: "example-bucket")' + callee: + type: Identifier + location: + start: + line: 1 + column: 1 + end: + line: 1 + column: 5 + source: from + name: from + arguments: + - type: ObjectExpression + location: + start: + line: 1 + column: 6 + end: + line: 1 + column: 25 + source: 'bucket: "example-bucket"' + properties: + - type: Property + location: + start: + line: 1 + column: 6 + end: + line: 1 + column: 25 + source: 'bucket: "example-bucket"' + key: + type: Identifier + location: + start: + line: 1 + column: 6 + end: + line: 1 + column: 12 + source: bucket + name: bucket + value: + type: StringLiteral + location: + start: + line: 1 + column: 14 + end: + line: 1 + column: 25 + source: '"example-bucket"' + value: example-bucket + call: + type: CallExpression + location: + start: + line: 1 + column: 30 + end: + line: 1 + column: 47 + source: 'range(start: -5m)' + callee: + type: Identifier + location: + start: + line: 1 + column: 30 + end: + line: 1 + column: 35 + source: range + name: range + arguments: + - type: ObjectExpression + location: + start: + line: 1 + column: 36 + end: + line: 1 + column: 46 + source: 'start: -5m' + properties: + - type: Property + location: + start: + line: 1 + column: 36 + end: + line: 1 + column: 46 + source: 'start: -5m' + key: + type: Identifier + location: + start: + line: 1 + column: 36 + end: + line: 1 + column: 41 + source: start + name: start + value: + type: UnaryExpression + location: + start: + line: 1 + column: 43 + end: + line: 1 + column: 46 + source: '-5m' + operator: '-' + argument: + type: DurationLiteral + location: + start: + line: 1 + column: 44 + end: + line: 1 + column: 46 + source: 5m + values: + - magnitude: 5 + unit: m + call: + type: CallExpression + location: + start: + line: 1 + column: 51 + end: + line: 1 + column: 109 + source: 'filter(fn: (r) => r._measurement == "example-measurement")' + callee: + type: Identifier + location: + start: + line: 1 + column: 51 + end: + line: 1 + column: 57 + source: filter + name: filter + arguments: + - type: ObjectExpression + location: + start: + line: 1 + column: 58 + end: + line: 1 + column: 108 + source: 'fn: (r) => r._measurement == "example-measurement"' + properties: + - type: Property + location: + start: + line: 1 + column: 58 + end: + line: 1 + column: 108 + source: 'fn: (r) => r._measurement == "example-measurement"' + key: + type: Identifier + location: + start: + line: 1 + column: 58 + end: + line: 1 + column: 60 + source: fn + name: fn + value: + type: FunctionExpression + location: + start: + line: 1 + column: 62 + end: + line: 1 + column: 108 + source: (r) => r._measurement == "example-measurement" + params: + - type: Property + location: + start: + line: 1 + column: 63 + end: + line: 1 + column: 64 + source: r + key: + type: Identifier + location: + start: + line: 1 + column: 63 + end: + line: 1 + column: 64 + source: r + name: r + value: null + body: + type: BinaryExpression + location: + start: + line: 1 + column: 69 + end: + line: 1 + column: 108 + source: r._measurement == "example-measurement" + operator: '==' + left: + type: MemberExpression + location: + start: + line: 1 + column: 69 + end: + line: 1 + column: 83 + source: r._measurement + object: + type: Identifier + location: + start: + line: 1 + column: 69 + end: + line: 1 + column: 70 + source: r + name: r + property: + type: Identifier + location: + start: + line: 1 + column: 71 + end: + line: 1 + column: 83 + source: _measurement + name: _measurement + right: + type: StringLiteral + location: + start: + line: 1 + column: 87 + end: + line: 1 + column: 108 + source: '"example-measurement"' + value: example-measurement + '400': + description: | + Bad request. + InfluxDB is unable to parse the request. + The response body contains detail about the problem. + headers: + X-Platform-Error-Code: + description: | + The reason for the error. + schema: + type: string + example: invalid + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + invalidASTValue: + summary: Invalid AST + description: | + If the request body contains a missing property key in `from()`, + returns `invalid` and problem detail. + value: + code: invalid + message: 'invalid AST: loc 1:6-1:19: missing property key' + default: + description: Internal server error. content: application/json: schema: @@ -2115,28 +2794,685 @@ paths: operationId: GetQuerySuggestions tags: - Query - summary: Retrieve query suggestions + summary: Retrieve Flux query suggestions + description: | + Retrieves a list of Flux query suggestions. Each suggestion contains a + [Flux function](https://docs.influxdata.com/flux/v0.x/stdlib/all-functions/) + name and parameters. + + Use this endpoint to retrieve a list of Flux query suggestions used in the + InfluxDB Flux Query Builder. Helper function names have an underscore (`_`) + prefix and aren't meant to be used directly in queries--for example: + + - **Recommended**: Use `top(n, columns=["_value"], tables=<-)` to sort + on a column and keep the top n records instead of `_sortLimit_`. + `top` uses the `_sortLimit` helper function. + + #### Limitations + + - Using `/api/v2/query/suggestions/` (note the trailing slash) with cURL + will result in a HTTP `301 Moved Permanently` status code. Please use + `/api/v2/query/suggestions` without a trailing slash. + + - When writing a query, avoid using `_functionName()` helper functions + exposed by this endpoint. + + #### Related Guides + + - [List of all Flux functions](https://docs.influxdata.com/influxdb/v2.3/flux/v0.x/stdlib/all-functions/). parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': - description: Suggestions for next functions in call chain + description: | + Success. + The response body contains a list of Flux query suggestions--function + names used in the Flux Query Builder autocomplete suggestions. content: application/json: schema: $ref: '#/components/schemas/FluxSuggestions' + examples: + successResponse: + value: + funcs: + - name: _fillEmpty + params: + createEmpty: bool + tables: stream + - name: _highestOrLowest + params: + _sortLimit: function + column: invalid + groupColumns: array + 'n': invalid + reducer: function + tables: stream + - name: _hourSelection + params: + location: object + start: int + stop: int + tables: stream + timeColumn: string + - name: _sortLimit + params: + columns: array + desc: bool + 'n': int + tables: stream + - name: _window + params: + createEmpty: bool + every: duration + location: object + offset: duration + period: duration + startColumn: string + stopColumn: string + tables: stream + timeColumn: string + - name: aggregateWindow + params: + column: invalid + createEmpty: bool + every: duration + fn: function + location: object + offset: duration + period: duration + tables: stream + timeDst: string + timeSrc: string + - name: bool + params: + v: invalid + - name: bottom + params: + columns: array + 'n': int + tables: stream + - name: buckets + params: + host: string + org: string + orgID: string + token: string + - name: bytes + params: + v: invalid + - name: cardinality + params: + bucket: string + bucketID: string + host: string + org: string + orgID: string + predicate: function + start: invalid + stop: invalid + token: string + - name: chandeMomentumOscillator + params: + columns: array + 'n': int + tables: stream + - name: columns + params: + column: string + tables: stream + - name: contains + params: + set: array + value: invalid + - name: count + params: + column: string + tables: stream + - name: cov + params: + 'on': array + pearsonr: bool + x: invalid + 'y': invalid + - name: covariance + params: + columns: array + pearsonr: bool + tables: stream + valueDst: string + - name: cumulativeSum + params: + columns: array + tables: stream + - name: derivative + params: + columns: array + initialZero: bool + nonNegative: bool + tables: stream + timeColumn: string + unit: duration + - name: die + params: + msg: string + - name: difference + params: + columns: array + initialZero: bool + keepFirst: bool + nonNegative: bool + tables: stream + - name: display + params: + v: invalid + - name: distinct + params: + column: string + tables: stream + - name: doubleEMA + params: + 'n': int + tables: stream + - name: drop + params: + columns: array + fn: function + tables: stream + - name: duplicate + params: + as: string + column: string + tables: stream + - name: duration + params: + v: invalid + - name: elapsed + params: + columnName: string + tables: stream + timeColumn: string + unit: duration + - name: exponentialMovingAverage + params: + 'n': int + tables: stream + - name: fill + params: + column: string + tables: stream + usePrevious: bool + value: invalid + - name: filter + params: + fn: function + onEmpty: string + tables: stream + - name: findColumn + params: + column: string + fn: function + tables: stream + - name: findRecord + params: + fn: function + idx: int + tables: stream + - name: first + params: + column: string + tables: stream + - name: float + params: + v: invalid + - name: from + params: + bucket: string + bucketID: string + host: string + org: string + orgID: string + token: string + - name: getColumn + params: + column: string + - name: getRecord + params: + idx: int + - name: group + params: + columns: array + mode: string + tables: stream + - name: highestAverage + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: highestCurrent + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: highestMax + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: histogram + params: + bins: array + column: string + countColumn: string + normalize: bool + tables: stream + upperBoundColumn: string + - name: histogramQuantile + params: + countColumn: string + minValue: float + quantile: float + tables: stream + upperBoundColumn: string + valueColumn: string + - name: holtWinters + params: + column: string + interval: duration + 'n': int + seasonality: int + tables: stream + timeColumn: string + withFit: bool + - name: hourSelection + params: + location: object + start: int + stop: int + tables: stream + timeColumn: string + - name: increase + params: + columns: array + tables: stream + - name: int + params: + v: invalid + - name: integral + params: + column: string + interpolate: string + tables: stream + timeColumn: string + unit: duration + - name: join + params: + method: string + 'on': array + tables: invalid + - name: kaufmansAMA + params: + column: string + 'n': int + tables: stream + - name: kaufmansER + params: + 'n': int + tables: stream + - name: keep + params: + columns: array + fn: function + tables: stream + - name: keyValues + params: + keyColumns: array + tables: stream + - name: keys + params: + column: string + tables: stream + - name: last + params: + column: string + tables: stream + - name: length + params: + arr: array + - name: limit + params: + 'n': int + offset: int + tables: stream + - name: linearBins + params: + count: int + infinity: bool + start: float + width: float + - name: logarithmicBins + params: + count: int + factor: float + infinity: bool + start: float + - name: lowestAverage + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: lowestCurrent + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: lowestMin + params: + column: string + groupColumns: array + 'n': int + tables: stream + - name: map + params: + fn: function + mergeKey: bool + tables: stream + - name: max + params: + column: string + tables: stream + - name: mean + params: + column: string + tables: stream + - name: median + params: + column: string + compression: float + method: string + tables: stream + - name: min + params: + column: string + tables: stream + - name: mode + params: + column: string + tables: stream + - name: movingAverage + params: + 'n': int + tables: stream + - name: now + params: {} + - name: pearsonr + params: + 'on': array + x: invalid + 'y': invalid + - name: pivot + params: + columnKey: array + rowKey: array + tables: stream + valueColumn: string + - name: quantile + params: + column: string + compression: float + method: string + q: float + tables: stream + - name: range + params: + start: invalid + stop: invalid + tables: stream + - name: reduce + params: + fn: function + identity: invalid + tables: stream + - name: relativeStrengthIndex + params: + columns: array + 'n': int + tables: stream + - name: rename + params: + columns: invalid + fn: function + tables: stream + - name: sample + params: + column: string + 'n': int + pos: int + tables: stream + - name: set + params: + key: string + tables: stream + value: string + - name: skew + params: + column: string + tables: stream + - name: sort + params: + columns: array + desc: bool + tables: stream + - name: spread + params: + column: string + tables: stream + - name: stateCount + params: + column: string + fn: function + tables: stream + - name: stateDuration + params: + column: string + fn: function + tables: stream + timeColumn: string + unit: duration + - name: stateTracking + params: + countColumn: string + durationColumn: string + durationUnit: duration + fn: function + tables: stream + timeColumn: string + - name: stddev + params: + column: string + mode: string + tables: stream + - name: string + params: + v: invalid + - name: sum + params: + column: string + tables: stream + - name: tableFind + params: + fn: function + tables: stream + - name: tail + params: + 'n': int + offset: int + tables: stream + - name: time + params: + v: invalid + - name: timeShift + params: + columns: array + duration: duration + tables: stream + - name: timeWeightedAvg + params: + tables: stream + unit: duration + - name: timedMovingAverage + params: + column: string + every: duration + period: duration + tables: stream + - name: to + params: + bucket: string + bucketID: string + fieldFn: function + host: string + measurementColumn: string + org: string + orgID: string + tables: stream + tagColumns: array + timeColumn: string + token: string + - name: toBool + params: + tables: stream + - name: toFloat + params: + tables: stream + - name: toInt + params: + tables: stream + - name: toString + params: + tables: stream + - name: toTime + params: + tables: stream + - name: toUInt + params: + tables: stream + - name: today + params: {} + - name: top + params: + columns: array + 'n': int + tables: stream + - name: tripleEMA + params: + 'n': int + tables: stream + - name: tripleExponentialDerivative + params: + 'n': int + tables: stream + - name: truncateTimeColumn + params: + tables: stream + timeColumn: invalid + unit: duration + - name: uint + params: + v: invalid + - name: union + params: + tables: array + - name: unique + params: + column: string + tables: stream + - name: wideTo + params: + bucket: string + bucketID: string + host: string + org: string + orgID: string + tables: stream + token: string + - name: window + params: + createEmpty: bool + every: duration + location: object + offset: duration + period: duration + startColumn: string + stopColumn: string + tables: stream + timeColumn: string + - name: yield + params: + name: string + tables: stream + '301': + description: | + Moved Permanently. + InfluxData has moved the URL of the endpoint. + Use `/api/v2/query/suggestions`. + content: + text/html: + schema: + properties: + body: + readOnly: true + description: Response message with URL of requested resource. + type: string + examples: + movedPermanently: + summary: Invalid URL + description: | + The URL has been permanently moved. Use `/api/v2/query/suggestions`. + value: | + Moved Permanently default: - description: Any response other than 200 is an internal server error + description: Internal server error. content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request GET "https://cloud2.influxdata.com/api/v2/query/suggestions" \ + --header "Accept: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" '/query/suggestions/{name}': get: operationId: GetQuerySuggestionsName tags: - Query - summary: Retrieve query suggestions for a branching suggestion + summary: Retrieve a query suggestion for a branching suggestion + description: | + Retrieves a query suggestion that contains the name and parameters of the + requested function. + + Use this endpoint to pass a branching suggestion (a Flux function name) and + retrieve the parameters of the requested function. + + #### Limitations + + - Use `/api/v2/query/suggestions/{name}` (without a trailing slash). + `/api/v2/query/suggestions/{name}/` (note the trailing slash) results in a + HTTP `301 Moved Permanently` status. + + - The function `name` must exist and must be spelled correctly. + + #### Related Guides + + - [List of all Flux functions](https://docs.influxdata.com/influxdb/v2.3/flux/v0.x/stdlib/all-functions/). parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2144,26 +3480,87 @@ paths: schema: type: string required: true - description: The name of the branching suggestion. + description: | + A Flux Function name. + Only returns functions with this name. responses: '200': - description: Suggestions for next functions in call chain + description: | + Success. + The response body contains the function name and parameters. content: application/json: schema: $ref: '#/components/schemas/FluxSuggestion' - default: - description: Any response other than 200 is an internal server error + examples: + successResponse: + value: + name: sum + params: + column: string + tables: stream + '500': + description: | + Internal server error. + The value passed for _`name`_ may have been misspelled. content: application/json: schema: $ref: '#/components/schemas/Error' + examples: + internalError: + summary: Invalid function + description: | + The requested function doesn't exist. + value: + code: internal error + message: An internal error has occurred + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request GET "https://cloud2.influxdata.com/api/v2/query/suggestions/sum/" \ + --header "Accept: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" /query/analyze: post: operationId: PostQueryAnalyze tags: - Query summary: Analyze a Flux query + description: | + Analyzes a [Flux query](https://docs.influxdata.com/flux/v0.x/) for syntax + errors and returns the list of errors. + + In the following sample query, `from()` is missing the property key. + + ```json + { "query": "from(: \"iot_center\")\ + |> range(start: -90d)\ + |> filter(fn: (r) => r._measurement == \"environment\")", + "type": "flux" + } + ``` + + If you pass this in a request to the `/api/v2/analyze` endpoint, + InfluxDB returns an `errors` list that contains an error object for the missing key. + + #### Limitations + + - The endpoint doesn't validate values in the query--for example: + + - The following sample query has correct syntax, but contains an incorrect `from()` property key: + + ```json + { "query": "from(foo: \"iot_center\")\ + |> range(start: -90d)\ + |> filter(fn: (r) => r._measurement == \"environment\")", + "type": "flux" + } + ``` + + If you pass this in a request to the `/api/v2/analyze` endpoint, + InfluxDB returns an empty `errors` list. parameters: - $ref: '#/components/parameters/TraceSpan' - in: header @@ -2180,48 +3577,129 @@ paths: $ref: '#/components/schemas/Query' responses: '200': - description: Query analyze results. Errors will be empty if the query is valid. + description: | + Success. + The response body contains the list of `errors`. + If the query syntax is valid, the endpoint returns an empty `errors` list. content: application/json: schema: $ref: '#/components/schemas/AnalyzeQueryResponse' + examples: + missingQueryPropertyKey: + summary: Missing property key error + description: | + Returns an error object if the Flux query is missing a property key. + + The following sample query is missing the _`bucket`_ property key: + + ```json + { + "query": "from(: \"iot_center\")\ + + ... + + } + ``` + value: + errors: + - line: 1 + column: 6 + character: 0 + message: missing property key + '400': + description: | + Bad request. + InfluxDB is unable to parse the request. + The response body contains detail about the problem. + headers: + X-Platform-Error-Code: + description: | + The reason for the error. + schema: + type: string + example: invalid + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + invalidJSONStringValue: + summary: Invalid JSON + description: 'If the request body contains invalid JSON, returns `invalid` and problem detail.' + value: + code: invalid + message: 'invalid json: invalid character ''\'''' looking for beginning of value' default: description: Internal server error headers: + X-Platform-Error-Code: + description: The reason for the error. + schema: + type: string + example: internal error X-Influx-Error: - description: Error string describing the problem + description: A string that describes the problem. schema: type: string X-Influx-Reference: - description: Reference code unique to the error type + description: The numeric reference code for the error type. schema: type: integer content: application/json: schema: $ref: '#/components/schemas/Error' + examples: + emptyJSONObject: + summary: Empty JSON object in request body + description: | + If the request body contains an empty JSON object, returns `internal error`. + value: + code: internal error + message: An internal error has occurred - check server logs + x-codeSamples: + - lang: Shell + label: 'cURL: Analyze a Flux query' + source: | + curl -v --request POST \ + "http://localhost:8086/api/v2/query/analyze" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --header 'Content-type: application/json' \ + --header 'Accept: application/json' \ + --data-binary @- << EOF + { "query": "from(bucket: \"iot_center\")\ + |> range(start: -90d)\ + |> filter(fn: (r) => r._measurement == \"environment\")", + "type": "flux" + } + EOF /query: post: operationId: PostQuery tags: + - Data I/O endpoints - Query summary: Query data description: | - Retrieves data from InfluxDB buckets. + Retrieves data from buckets. + + Use this endpoint to send a Flux query request and retrieve data from a bucket. - To query data, you need the following: - - **organization** – _See [View organizations](https://docs.influxdata.com/influxdb/v2.1/organizations/view-orgs/#view-your-organization-id) for instructions on viewing your organization ID._ - - **API token** – _See [View tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/view-tokens/) - for instructions on viewing your API token._ - - **InfluxDB URL** – _See [InfluxDB URLs](https://docs.influxdata.com/influxdb/v2.1/reference/urls/)_. - - **Flux query** – _See [Flux](https://docs.influxdata.com/flux/v0.x/)._ + #### Rate limits (with InfluxDB Cloud) - For more information and examples, see [Query with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.1/query-data/execute-queries/influx-api/). + `read` rate limits apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides + + - [Query with the InfluxDB API](https://docs.influxdata.com/influxdb/v2.3/query-data/execute-queries/influx-api/). + - [Get started with Flux](https://docs.influxdata.com/flux/v0.x/get-started/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: header name: Accept-Encoding - description: Indicates the content encoding (usually a compression algorithm) that the client can understand. + description: The content encoding (usually a compression algorithm) that the client can understand. schema: type: string description: 'The content coding. Use `gzip` for compressed data or `identity` for unmodified, uncompressed data.' @@ -2238,14 +3716,45 @@ paths: - application/vnd.flux - in: query name: org - description: 'Specifies the name of the organization executing the query. Takes either the ID or Name. If both `orgID` and `org` are specified, `org` takes precedence.' + description: | + The name or ID of the organization executing the query. + + #### InfluxDB Cloud + + - Doesn't use `org` or `orgID`. + - Queries the bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. schema: type: string - in: query name: orgID - description: 'Specifies the ID of the organization executing the query. If both `orgID` and `org` are specified, `org` takes precedence.' - schema: - type: string + description: | + The ID of the organization executing the query. + + #### InfluxDB Cloud + + - Doesn't use `org` or `orgID`. + - Queries the bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Requires either `org` or `orgID`. + schema: + type: string + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request POST 'INFLUX_URL/api/v2/query?org=INFLUX_ORG' \ + --header 'Content-Type: application/vnd.flux' \ + --header 'Accept: application/csv \ + --header 'Authorization: Token INFLUX_API_TOKEN' \ + --data 'from(bucket: "example-bucket") + |> range(start: -5m) + |> filter(fn: (r) => r._measurement == "example-measurement")' requestBody: description: Flux query or specification to execute content: @@ -2261,10 +3770,10 @@ paths: |> filter(fn: (r) => r._measurement == "example-measurement") responses: '200': - description: Success. Returns query results. + description: Success. The response body contains query results. headers: Content-Encoding: - description: Lists any encodings (usually compression algorithms) that have been applied to the response payload. + description: Lists encodings (usually compression algorithms) that have been applied to the response payload. schema: type: string description: | @@ -2274,40 +3783,98 @@ paths: - gzip - identity Trace-Id: - description: 'The Trace-Id header reports the request''s trace ID, if one was generated.' + description: 'The trace ID, if generated, of the request.' schema: type: string - description: Specifies the request's trace ID. + description: Trace ID of a request. content: - text/csv: + application/csv: schema: type: string - example: | - result,table,_start,_stop,_time,region,host,_value mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 - application/vnd.influx.arrow: + example: | + result,table,_start,_stop,_time,region,host,_value + mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:00Z,east,A,15.43 + mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:20Z,east,B,59.25 + mean,0,2018-05-08T20:50:00Z,2018-05-08T20:51:00Z,2018-05-08T20:50:40Z,east,C,52.62 + '400': + description: | + Bad request. + The response body contains detail about the error. + + #### InfluxDB OSS + + - Returns this error if `org` or `orgID` doesn't match an organization. + content: + application/json: schema: - type: string - format: binary + $ref: '#/components/schemas/Error' + examples: + orgNotFound: + summary: Organization not found + value: + code: invalid + message: 'failed to decode request body: organization not found' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' '429': - description: Token is temporarily over quota. The Retry-After header describes when to try the read again. + description: | + #### InfluxDB Cloud: + - returns this error if a **read** or **write** request exceeds your + plan's [adjustable service quotas](https://docs.influxdata.com/influxdb/v2.3/account-management/limits/#adjustable-service-quotas) + or if a **delete** request exceeds the maximum + [global limit](https://docs.influxdata.com/influxdb/v2.3/account-management/limits/#global-limits) + - returns `Retry-After` header that describes when to try the write again. + + #### InfluxDB OSS: + - doesn't return this error. headers: Retry-After: - description: A non-negative decimal integer indicating the seconds to delay after the response is received. + description: Non-negative decimal integer indicating seconds to wait before retrying the request. schema: type: integer format: int32 + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Error processing query - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' /buckets: get: operationId: GetBuckets tags: - Buckets - summary: List all buckets + summary: List buckets + description: | + Retrieves a list of [buckets](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#bucket). + + To limit which buckets are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all buckets up to the + default `limit`. + + #### Limitations + + - Paging with an `offset` greater than the number of records will result in + an empty list of buckets--for example: + + The following request is paging to the 50th record, but the user only has + 10 buckets. + + ```sh + $ curl --request GET "INFLUX_URL/api/v2/scripts?limit=1&offset=50" + + $ { + "links": { + "prev": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=49\u0026orgID=ORG_ID", + "self": "/api/v2/buckets?descending=false\u0026limit=1\u0026offset=50\u0026orgID=ORG_ID" + }, + "buckets": [] + } + ``` + + #### Related Guides + + - [Manage buckets](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/) parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' @@ -2315,42 +3882,133 @@ paths: - $ref: '#/components/parameters/After' - in: query name: org - description: The name of the organization. + description: | + Organization name. + The name of the organization. + + #### InfluxDB Cloud + + - Doesn't use `org` or `orgID`. + - Creates a bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Accepts either `org` or `orgID`. + - InfluxDB creates the bucket within this organization. schema: type: string - in: query name: orgID - description: The organization ID. + description: | + Organization ID. + The organization ID. + + #### InfluxDB Cloud + + - Doesn't use `org` or `orgID`. + - Creates a bucket in the organization associated with the authorization (API token). + + #### InfluxDB OSS + + - Accepts either `org` or `orgID`. + - InfluxDB creates the bucket within this organization. schema: type: string - in: query name: name - description: Only returns buckets with a specific name. + description: | + Bucket name. + Only returns buckets with this specific name. schema: type: string - in: query name: id - description: Only returns buckets with a specific ID. + description: | + Bucket ID. + Only returns the bucket with this ID. schema: type: string responses: '200': - description: A list of buckets + description: | + Success. + The response body contains a list of buckets. content: application/json: schema: $ref: '#/components/schemas/Buckets' + examples: + successResponse: + value: + links: + self: /api/v2/buckets?descending=false&limit=20&name=_monitoring&offset=0&orgID=ORG_ID + buckets: + - id: 77ca9dace40a9bfc + orgID: INFLUX_ORG_ID + type: system + schemaType: implicit + description: System bucket for monitoring logs + name: _monitoring + retentionRules: + - type: expire + everySeconds: 604800 + createdAt: '2022-03-15T17:22:33.72617939Z' + updatedAt: '2022-03-15T17:22:33.726179487Z' + links: + labels: /api/v2/buckets/77ca9dace40a9bfc/labels + members: /api/v2/buckets/77ca9dace40a9bfc/members + org: /api/v2/orgs/INFLUX_ORG_ID + owners: /api/v2/buckets/77ca9dace40a9bfc/owners + self: /api/v2/buckets/77ca9dace40a9bfc + write: /api/v2/write?org=ORG_ID&bucket=77ca9dace40a9bfc + labels: [] + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request GET "http://localhost:8086/api/v2/buckets?name=_monitoring" \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" post: operationId: PostBuckets tags: - Buckets summary: Create a bucket + description: | + Creates a [bucket](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#bucket) + and returns the created bucket along with metadata. The default data + [retention period](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#retention-period) + is 30 days. + + #### InfluxDB OSS + + - A single InfluxDB OSS instance supports active writes or queries for + approximately 20 buckets across all organizations at a given time. Reading + or writing to more than 20 buckets at a time can adversely affect + performance. + + #### Limitations + + - InfluxDB Cloud Free Plan allows users to create up to two buckets. + Exceeding the bucket quota will result in an HTTP `403` status code. + For additional information regarding InfluxDB Cloud offerings, see + [InfluxDB Cloud Pricing](https://www.influxdata.com/influxdb-cloud-pricing/). + + #### Related Guides + + - [Create bucket](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/create-bucket/) + - [Create bucket CLI reference](https://docs.influxdata.com/influxdb/v2.3/reference/cli/influx/bucket/create) parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: @@ -2362,29 +4020,110 @@ paths: $ref: '#/components/schemas/PostBucketRequest' responses: '201': - description: Bucket created + description: | + Success. + The bucket was created. content: application/json: schema: $ref: '#/components/schemas/Bucket' + examples: + successResponse: + value: + id: 37407e232b3911d8 + orgID: INFLUX_ORG_ID + type: user + schemaType: implicit + description: bucket holding air sensor data + name: air_sensor + retentionRules: + - type: expire + everySeconds: 2592000 + createdAt: '2022-08-03T23:04:41.073704121Z' + updatedAt: '2022-08-03T23:04:41.073704228Z' + links: + labels: /api/v2/buckets/37407e232b3911d8/labels + members: /api/v2/buckets/37407e232b3911d8/members + org: /api/v2/orgs/INFLUX_ORG_ID + owners: /api/v2/buckets/37407e232b3911d8/owners + self: /api/v2/buckets/37407e232b3911d8 + write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 + labels: [] + '400': + description: | + Bad request. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '401': + $ref: '#/components/responses/AuthorizationError' + '403': + description: | + Forbidden. + The bucket quota is exceeded. + headers: + X-Platform-Error-Code: + description: | + The reason for the error. + schema: + type: string + example: forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + quotaExceeded: + summary: Bucket quota exceeded + value: + code: forbidden + message: creating bucket would exceed quota '422': - description: Request body failed validation + description: | + Unprocessable Entity. + The request body failed validation. content: application/json: schema: $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request POST "http://localhost:8086/api/v2/buckets \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" \ + --data '{ + "name": "air_sensor", + "description": "bucket holding air sensor data", + "orgID": "INFLUX_ORG_ID", + "retentionRules": [ + { + "type": "expire", + "everySeconds": 2592000, + } + ] + }' '/buckets/{bucketID}': get: operationId: GetBucketsID tags: - Buckets summary: Retrieve a bucket + description: | + Retrieves a bucket. + + Use this endpoint to retrieve information for a specific bucket. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2392,14 +4131,58 @@ paths: schema: type: string required: true - description: The bucket ID. + description: | + The ID of the bucket to retrieve. responses: '200': - description: Bucket details + description: | + Success. + The response body contains the bucket information. content: application/json: schema: $ref: '#/components/schemas/Bucket' + examples: + successResponse: + value: + id: 37407e232b3911d8 + orgID: bea7ea952287f70d + type: user + schemaType: implicit + description: bucket for air sensor data + name: air-sensor + retentionRules: + - type: expire + everySeconds: 2592000 + createdAt: '2022-08-03T23:04:41.073704121Z' + updatedAt: '2022-08-03T23:04:41.073704228Z' + links: + labels: /api/v2/buckets/37407e232b3911d8/labels + members: /api/v2/buckets/37407e232b3911d8/members + org: /api/v2/orgs/INFLUX_ORG_ID + owners: /api/v2/buckets/37407e232b3911d8/owners + self: /api/v2/buckets/37407e232b3911d8 + write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 + labels: [] + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + description: | + Not found. + Bucket not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + notFound: + summary: | + The requested bucket wasn't found. + value: + code: not found + message: bucket not found + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -2411,8 +4194,26 @@ paths: tags: - Buckets summary: Update a bucket + description: | + Updates a bucket. + + Use this endpoint to update properties + (`name`, `description`, and `retentionRules`) of a bucket. + + #### InfluxDB Cloud + + - Requires the `retentionRules` property in the request body. If you don't + provide `retentionRules`, InfluxDB responds with an HTTP `403` status code. + + #### InfluxDB OSS + + - Doesn't require `retentionRules`. + + #### Related Guides + + - [Update a bucket](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/update-bucket/) requestBody: - description: Bucket update to apply + description: The bucket update to apply. required: true content: application/json: @@ -2433,17 +4234,130 @@ paths: application/json: schema: $ref: '#/components/schemas/Bucket' + examples: + successResponse: + value: + id: 37407e232b3911d8 + orgID: INFLUX_ORG_ID + type: user + schemaType: implicit + description: bucket holding air sensor data + name: air_sensor + retentionRules: + - type: expire + everySeconds: 2592000 + createdAt: '2022-08-03T23:04:41.073704121Z' + updatedAt: '2022-08-07T22:49:49.422962913Z' + links: + labels: /api/v2/buckets/37407e232b3911d8/labels + members: /api/v2/buckets/37407e232b3911d8/members + org: /api/v2/orgs/INFLUX_ORG_ID + owners: /api/v2/buckets/37407e232b3911d8/owners + self: /api/v2/buckets/37407e232b3911d8 + write: /api/v2/write?org=INFLUX_ORG_ID&bucket=37407e232b3911d8 + labels: [] + '400': + description: | + Bad Request. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + invalidJSONStringValue: + summary: Invalid JSON + description: | + If the request body contains invalid JSON, InfluxDB returns `invalid` + with detail about the problem. + value: + code: invalid + message: 'invalid json: invalid character ''\'''' looking for beginning of value' + '401': + $ref: '#/components/responses/AuthorizationError' + '403': + description: | + Forbidden. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + invalidRetention: + summary: | + The retention policy provided exceeds the max retention for the + organization. + value: + code: forbidden + message: provided retention exceeds orgs maximum retention duration + '404': + description: | + Not found. + Bucket not found. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + notFound: + summary: | + The requested bucket wasn't found. + value: + code: not found + message: bucket not found + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request PATCH "http://localhost:8086/api/v2/buckets/BUCKET_ID \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" \ + --data '{ + "name": "air_sensor", + "description": "bucket holding air sensor data", + "retentionRules": [ + { + "type": "expire", + "everySeconds": 2592000 + } + ] + }' delete: operationId: DeleteBucketsID tags: - Buckets summary: Delete a bucket + description: | + Deletes a bucket and all associated records. + + #### InfluxDB Cloud + + - Does the following when you send a delete request: + + 1. Validates the request and queues the delete. + 2. Returns an HTTP `204` status code if queued; _error_ otherwise. + 3. Handles the delete asynchronously. + + #### InfluxDB OSS + + - Validates the request, handles the delete synchronously, + and then responds with success or failure. + + #### Limitations + + - Only one bucket can be deleted per request. + + #### Related Guides + + - [Delete a bucket](https://docs.influxdata.com/influxdb/v2.3/organizations/buckets/delete-bucket/#delete-a-bucket-in-the-influxdb-ui) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2451,28 +4365,85 @@ paths: schema: type: string required: true - description: The ID of the bucket to delete. + description: | + Bucket ID. + The ID of the bucket to delete. responses: '204': - description: Delete has been accepted + description: | + Success. + + #### InfluxDB Cloud + - The bucket is queued for deletion. + + #### InfluxDB OSS + - The bucket is deleted. + '400': + description: | + Bad Request. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + invalidID: + summary: | + Invalid ID. + value: + code: invalid + message: id must have a length of 16 bytes + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: Bucket not found + description: | + Not found. + Bucket not found. content: application/json: schema: $ref: '#/components/schemas/Error' + examples: + notFound: + summary: | + The requested bucket was not found. + value: + code: not found + message: bucket not found + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request DELETE "http://localhost:8086/api/v2/buckets/BUCKET_ID" \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header 'Accept: application/json' '/buckets/{bucketID}/labels': get: operationId: GetBucketsIDLabels tags: - Buckets summary: List all labels for a bucket + description: | + Retrieves a list of all labels for a bucket. + + Labels are objects that contain `labelID`, `name`, `description`, and `color` + key-value pairs. They may be used for grouping and filtering InfluxDB + resources. + Labels are also capable of grouping across different resources--for example, + you can apply a label named `air_sensor` to a bucket and a task to quickly + organize resources. + + #### Related guides + + - Use the [`/api/v2/labels` InfluxDB API endpoint](#tag/Labels) to retrieve and manage labels. + - [Manage labels in the InfluxDB UI](https://docs.influxdata.com/influxdb/v2.3/visualize-data/labels/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2480,14 +4451,34 @@ paths: schema: type: string required: true - description: The bucket ID. + description: | + The ID of the bucket to retrieve labels for. responses: '200': - description: A list of all labels for a bucket + description: | + Success. + The response body contains a list of all labels for the bucket. content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' + examples: + successResponse: + value: + links: + self: /api/v2/labels + labels: + - id: 09cbd068e7ebb000 + orgID: INFLUX_ORG_ID + name: production_buckets + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -2499,6 +4490,24 @@ paths: tags: - Buckets summary: Add a label to a bucket + description: | + Adds a label to a bucket and returns the new label information. + + Labels are objects that contain `labelID`, `name`, `description`, and `color` + key-value pairs. They may be used for grouping and filtering across one or + more kinds of **resources**--for example, you can apply a label named + `air_sensor` to a bucket and a task to quickly organize resources. + + #### Limitations + + - Before adding a label to a bucket, you must create the label if you + haven't already. To create a label with the InfluxDB API, send a `POST` + request to the [`/api/v2/labels` endpoint](#operation/PostLabels)). + + #### Related guides + + - Use the [`/api/v2/labels` InfluxDB API endpoint](#tag/Labels) to retrieve and manage labels. + - [Manage labels in the InfluxDB UI](https://docs.influxdata.com/influxdb/v2.3/visualize-data/labels/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2506,9 +4515,11 @@ paths: schema: type: string required: true - description: The bucket ID. + description: | + Bucket ID. + The ID of the bucket to label. requestBody: - description: Label to add + description: An object that contains a _`labelID`_ to add to the bucket. required: true content: application/json: @@ -2516,17 +4527,68 @@ paths: $ref: '#/components/schemas/LabelMapping' responses: '201': - description: The newly added label + description: | + Success. + The response body contains the label information. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' + examples: + successResponse: + value: + links: + self: /api/v2/labels + label: + id: 09cbd068e7ebb000 + orgID: INFLUX_ORG_ID + name: production_buckets + '400': + $ref: '#/components/responses/BadRequestError' + examples: + invalidRequest: + summary: The `labelID` is missing from the request body. + value: + code: invalid + message: label id is required + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '422': + description: | + Unprocessable entity. + Label already exists on the resource. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + conflictingResource: + summary: | + Label already exists on the resource. + value: + code: conflict + message: 'Cannot add label, label already exists on resource' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request POST "http://localhost:8086/api/v2/buckets/BUCKETS_ID/labels \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" \ + --data '{ + "labelID": "09cbd068e7ebb000" + }' '/buckets/{bucketID}/labels/{labelID}': delete: operationId: DeleteBucketsIDLabelsID @@ -2568,6 +4630,21 @@ paths: tags: - Buckets summary: List all users with member privileges for a bucket + description: | + Retrieves a list of all users for a bucket. + + InfluxDB [users](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#user) have + permission to access InfluxDB. + + [Members](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#member) are users in + an organization with access to the specified resource. + + Use this endpoint to retrieve all users with access to a bucket. + + #### Related guides + + - [Manage users](https://docs.influxdata.com/influxdb/v2.3/users/) + - [Manage members](https://docs.influxdata.com/influxdb/v2.3/organizations/members/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2575,14 +4652,43 @@ paths: schema: type: string required: true - description: The bucket ID. + description: | + The ID of the bucket to retrieve users for. responses: '200': - description: A list of bucket members + description: | + Success. + The response body contains a list of all users for the bucket. content: application/json: schema: $ref: '#/components/schemas/ResourceMembers' + examples: + successResponse: + value: + links: + self: /api/v2/buckets/37407e232b3911d8/members + users: + - role: member + links: + self: /api/v2/users/791df274afd48a83 + id: 791df274afd48a83 + name: example_user_1 + status: active + - role: owner + links: + self: /api/v2/users/09cfb87051cbe000 + id: 09cfb87051cbe000 + name: example_user_2 + status: active + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -2594,6 +4700,21 @@ paths: tags: - Buckets summary: Add a member to a bucket + description: | + Add a user to a bucket and return the new user information. + + InfluxDB [users](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#user) have + permission to access InfluxDB. + + [Members](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#member) are users in + an organization. + + Use this endpoint to give a user member privileges to a bucket. + + #### Related guides + + - [Manage users](https://docs.influxdata.com/influxdb/v2.3/users/) + - [Manage members](https://docs.influxdata.com/influxdb/v2.3/organizations/members/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2601,9 +4722,10 @@ paths: schema: type: string required: true - description: The bucket ID. + description: | + The ID of the bucket to retrieve users for. requestBody: - description: User to add as member + description: A user to add as a member to the bucket. required: true content: application/json: @@ -2611,23 +4733,69 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: Member added to bucket + description: | + Success. + The response body contains the user information. content: application/json: schema: $ref: '#/components/schemas/ResourceMember' + examples: + successResponse: + value: + role: member + links: + self: /api/v2/users/09cfb87051cbe000 + id: 09cfb87051cbe000 + name: example_user_1 + status: active + '400': + $ref: '#/components/responses/BadRequestError' + examples: + invalidRequest: + summary: The `userID` is missing from the request body. + value: + code: invalid + message: user id missing or invalid + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: cURL + source: | + curl --request POST "http://localhost:8086/api/v2/buckets/BUCKET_ID/members \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header "Accept: application/json" \ + --header "Content-Type: application/json" \ + --data '{ + "id": "09cfb87051cbe000" + } '/buckets/{bucketID}/members/{userID}': delete: operationId: DeleteBucketsIDMembersID tags: - Buckets summary: Remove a member from a bucket + description: | + Removes a member from a bucket. + + Use this endpoint to remove a user's member privileges from a bucket. This + removes the user's `read` and `write` permissions for the bucket. + + #### Related guides + + - [Manage users](https://docs.influxdata.com/influxdb/v2.3/users/) + - [Manage members](https://docs.influxdata.com/influxdb/v2.3/organizations/members/) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -2635,16 +4803,26 @@ paths: schema: type: string required: true - description: The ID of the member to remove. + description: | + The ID of the user to remove. - in: path name: bucketID schema: type: string required: true - description: The bucket ID. + description: | + The ID of the bucket to remove a user from. responses: '204': - description: Member removed + description: | + Success. + The user is no longer a member of the bucket. + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -2700,7 +4878,7 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: Bucket owner added + description: Success. The user is an owner of the bucket content: application/json: schema: @@ -2745,7 +4923,21 @@ paths: operationId: GetOrgs tags: - Organizations - summary: List all organizations + - Security and access endpoints + summary: List organizations + description: | + Retrieves a list of [organizations](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#organization/). + + To limit which organizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all organizations up to the default `limit`. + + #### InfluxDB Cloud + + - Only returns the organization that owns the token passed in the request. + + #### Related guides + + - [View organizations](https://docs.influxdata.com/influxdb/v2.3/organizations/view-orgs/). parameters: - $ref: '#/components/parameters/TraceSpan' - $ref: '#/components/parameters/Offset' @@ -2755,39 +4947,55 @@ paths: name: org schema: type: string - description: Filter organizations to a specific organization name. + description: | + An organization name. + Only returns organizations with this name. - in: query name: orgID schema: type: string - description: Filter organizations to a specific organization ID. + description: | + An organization ID. + Only returns the organization with this ID. - in: query name: userID schema: type: string - description: Filter organizations to a specific user ID. + description: | + A user ID. + Only returns organizations where this user is a member or owner. responses: '200': - description: A list of organizations + description: Success. The response body contains a list of organizations. content: application/json: schema: $ref: '#/components/schemas/Organizations' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostOrgs tags: - Organizations summary: Create an organization + description: | + Creates an organization and returns the newly created organization. + + #### InfluxDB Cloud + + - Doesn't allow you to use this endpoint to create organizations. parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: Organization to create + description: The organization to create. required: true content: application/json: @@ -2795,22 +5003,29 @@ paths: $ref: '#/components/schemas/PostOrganizationRequest' responses: '201': - description: Organization created + description: | + Success. The organization is created. + The response body contains the new organization. content: application/json: schema: $ref: '#/components/schemas/Organization' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/orgs/{orgID}': get: operationId: GetOrgsID tags: - Organizations + - Security and access endpoints summary: Retrieve an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -2899,6 +5114,7 @@ paths: operationId: GetOrgsIDSecrets tags: - Secrets + - Security and access endpoints summary: List all secret keys for an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -2955,6 +5171,7 @@ paths: operationId: GetOrgsIDMembers tags: - Organizations + - Security and access endpoints summary: List all members of an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3021,6 +5238,7 @@ paths: operationId: DeleteOrgsIDMembersID tags: - Organizations + - Security and access endpoints summary: Remove a member from an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3050,7 +5268,10 @@ paths: operationId: GetOrgsIDOwners tags: - Organizations + - Security and access endpoints summary: List all owners of an organization + description: | + Retrieves a list of all owners of an organization. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3058,7 +5279,8 @@ paths: schema: type: string required: true - description: The organization ID. + description: | + The ID of the organization to list owners for. responses: '200': description: A list of organization owners @@ -3083,6 +5305,25 @@ paths: tags: - Organizations summary: Add an owner to an organization + description: | + Adds an owner to an organization. + + Use this endpoint to assign the organization `owner` role to a user. + + #### InfluxDB Cloud + + - Doesn't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + #### Required permissions + + - `write-orgs INFLUX_ORG_ID` + + `INFLUX_ORG_ID` is the ID of the organization that you want add an owner for. + + #### Related endpoints + + - [Authorizations](#tag/Authorizations) parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3090,9 +5331,9 @@ paths: schema: type: string required: true - description: The organization ID. + description: The ID of the organization that you want to add an owner for. requestBody: - description: User to add as owner + description: The user to add as an owner of the organization. required: true content: application/json: @@ -3100,7 +5341,9 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: Organization owner added + description: | + Success. The user is an owner of the organization. + The response body contains the owner with role and user detail. content: application/json: schema: @@ -3116,6 +5359,7 @@ paths: operationId: DeleteOrgsIDOwnersID tags: - Organizations + - Security and access endpoints summary: Remove an owner from an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3146,6 +5390,7 @@ paths: operationId: PostOrgsIDSecrets tags: - Secrets + - Security and access endpoints summary: Delete secrets from an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3176,6 +5421,7 @@ paths: operationId: DeleteOrgsIDSecretsID tags: - Secrets + - Security and access endpoints summary: Delete a secret from an organization parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3196,12 +5442,13 @@ paths: description: Keys successfully deleted default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /resources: get: operationId: GetResources tags: - Resources + - System information endpoints summary: List all known resources parameters: - $ref: '#/components/parameters/TraceSpan' @@ -3225,27 +5472,64 @@ paths: operationId: ListStacks tags: - Templates - summary: List installed templates + summary: List installed stacks + description: | + Retrieves a list of installed InfluxDB stacks. + + To limit stacks in the response, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all installed stacks + for the organization. parameters: - in: query name: orgID required: true schema: type: string - description: The organization ID of the stacks + description: | + The ID of the organization that owns the stacks. + Only returns stacks owned by this organization. + + #### InfluxDB Cloud + + - Doesn't require this parameter; + InfluxDB only returns resources allowed by the API token. - in: query name: name schema: type: string - description: A collection of names to filter the list by. + description: | + The stack name. + Finds stack `events` with this name and returns the stacks. + + Repeatable. + To filter for more than one stack name, + repeat this parameter with each name--for example: + + - `http://localhost:8086/api/v2/stacks?&orgID=INFLUX_ORG_ID&name=project-stack-0&name=project-stack-1` + examples: + findStackByName: + summary: Find stacks with the event name + value: project-stack-0 - in: query name: stackID schema: type: string - description: A collection of stackIDs to filter the list by. + description: | + The stack ID. + Only returns stacks with this ID. + + Repeatable. + To filter for more than one stack ID, + repeat this parameter with each ID--for example: + + - `http://localhost:8086/api/v2/stacks?&orgID=INFLUX_ORG_ID&stackID=09bd87cd33be3000&stackID=09bef35081fe3000` + examples: + findStackByID: + summary: Find a stack with the ID + value: 09bd87cd33be3000 responses: '200': - description: Success. Returns the list of stacks. + description: Success. The response body contains the list of stacks. content: application/json: schema: @@ -3255,6 +5539,33 @@ paths: type: array items: $ref: '#/components/schemas/Stack' + '400': + description: | + Bad request. + The response body contains detail about the error. + + #### InfluxDB OSS + + - Returns this error if an incorrect value is passed for `org` or `orgID`. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + orgIdMissing: + summary: The orgID query parameter is missing + value: + code: invalid + message: 'organization id[""] is invalid: id must have a length of 16 bytes' + orgProvidedNotFound: + summary: The org or orgID passed doesn't own the token passed in the header + value: + code: invalid + message: 'failed to decode request body: organization not found' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -3265,7 +5576,28 @@ paths: operationId: CreateStack tags: - Templates - summary: Create a new stack + summary: Create a stack + description: | + Creates or initializes a stack. + + Use this endpoint to _manually_ initialize a new stack with the following + optional information: + + - Stack name + - Stack description + - URLs for template manifest files + + To automatically create a stack when applying templates, + use the [/api/v2/templates/apply endpoint](#operation/ApplyTemplate). + + #### Required permissions + + - `write` permission for the organization + + #### Related guides + + - [InfluxDB stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) + - [Use InfluxDB templates](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#apply-templates-to-an-influxdb-instance) requestBody: description: The stack to create. required: true @@ -3292,6 +5624,22 @@ paths: application/json: schema: $ref: '#/components/schemas/Stack' + '401': + $ref: '#/components/responses/AuthorizationError' + '422': + description: | + Unprocessable entity. + + The error may indicate one of the following problems: + + - The request body isn't valid--the request is well-formed, but InfluxDB can't process it due to semantic errors. + - You passed a parameter combination that InfluxDB doesn't support. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -3442,34 +5790,292 @@ paths: tags: - Templates summary: Apply or dry-run a template - description: Applies or performs a dry-run of template in an organization. + description: | + Applies a template to + create or update a [stack](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) of InfluxDB + [resources](https://docs.influxdata.com/influxdb/v2.3/reference/cli/influx/export/all/#resources). + The response contains the diff of changes and the stack ID. + + Use this endpoint to install an InfluxDB template to an organization. + Provide template URLs or template objects in your request. + To customize which template resources are installed, use the `actions` + parameter. + + By default, when you apply a template, InfluxDB installs the template to + create and update stack resources and then generates a diff of the changes. + If you pass `dryRun: true` in the request body, InfluxDB validates the + template and generates the resource diff, but doesn’t make any + changes to your instance. + + #### Custom values for templates + + - Some templates may contain [environment references](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/create/#include-user-definable-resource-names) for custom metadata. + To provide custom values for environment references, pass the _`envRefs`_ + property in the request body. + For more information and examples, see how to + [define environment references](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#define-environment-references). + + - Some templates may contain queries that use + [secrets](https://docs.influxdata.com/influxdb/v2.3/security/secrets/). + To provide custom secret values, pass the _`secrets`_ property + in the request body. + Don't expose secret values in templates. + For more information, see [how to pass secrets when installing a template](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#pass-secrets-when-installing-a-template). + + #### Required permissions + + - `write` permissions for resource types in the template. + + #### Rate limits (with InfluxDB Cloud) + + - Adjustable service quotas apply. + For more information, see [limits and adjustable quotas](https://docs.influxdata.com/influxdb/cloud/account-management/limits/). + + #### Related guides + + - [Use templates](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/) + - [Stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) requestBody: required: true + description: | + Parameters for applying templates. content: application/json: schema: $ref: '#/components/schemas/TemplateApply' + examples: + skipKindAction: + summary: Skip all bucket and task resources in the provided templates + value: + orgID: INFLUX_ORG_ID + actions: + - action: skipKind + properties: + kind: Bucket + - action: skipKind + properties: + kind: Task + templates: + - contents: + - '[object Object]': null + skipResourceAction: + summary: Skip specific resources in the provided templates + value: + orgID: INFLUX_ORG_ID + actions: + - action: skipResource + properties: + kind: Label + resourceTemplateName: foo-001 + - action: skipResource + properties: + kind: Bucket + resourceTemplateName: bar-020 + - action: skipResource + properties: + kind: Bucket + resourceTemplateName: baz-500 + templates: + - contents: + - apiVersion: influxdata.com/v2alpha1 + kind: Bucket + metadata: + name: baz-500 + templateObjectEnvRefs: + summary: envRefs for template objects + value: + orgID: INFLUX_ORG_ID + envRefs: + linux-cpu-label: MY_CPU_LABEL + docker-bucket: MY_DOCKER_BUCKET + docker-spec-1: MY_DOCKER_SPEC + templates: + - contents: + - apiVersion: influxdata.com/v2alpha1 + kind: Label + metadata: + name: + envRef: + key: linux-cpu-label + spec: + color: '#326BBA' + name: inputs.cpu + - contents: + - apiVersion: influxdata.com/v2alpha1 + kind: Bucket + metadata: + name: + envRef: + key: docker-bucket application/x-jsonnet: schema: $ref: '#/components/schemas/TemplateApply' text/yml: schema: $ref: '#/components/schemas/TemplateApply' + x-codeSamples: + - lang: Shell + label: 'cURL: Dry run with a remote template' + source: | + curl --request POST "http://localhost:8086/api/v2/templates/apply" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data @- << EOF + { + "dryRun": true, + "orgID": "INFLUX_ORG_ID", + "remotes": [ + { + "url": "https://raw.githubusercontent.com/influxdata/community-templates/master/linux_system/linux_system.yml" + } + ] + } + EOF + - lang: Shell + label: 'cURL: Apply with secret values' + source: | + curl "http://localhost:8086/api/v2/templates/apply" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data @- << EOF | jq . + { + "orgID": "INFLUX_ORG_ID", + "secrets": { + "SLACK_WEBHOOK": "YOUR_SECRET_WEBHOOK_URL" + }, + "remotes": [ + { + "url": "https://raw.githubusercontent.com/influxdata/community-templates/master/fortnite/fn-template.yml" + } + ] + } + EOF + - lang: Shell + label: 'cURL: Apply template objects with environment references' + source: | + curl --request POST "http://localhost:8086/api/v2/templates/apply" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data @- << EOF + { "orgID": "INFLUX_ORG_ID", + "envRefs": { + "linux-cpu-label": "MY_CPU_LABEL", + "docker-bucket": "MY_DOCKER_BUCKET", + "docker-spec-1": "MY_DOCKER_SPEC" + }, + "templates": [ + { "contents": [{ + "apiVersion": "influxdata.com/v2alpha1", + "kind": "Label", + "metadata": { + "name": { + "envRef": { + "key": "linux-cpu-label" + } + } + }, + "spec": { + "color": "#326BBA", + "name": "inputs.cpu" + } + }] + }, + "templates": [ + { "contents": [{ + "apiVersion": "influxdata.com/v2alpha1", + "kind": "Label", + "metadata": { + "name": { + "envRef": { + "key": "linux-cpu-label" + } + } + }, + "spec": { + "color": "#326BBA", + "name": "inputs.cpu" + } + }] + }, + { "contents": [{ + "apiVersion": "influxdata.com/v2alpha1", + "kind": "Bucket", + "metadata": { + "name": { + "envRef": { + "key": "docker-bucket" + } + } + } + }] + } + ] + } + EOF responses: '200': description: | - Success. The package dry-run succeeded. No new resources were created. Returns a diff and summary of the dry-run. The diff and summary won't contain IDs for resources that didn't exist at the time of the dry-run. + Success. + The template dry run succeeded. + The response body contains a resource diff of changes that the + template would have made if installed. + No resources were created or updated. + The diff and summary won't contain IDs for resources + that didn't exist at the time of the dry run. content: application/json: schema: $ref: '#/components/schemas/TemplateSummary' '201': description: | - Success. The package applied successfully. Returns a diff and summary of the run. The summary contains newly created resources. The diff compares the initial state to the state after the package applied. This corresponds to `"dryRun": true`. + Success. + The template applied successfully. + The response body contains the stack ID, a diff, and a summary. + The diff compares the initial state to the state after the template installation. + The summary contains newly created resources. content: application/json: schema: $ref: '#/components/schemas/TemplateSummary' + '422': + description: | + Unprocessable entity. + + + The error may indicate one of the following problems: + + - The template failed validation. + - You passed a parameter combination that InfluxDB doesn't support. + content: + application/json: + schema: + allOf: + - $ref: '#/components/schemas/TemplateSummary' + - type: object + required: + - message + - code + properties: + message: + type: string + code: + type: string + '500': + description: | + Internal server error. + + #### InfluxDB Cloud + + - Returns this error if creating one of the template + resources (bucket, dashboard, task, user) exceeds your plan’s + adjustable service quotas. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + createExceedsQuota: + summary: 'InfluxDB Cloud: Creating resource would exceed quota.' + value: + code: internal error + message: "resource_type=\"tasks\" err=\"failed to apply resource\"\n\tmetadata_name=\"alerting-gates-b84003\" err_msg=\"failed to create tasks[\\\"alerting-gates-b84003\\\"]: creating task would exceed quota\"" default: description: Unexpected error content: @@ -3507,12 +6113,17 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - '/tasks/{taskID}': + '/tasks/{taskID}/runs': get: - operationId: GetTasksID + operationId: GetTasksIDRuns tags: - Tasks - summary: Retrieve a task + summary: List runs for a task + description: | + Retrieves a list of runs for a [task](https://docs.influxdata.com/influxdb/v2.3/process-data/). + + To limit which task runs are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all task runs up to the default `limit`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3520,96 +6131,14 @@ paths: schema: type: string required: true - description: The task ID. - responses: - '200': - description: Task details - content: - application/json: - schema: - $ref: '#/components/schemas/Task' - default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - patch: - operationId: PatchTasksID - tags: - - Tasks - summary: Update a task - description: Update a task. This will cancel all queued runs. - requestBody: - description: Task update to apply - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TaskUpdateRequest' - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: taskID - schema: - type: string - required: true - description: The task ID. - responses: - '200': - description: Task updated - content: - application/json: - schema: - $ref: '#/components/schemas/Task' - default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - delete: - operationId: DeleteTasksID - tags: - - Tasks - summary: Delete a task - description: Deletes a task and all associated records - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: taskID - schema: - type: string - required: true - description: The ID of the task to delete. - responses: - '204': - description: Task deleted - default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - '/tasks/{taskID}/runs': - get: - operationId: GetTasksIDRuns - tags: - - Tasks - summary: List runs for a task - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: taskID - schema: - type: string - required: true - description: The ID of the task to get runs for. + description: | + The ID of the task to get runs for. + Only returns runs for this task. - in: query name: after schema: type: string - description: Returns runs after a specific ID. + description: A task run ID. Only returns runs created after this run. - in: query name: limit schema: @@ -3617,37 +6146,52 @@ paths: minimum: 1 maximum: 500 default: 100 - description: The number of runs to return + description: | + Limits the number of task runs returned. Default is `100`. - in: query name: afterTime schema: type: string format: date-time - description: 'Filter runs to those scheduled after this time, RFC3339' + description: | + A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + Only returns runs scheduled after this time. - in: query name: beforeTime schema: type: string format: date-time - description: 'Filter runs to those scheduled before this time, RFC3339' + description: | + A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + Only returns runs scheduled before this time. responses: '200': - description: A list of task runs + description: Success. The response body contains the list of task runs. content: application/json: schema: $ref: '#/components/schemas/Runs' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostTasksIDRuns tags: + - Data I/O endpoints - Tasks - summary: 'Manually start a task run, overriding the current schedule' + summary: 'Start a task run, overriding the schedule' + description: | + Schedules a task run to start immediately, ignoring scheduled runs. + + Use this endpoint to manually start a task run. + Scheduled runs will continue to run as scheduled. + This may result in concurrently running tasks. + + To _retry_ a previous run (and avoid creating a new run), + use the [`POST /api/v2/tasks/{taskID}/runs/{runID}/retry`](#operation/PostTasksIDRunsIDRetry) endpoint. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3662,23 +6206,27 @@ paths: $ref: '#/components/schemas/RunManually' responses: '201': - description: Run scheduled to start + description: Success. The run is scheduled to start. content: application/json: schema: $ref: '#/components/schemas/Run' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/runs/{runID}': get: operationId: GetTasksIDRunsID tags: - Tasks - summary: Retrieve a single run for a task + summary: Retrieve a run for a task. + description: | + Retrieves a specific run for a [task](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#task). + + Use this endpoint to retrieve detail and logs for a specific task run. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3686,31 +6234,66 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to retrieve runs for. - in: path name: runID schema: type: string required: true - description: The run ID. + description: The ID of the run to retrieve. responses: '200': - description: The run record + description: Success. The response body contains the task run. content: application/json: schema: $ref: '#/components/schemas/Run' + examples: + runSuccess: + summary: A successful task run. + value: + links: + logs: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000/logs + retry: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000/retry + self: /api/v2/tasks/0996e56b2f378000/runs/09b070dadaa7d000 + task: /api/v2/tasks/0996e56b2f378000 + id: 09b070dadaa7d000 + taskID: 0996e56b2f378000 + status: success + scheduledFor: '2022-07-18T14:46:06Z' + startedAt: '2022-07-18T14:46:07.16222Z' + finishedAt: '2022-07-18T14:46:07.308254Z' + requestedAt: '2022-07-18T14:46:06Z' + log: + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.101231Z' + message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.242859Z' + message: Completed(success) + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' delete: operationId: DeleteTasksIDRunsID tags: - Tasks summary: Cancel a running task + description: | + Cancels a running [task](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#task). + + Use this endpoint with InfluxDB OSS to cancel a running task. + + #### InfluxDB Cloud + + - Doesn't support this operation. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3718,28 +6301,61 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to cancel. - in: path name: runID schema: type: string required: true - description: The run ID. + description: The ID of the task run to cancel. responses: '204': - description: Delete has been accepted - default: - description: Unexpected error + description: | + Success. The `DELETE` is accepted and the run will be cancelled. + + #### InfluxDB Cloud + + - Doesn't support this operation. + - Doesn't return this status. + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '405': + description: | + Method not allowed. + + #### InfluxDB Cloud + + - Always returns this error; doesn't support cancelling tasks. + + #### InfluxDB OSS + + - Doesn't return this error. content: application/json: schema: $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' + default: + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/runs/{runID}/retry': post: operationId: PostTasksIDRunsIDRetry tags: - Tasks summary: Retry a task run + description: | + Queues a task run to retry and returns the newly scheduled run. + + To manually start a _new_ task run, use the [`POST /api/v2/tasks/{taskID}/runs`](#operation/PostTasksIDRuns) endpoint. + + #### Limitations + + - The task must be _active_ (`status: "active"`). requestBody: content: application/json; charset=utf-8: @@ -3752,32 +6368,74 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to retry. - in: path name: runID schema: type: string required: true - description: The run ID. + description: The ID of the task run to retry. responses: '200': - description: Run that has been queued + description: Success. The response body contains the queued run. content: application/json: schema: $ref: '#/components/schemas/Run' - default: - description: Unexpected error + examples: + retryTaskRun: + summary: A task run scheduled to retry + value: + links: + logs: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000/logs + retry: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000/retry + self: /api/v2/tasks/09a776832f381000/runs/09d60ffe08738000 + task: /api/v2/tasks/09a776832f381000 + id: 09d60ffe08738000 + taskID: 09a776832f381000 + status: scheduled + scheduledFor: '2022-08-15T00:00:00Z' + requestedAt: '2022-08-16T20:05:11.84145Z' + '400': + description: | + Bad request. + The response body contains detail about the error. + + InfluxDB may return this error for the following reasons: + + - The task has `status: inactive`. content: application/json: schema: $ref: '#/components/schemas/Error' + examples: + inactiveTask: + summary: Can't retry an inactive task + value: + code: invalid + message: 'failed to retry run: inactive task' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/logs': get: operationId: GetTasksIDLogs tags: - Tasks summary: Retrieve all logs for a task + description: | + Retrieves a list of all logs for a [task](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#task). + + When an InfluxDB task runs, a “run” record is created in the task’s history. + Logs associated with each run provide relevant log messages, timestamps, and the exit status of the run attempt. + + Use this endpoint to retrieve only the log events for a task, + without additional task metadata. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3788,23 +6446,59 @@ paths: description: The task ID. responses: '200': - description: All logs for a task + description: | + Success. The response body contains an `events` list with logs for the task. + Each log event `message` contains detail about the event. + If a task run fails, InfluxDB logs an event with the reason for the failure. content: application/json: schema: $ref: '#/components/schemas/Logs' + examples: + taskSuccess: + summary: Events for a successful task run. + value: + events: + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.101231Z' + message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.242859Z' + message: Completed(success) + taskFailure: + summary: Events for a failed task run. + value: + events: + - runID: 09a946fc3167d000 + time: '2022-07-13T07:06:54.198167Z' + message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"' + - runID: 09a946fc3167d000 + time: '2022-07-13T07:07:13.104037Z' + message: Completed(failed) + - runID: 09a946fc3167d000 + time: '2022-07-13T08:24:37.115323Z' + message: 'error exhausting result iterator: error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/runs/{runID}/logs': get: operationId: GetTasksIDRunsIDLogs tags: - Tasks summary: Retrieve all logs for a run + description: | + Retrieves all logs for a task run. + A log is a list of run events with `runID`, `time`, and `message` properties. + + Use this endpoint to help analyze task performance and troubleshoot failed task runs. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3812,32 +6506,67 @@ paths: schema: type: string required: true - description: ID of task to get logs for. + description: The ID of the task to get logs for. - in: path name: runID schema: type: string required: true - description: ID of run to get logs for. + description: The ID of the run to get logs for. responses: '200': - description: All logs for a run + description: | + Success. The response body contains an `events` list with logs for the task run. + Each log event `message` contains detail about the event. + If a run fails, InfluxDB logs an event with the reason for the failure. content: application/json: schema: $ref: '#/components/schemas/Logs' + examples: + taskSuccess: + summary: Events for a successful task run. + value: + events: + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.101231Z' + message: 'Started task from script: "option task = {name: \"task1\", every: 30m} from(bucket: \"iot_center\") |> range(start: -90d) |> filter(fn: (r) => r._measurement == \"environment\") |> aggregateWindow(every: 1h, fn: mean)"' + - runID: 09b070dadaa7d000 + time: '2022-07-18T14:46:07.242859Z' + message: Completed(success) + taskFailure: + summary: Events for a failed task. + value: + events: + - runID: 09a946fc3167d000 + time: '2022-07-13T07:06:54.198167Z' + message: 'Started task from script: "option task = {name: \"test task\", every: 3d, offset: 0s}"' + - runID: 09a946fc3167d000 + time: '2022-07-13T07:07:13.104037Z' + message: Completed(failed) + - runID: 09a946fc3167d000 + time: '2022-07-13T08:24:37.115323Z' + message: 'error exhausting result iterator: error in query specification while starting program: this Flux script returns no streaming data. Consider adding a "yield" or invoking streaming functions directly, without performing an assignment' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/labels': get: operationId: GetTasksIDLabels tags: - Tasks - summary: List all labels for a task + summary: List labels for a task + description: | + Retrieves a list of all labels for a task. + + Labels may be used for grouping and filtering tasks. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3845,25 +6574,33 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to retrieve labels for. responses: '200': - description: A list of all labels for a task + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: $ref: '#/components/schemas/LabelsResponse' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostTasksIDLabels tags: - Tasks summary: Add a label to a task + description: | + Adds a label to a task. + + Use this endpoint to add a label that you can use to filter tasks in the InfluxDB UI. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3871,9 +6608,9 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to label. requestBody: - description: Label to add + description: An object that contains a _`labelID`_ to add to the task. required: true content: application/json: @@ -3881,23 +6618,29 @@ paths: $ref: '#/components/schemas/LabelMapping' responses: '201': - description: A list of all labels for a task + description: Success. The response body contains a list of all labels for the task. content: application/json: schema: $ref: '#/components/schemas/LabelResponse' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' '/tasks/{taskID}/labels/{labelID}': delete: operationId: DeleteTasksIDLabelsID tags: - Tasks summary: Delete a label from a task + description: | + Deletes a label from a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -3905,28 +6648,26 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to delete the label from. - in: path name: labelID schema: type: string required: true - description: The label ID. + description: The ID of the label to delete. responses: '204': - description: Delete has been accepted + description: Success. The label is deleted. + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' '404': - description: Task not found - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' /flags: get: operationId: GetFlags @@ -3958,29 +6699,34 @@ paths: - $ref: '#/components/parameters/TraceSpan' responses: '200': - description: The currently authenticated user. + description: Success. The response body contains the currently authenticated user. content: application/json: schema: $ref: '#/components/schemas/UserResponse' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' /me/password: put: operationId: PutMePassword tags: - Users summary: Update a password + description: | + #### InfluxDB Cloud + + InfluxDB Cloud doesn't support changing user passwords through the API. + Use the InfluxDB Cloud user interface to update your password. security: - BasicAuthentication: [] parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: New password + description: The new password. required: true content: application/json: @@ -3988,7 +6734,11 @@ paths: $ref: '#/components/schemas/PasswordResetBody' responses: '204': - description: Password successfully updated + description: Success. The password was updated. + '400': + description: | + Bad request. + InfluxDB Cloud doesn't support changing passwords through the API and always responds with this status. default: description: Unsuccessful authentication content: @@ -3998,9 +6748,13 @@ paths: '/tasks/{taskID}/members': get: operationId: GetTasksIDMembers + deprecated: true tags: - Tasks summary: List all task members + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4011,7 +6765,9 @@ paths: description: The task ID. responses: '200': - description: A list of users who have member privileges for a task + description: | + Success. The response body contains a list of `users` that have + the `member` role for a task. content: application/json: schema: @@ -4024,9 +6780,16 @@ paths: $ref: '#/components/schemas/Error' post: operationId: PostTasksIDMembers + deprecated: true tags: - Tasks summary: Add a member to a task + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + Adds a user to members of a task and returns the newly created member with + role and user detail. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4036,7 +6799,7 @@ paths: required: true description: The task ID. requestBody: - description: User to add as member + description: A user to add as a member of the task. required: true content: application/json: @@ -4044,7 +6807,7 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: Added to task members + description: Created. The user is added to task members. content: application/json: schema: @@ -4058,9 +6821,13 @@ paths: '/tasks/{taskID}/members/{userID}': delete: operationId: DeleteTasksIDMembersID + deprecated: true tags: - Tasks summary: Remove a member from a task + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4087,9 +6854,15 @@ paths: '/tasks/{taskID}/owners': get: operationId: GetTasksIDOwners + deprecated: true tags: - Tasks summary: List all owners of a task + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + Retrieves all users that have owner permission for a task. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4097,25 +6870,54 @@ paths: schema: type: string required: true - description: The task ID. + description: The ID of the task to retrieve owners for. responses: '200': - description: A list of users who have owner privileges for a task + description: | + Success. + The response contains a list of `users` that have the `owner` role for the task. + + If the task has no owners, the response contains an empty `users` array. content: application/json: schema: $ref: '#/components/schemas/ResourceOwners' - default: - description: Unexpected error + '401': + $ref: '#/components/responses/AuthorizationError' + '422': + description: | + Unprocessable entity. + + The error may indicate one of the following problems: + + - The request body isn't valid--the request is well-formed, but InfluxDB can't process it due to semantic errors. + - You passed a parameter combination that InfluxDB doesn't support. content: application/json: schema: $ref: '#/components/schemas/Error' - post: - operationId: PostTasksIDOwners + '500': + $ref: '#/components/responses/InternalServerError' + default: + description: Unexpected error + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + post: + operationId: PostTasksIDOwners + deprecated: true tags: - Tasks - summary: Add an owner to a task + summary: Add an owner for a task + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. + + Assigns a task `owner` role to a user. + + Use this endpoint to create a _resource owner_ for the task. + A _resource owner_ is a user with `role: owner` for a specific resource. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4125,7 +6927,7 @@ paths: required: true description: The task ID. requestBody: - description: User to add as owner + description: A user to add as an owner of the task. required: true content: application/json: @@ -4133,11 +6935,41 @@ paths: $ref: '#/components/schemas/AddResourceMemberRequestBody' responses: '201': - description: Added to task owners + description: | + Created. The task `owner` role is assigned to the user. + The response body contains the resource owner with + role and user detail. content: application/json: schema: $ref: '#/components/schemas/ResourceOwner' + examples: + createdOwner: + summary: User has the owner role for the resource + value: + role: owner + links: + logs: /api/v2/users/0772396d1f411000/logs + self: /api/v2/users/0772396d1f411000 + id: 0772396d1f411000 + name: USER_NAME + status: active + '401': + $ref: '#/components/responses/AuthorizationError' + '422': + description: | + Unprocessable entity. + + The error may indicate one of the following problems: + + - The request body isn't valid--the request is well-formed, but InfluxDB can't process it due to semantic errors. + - You passed a parameter combination that InfluxDB doesn't support. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: @@ -4147,9 +6979,13 @@ paths: '/tasks/{taskID}/owners/{userID}': delete: operationId: DeleteTasksIDOwnersID + deprecated: true tags: - Tasks summary: Remove an owner from a task + description: | + **Deprecated**: Tasks don't use `owner` and `member` roles. + Use [`/api/v2/authorizations`](#tag/Authorizations) to assign user permissions. parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -4177,8 +7013,14 @@ paths: post: operationId: PostUsersIDPassword tags: + - Security and access endpoints - Users summary: Update a password + description: | + #### InfluxDB Cloud + + InfluxDB Cloud doesn't support changing user passwords through the API. + Use the InfluxDB Cloud user interface to update your password. security: - BasicAuthentication: [] parameters: @@ -4199,6 +7041,10 @@ paths: responses: '204': description: Password successfully updated + '400': + description: | + Bad request. + InfluxDB Cloud doesn't support changing passwords through the API and always responds with this status. default: description: Unsuccessful authentication content: @@ -5141,488 +7987,1269 @@ paths: application/json: schema: $ref: '#/components/schemas/Error' - /health: + /debug/pprof/all: get: - operationId: GetHealth + operationId: GetDebugPprofAllProfiles tags: - - Health - summary: Get the health of an instance + - Debug + - System information endpoints + summary: Retrieve all runtime profiles + description: | + Collects samples and returns reports for the following [Go runtime profiles](https://pkg.go.dev/runtime/pprof): + + - **allocs**: All past memory allocations + - **block**: Stack traces that led to blocking on synchronization primitives + - **cpu**: (Optional) Program counters sampled from the executing stack. + Include by passing the `cpu` query parameter with a [duration](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#duration) value. + Equivalent to the report from [`GET /debug/pprof/profile?seconds=NUMBER_OF_SECONDS`](#operation/GetDebugPprofProfile). + - **goroutine**: All current goroutines + - **heap**: Memory allocations for live objects + - **mutex**: Holders of contended mutexes + - **threadcreate**: Stack traces that led to the creation of new OS threads + x-codeSamples: + - lang: Shell + label: 'Shell: Get all profiles' + source: | + # Download and extract a `tar.gz` of all profiles after 10 seconds of CPU sampling. + + curl "http://localhost:8086/debug/pprof/all?cpu=10s" | tar -xz + + # x profiles/cpu.pb.gz + # x profiles/goroutine.pb.gz + # x profiles/block.pb.gz + # x profiles/mutex.pb.gz + # x profiles/heap.pb.gz + # x profiles/allocs.pb.gz + # x profiles/threadcreate.pb.gz + + # Analyze a profile. + + go tool pprof profiles/heap.pb.gz + - lang: Shell + label: 'Shell: Get all profiles except CPU' + source: | + # Download and extract a `tar.gz` of all profiles except CPU. + + curl http://localhost:8086/debug/pprof/all | tar -xz + + # x profiles/goroutine.pb.gz + # x profiles/block.pb.gz + # x profiles/mutex.pb.gz + # x profiles/heap.pb.gz + # x profiles/allocs.pb.gz + # x profiles/threadcreate.pb.gz + + # Analyze a profile. + + go tool pprof profiles/heap.pb.gz servers: - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' + - in: query + name: cpu + description: | + Collects and returns CPU profiling data for the specified [duration](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#duration). + schema: + type: string + format: duration + externalDocs: + description: InfluxDB duration + url: 'https://docs.influxdata.com/influxdb/latest/reference/glossary/#duration' responses: '200': - description: The instance is healthy. - content: - application/json: - schema: - $ref: '#/components/schemas/HealthCheck' - '503': - description: The instance is unhealthy. + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) reports. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/HealthCheck' + description: | + GZIP compressed TAR file (`.tar.gz`) that contains + [Go runtime profile](https://pkg.go.dev/runtime/pprof) reports. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - /metrics: + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/allocs: get: - operationId: GetMetrics + operationId: GetDebugPprofAllocs tags: - - Metrics - summary: Get metrics of an instance + - Debug + - System information endpoints + summary: Retrieve the memory allocations runtime profile + description: | + Returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of + all past memory allocations. + **allocs** is the same as the **heap** profile, + but changes the default [pprof](https://pkg.go.dev/runtime/pprof) + display to __-alloc_space__, + the total number of bytes allocated since the program began (including garbage-collected bytes). + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/allocs + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N memory allocations. + + (pprof) top10 servers: - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - responses: - '200': + - in: query + name: debug description: | - Payload body contains metrics about the InfluxDB instance. + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as human-readable text. + The report contains comments that translate addresses to function names and line numbers for debugging. - Metrics are formatted in the - Prometheus [plain-text exposition format](https://prometheus.io/docs/instrumenting/exposition_formats). - Each metric is identified by its name and a set of optional key-value pairs. - - The following descriptors precede each metric: + `debug=1` is mutually exclusive with the `seconds` query parameter. + schema: + type: integer + format: int64 + enum: + - 0 + - 1 + - in: query + name: seconds + description: | + Number of seconds to collect statistics. - - *`HELP`*: description of the metric - - *`TYPE`*: type of the metric (e.g. `counter`, `gauge`, `histogram`, or `summary`) + `seconds` is mutually exclusive with `debug=1`. + schema: + type: string + format: int64 + responses: + '200': + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. content: + application/octet-stream: + schema: + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' text/plain: schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. type: string - format: Prometheus text-based exposition + format: Go runtime profile externalDocs: - description: Prometheus exposition formats - url: 'https://prometheus.io/docs/instrumenting/exposition_formats' - examples: - expositionResponse: - summary: Metrics in plain text - value: | - # HELP go_threads Number of OS threads created. - # TYPE go_threads gauge - go_threads 19 - # HELP http_api_request_duration_seconds Time taken to respond to HTTP request - # TYPE http_api_request_duration_seconds histogram - http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.005"} 4 - http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.01"} 4 - http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.025"} 5 + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - /ready: + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/block: get: - operationId: GetReady + operationId: GetDebugPprofBlock tags: - - Ready - summary: Get the readiness of an instance at startup + - Debug + - System information endpoints + summary: Retrieve the block runtime profile + description: | + Collects samples and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) + report of stack traces that led to blocking on synchronization primitives. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/block + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N entries. + + (pprof) top10 servers: - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - responses: - '200': - description: The instance is ready - content: - application/json: - schema: - $ref: '#/components/schemas/Ready' - default: - description: Unexpected error - $ref: '#/components/responses/ServerError' - /users: - get: - operationId: GetUsers - tags: - - Users - summary: List all users - parameters: - - $ref: '#/components/parameters/TraceSpan' - - $ref: '#/components/parameters/Offset' - - $ref: '#/components/parameters/Limit' - - $ref: '#/components/parameters/After' - in: query - name: name + name: debug + description: | + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as human-readable text. + The report contains comments that translate addresses to function names and line numbers for debugging. + + `debug=1` is mutually exclusive with the `seconds` query parameter. schema: - type: string + type: integer + format: int64 + enum: + - 0 + - 1 - in: query - name: id + name: seconds + description: | + Number of seconds to collect statistics. + + `seconds` is mutually exclusive with `debug=1`. schema: type: string + format: int64 responses: '200': - description: A list of users + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/Users' + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + text/plain: + schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. + type: string + format: Go runtime profile + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - post: - operationId: PostUsers + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/cmdline: + get: + operationId: GetDebugPprofCmdline tags: - - Users - summary: Create a user + - Debug + - System information endpoints + summary: Retrieve the command line invocation + description: | + Returns the command line that invoked InfluxDB. + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: User to create - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/User' responses: - '201': - description: User created + '200': + description: Command line invocation. content: - application/json: + text/plain: schema: - $ref: '#/components/schemas/UserResponse' + type: string + format: Command line default: description: Unexpected error - $ref: '#/components/responses/ServerError' - '/users/{userID}': + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/goroutine: get: - operationId: GetUsersID + operationId: GetDebugPprofGoroutine tags: - - Users - summary: Retrieve a user + - Debug + - System information endpoints + summary: Retrieve the goroutines runtime profile + description: | + Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) + report of all current goroutines. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/goroutine + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N entries. + + (pprof) top10 + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - - in: path - name: userID + - in: query + name: debug + description: | + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as + human-readable text with comments that translate addresses to + function names and line numbers for debugging. + + `debug=1` is mutually exclusive with the `seconds` query parameter. + schema: + type: integer + format: int64 + enum: + - 0 + - 1 + - in: query + name: seconds + description: | + Number of seconds to collect statistics. + + `seconds` is mutually exclusive with `debug=1`. schema: type: string - required: true - description: The user ID. + format: int64 responses: '200': - description: User details + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/UserResponse' + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + text/plain: + schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. + type: string + format: Go runtime profile + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - patch: - operationId: PatchUsersID + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/heap: + get: + operationId: GetDebugPprofHeap tags: - - Users - summary: Update a user - requestBody: - description: User update to apply - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/User' + - Debug + - System information endpoints + summary: Retrieve the heap runtime profile + description: | + Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) + report of memory allocations for live objects. + + To run **garbage collection** before sampling, + pass the `gc` query parameter with a value of `1`. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/heap + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N memory-intensive nodes. + + (pprof) top10 + + # pprof displays the list: + # Showing nodes accounting for 142.46MB, 85.43% of 166.75MB total + # Dropped 895 nodes (cum <= 0.83MB) + # Showing top 10 nodes out of 143 + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - - in: path - name: userID + - in: query + name: debug + description: | + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as human-readable text. + The report contains comments that translate addresses to function names and line numbers for debugging. + + `debug=1` is mutually exclusive with the `seconds` query parameter. schema: - type: string - required: true - description: The ID of the user to update. - responses: - '200': - description: User updated + type: integer + format: int64 + enum: + - 0 + - 1 + - in: query + name: seconds + description: | + Number of seconds to collect statistics. + + `seconds` is mutually exclusive with `debug=1`. + schema: + type: string + format: int64 + - in: query + name: gc + description: | + - `0`: (Default) don't force garbage collection before sampling. + - `1`: Force garbage collection before sampling. + schema: + type: integer + format: int64 + enum: + - 0 + - 1 + responses: + '200': + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/UserResponse' + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + text/plain: + schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. + type: string + format: Go runtime profile + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + examples: + profileDebugResponse: + summary: Profile in plain text + value: "heap profile: 12431: 137356528 [149885081: 846795139976] @ heap/8192\n23: 17711104 [46: 35422208] @ 0x4c6df65 0x4ce03ec 0x4cdf3c5 0x4c6f4db 0x4c9edbc 0x4bdefb3 0x4bf822a 0x567d158 0x567ced9 0x406c0a1\n#\t0x4c6df64\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*entry).add+0x1a4\t\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/cache.go:97\n#\t0x4ce03eb\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*partition).write+0x2ab\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/ring.go:229\n#\t0x4cdf3c4\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*ring).write+0xa4\t\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/ring.go:95\n#\t0x4c6f4da\tgithub.com/influxdata/influxdb/v2/tsdb/engine/tsm1.(*Cache).WriteMulti+0x31a\t\t\t\t/Users/me/github/influxdb/tsdb/engine/tsm1/cache.go:343\n" default: description: Unexpected error - $ref: '#/components/responses/ServerError' - delete: - operationId: DeleteUsersID + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/mutex: + get: + operationId: GetDebugPprofMutex tags: - - Users - summary: Delete a user + - Debug + - System information endpoints + summary: Retrieve the mutual exclusion (mutex) runtime profile + description: | + Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) report of + lock contentions. + The profile contains stack traces of holders of contended mutual exclusions (mutexes). + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/mutex + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N entries. + + (pprof) top10 + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - - in: path - name: userID + - in: query + name: debug + description: | + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as human-readable text. + The report contains comments that translate addresses to function names and line numbers for debugging. + + `debug=1` is mutually exclusive with the `seconds` query parameter. + schema: + type: integer + format: int64 + enum: + - 0 + - 1 + - in: query + name: seconds + description: | + Number of seconds to collect statistics. + + `seconds` is mutually exclusive with `debug=1`. schema: type: string - required: true - description: The ID of the user to delete. + format: int64 responses: - '204': - description: User deleted + '200': + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. + content: + application/octet-stream: + schema: + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + text/plain: + schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. + type: string + format: Go runtime profile + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - /setup: + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/profile: get: - operationId: GetSetup + operationId: GetDebugPprofProfile tags: - - Setup - summary: 'Check if database has default user, org, bucket' - description: 'Returns `true` if no default user, organization, or bucket has been created.' + - Debug + - System information endpoints + summary: Retrieve the CPU runtime profile + description: | + Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) + report of program counters on the executing stack. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Download the profile report. + + curl http://localhost:8086/debug/pprof/profile -o cpu + + # Analyze the profile in interactive mode. + + go tool pprof ./cpu + + # At the prompt, get the top N functions most often running + # or waiting during the sample period. + + (pprof) top10 + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' + - in: query + name: seconds + description: Number of seconds to collect profile data. Default is `30` seconds. + schema: + type: string + format: int64 responses: '200': - description: allowed true or false + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/IsOnboarding' - post: - operationId: PostSetup + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/threadcreate: + get: + operationId: GetDebugPprofThreadCreate tags: - - Setup - summary: 'Set up initial user, org and bucket' - description: 'Post an onboarding request to set up initial user, org and bucket.' + - Debug + - System information endpoints + summary: Retrieve the threadcreate runtime profile + description: | + Collects statistics and returns a [Go runtime profile](https://pkg.go.dev/runtime/pprof) + report of stack traces that led to the creation of new OS threads. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool pprof' + source: | + # Analyze the profile in interactive mode. + + go tool pprof http://localhost:8086/debug/pprof/threadcreate + + # `pprof` returns the following prompt: + # Entering interactive mode (type "help" for commands, "o" for options) + # (pprof) + + # At the prompt, get the top N entries. + + (pprof) top10 + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: Source to create - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/OnboardingRequest' + - in: query + name: debug + description: | + - `0`: (Default) Return the report as a gzip-compressed protocol buffer. + - `1`: Return a response body with the report formatted as human-readable text. + The report contains comments that translate addresses to function names and line numbers for debugging. + + `debug=1` is mutually exclusive with the `seconds` query parameter. + schema: + type: integer + format: int64 + enum: + - 0 + - 1 + - in: query + name: seconds + description: | + Number of seconds to collect statistics. + + `seconds` is mutually exclusive with `debug=1`. + schema: + type: string + format: int64 responses: - '201': - description: 'Created default user, bucket, org' + '200': + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report compatible + with [pprof](https://github.com/google/pprof) analysis and visualization tools. + If debug is enabled (`?debug=1`), response body contains a human-readable profile. content: - application/json: + application/octet-stream: schema: - $ref: '#/components/schemas/OnboardingResponse' + description: | + [Go runtime profile](https://pkg.go.dev/runtime/pprof) report in protocol buffer format. + type: string + format: binary + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + text/plain: + schema: + description: | + Response body contains a report formatted in plain text. + The report contains comments that translate addresses to + function names and line numbers for debugging. + type: string + format: Go runtime profile + externalDocs: + description: Golang pprof package + url: 'https://pkg.go.dev/net/http/pprof' + examples: + profileDebugResponse: + summary: Profile in plain text + value: "threadcreate profile: total 26\n25 @\n#\t0x0\n\n1 @ 0x403dda8 0x403e54b 0x403e810 0x403a90c 0x406c0a1\n#\t0x403dda7\truntime.allocm+0xc7\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:1877\n#\t0x403e54a\truntime.newm+0x2a\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:2201\n#\t0x403e80f\truntime.startTemplateThread+0x8f\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:2271\n#\t0x403a90b\truntime.main+0x1cb\t\t\t/Users/me/.gvm/gos/go1.17/src/runtime/proc.go:234\n" default: description: Unexpected error - $ref: '#/components/responses/ServerError' - /authorizations: + $ref: '#/components/responses/GeneralServerError' + /debug/pprof/trace: get: - operationId: GetAuthorizations + operationId: GetDebugPprofTrace tags: - - Authorizations - summary: List all authorizations + - Debug + - System information endpoints + summary: Retrieve the runtime execution trace + description: | + Collects profile data and returns trace execution events for the current program. + x-codeSamples: + - lang: Shell + label: 'Shell: go tool trace' + source: | + # Download the trace file. + + curl http://localhost:8086/debug/pprof/trace -o trace + + # Analyze the trace. + + go tool trace ./trace + servers: + - url: '' parameters: - $ref: '#/components/parameters/TraceSpan' - in: query - name: userID + name: seconds + description: Number of seconds to collect profile data. schema: type: string - description: Only show authorizations that belong to a user ID. - - in: query - name: user - schema: - type: string - description: Only show authorizations that belong to a user name. + format: int64 + responses: + '200': + description: | + [Trace file](https://pkg.go.dev/runtime/trace) compatible + with the [Golang `trace` command](https://pkg.go.dev/cmd/trace). + content: + application/octet-stream: + schema: + type: string + format: binary + externalDocs: + description: Golang trace package + url: 'https://pkg.go.dev/runtime/trace' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /health: + get: + operationId: GetHealth + tags: + - Health + - System information endpoints + summary: Retrieve the health of the instance + description: Returns the health of the instance. + servers: + - url: '' + parameters: + - $ref: '#/components/parameters/TraceSpan' + responses: + '200': + description: | + The instance is healthy. + The response body contains the health check items and status. + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheck' + '503': + description: The instance is unhealthy. + content: + application/json: + schema: + $ref: '#/components/schemas/HealthCheck' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /metrics: + get: + operationId: GetMetrics + tags: + - Metrics + - System information endpoints + summary: Retrieve workload performance metrics + description: | + Returns metrics about the workload performance of an InfluxDB instance. + + Use this endpoint to get performance, resource, and usage metrics. + + #### Related guides + + - For the list of metrics categories, see [InfluxDB OSS metrics](https://docs.influxdata.com/influxdb/v2.3/reference/internals/metrics/). + - Learn how to use InfluxDB to [scrape Prometheus metrics](https://docs.influxdata.com/influxdb/v2.3/write-data/developer-tools/scrape-prometheus-metrics/). + - Learn how InfluxDB [parses the Prometheus exposition format](https://docs.influxdata.com/influxdb/v2.3/reference/prometheus-metrics/). + servers: + - url: '' + parameters: + - $ref: '#/components/parameters/TraceSpan' + responses: + '200': + description: | + Success. The response body contains metrics in + [Prometheus plain-text exposition format](https://prometheus.io/docs/instrumenting/exposition_formats) + Metrics contain a name, an optional set of key-value pairs, and a value. + + The following descriptors precede each metric: + + - `HELP`: description of the metric + - `TYPE`: [Prometheus metric type](https://prometheus.io/docs/concepts/metric_types/) (`counter`, `gauge`, `histogram`, or `summary`) + content: + text/plain: + schema: + type: string + format: Prometheus text-based exposition + externalDocs: + description: Prometheus exposition formats + url: 'https://prometheus.io/docs/instrumenting/exposition_formats' + examples: + expositionResponse: + summary: Metrics in plain text + value: | + # HELP go_threads Number of OS threads created. + # TYPE go_threads gauge + go_threads 19 + # HELP http_api_request_duration_seconds Time taken to respond to HTTP request + # TYPE http_api_request_duration_seconds histogram + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.005"} 4 + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.01"} 4 + http_api_request_duration_seconds_bucket{handler="platform",method="GET",path="/:fallback_path",response_code="200",status="2XX",user_agent="curl",le="0.025"} 5 + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /ready: + get: + operationId: GetReady + tags: + - Ready + - System information endpoints + summary: Get the readiness of an instance at startup + servers: + - url: '' + parameters: + - $ref: '#/components/parameters/TraceSpan' + responses: + '200': + description: The instance is ready + content: + application/json: + schema: + $ref: '#/components/schemas/Ready' + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /users: + get: + operationId: GetUsers + tags: + - Security and access endpoints + - Users + summary: List users + description: | + Retrieves a list of users. Default limit is `20`. + + To limit which users are returned, pass query parameters in your request. + + #### Required permissions + + - `read-user USER_ID` permission. + `USER_ID` is the ID of the user that you want to list. + - InfluxDB OSS requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token))_ to list all users. + parameters: + - $ref: '#/components/parameters/TraceSpan' + - $ref: '#/components/parameters/Offset' + - $ref: '#/components/parameters/Limit' + - $ref: '#/components/parameters/After' - in: query - name: orgID + name: name schema: type: string - description: Only show authorizations that belong to an organization ID. - in: query - name: org + name: id schema: type: string - description: Only show authorizations that belong to a organization name. responses: '200': - description: A list of authorizations + description: Success. The response contains a list of `users`. content: application/json: schema: - $ref: '#/components/schemas/Authorizations' + $ref: '#/components/schemas/Users' + '401': + description: | + Unauthorized. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + tokenNotAuthorized: + summary: 'API token doesn''t have `write:users` permission' + value: + code: unauthorized + message: 'write:users/09d8462ce0764000 is unauthorized' + '422': + description: | + Unprocessable entity. + + The error may indicate one of the following problems: + + - The request body isn't valid--the request is well-formed, but InfluxDB can't process it due to semantic errors. + - You passed a parameter combination that InfluxDB doesn't support. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' post: - operationId: PostAuthorizations + operationId: PostUsers tags: - - Authorizations - summary: Create an authorization + - Users + summary: Create a user + description: | + Creates a user and returns the newly created user. + + #### Required permissions + + - `write-users`. Requires an InfluxDB API **Op** token. parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: Authorization to create + description: The user to create. required: true content: application/json: schema: - $ref: '#/components/schemas/AuthorizationPostRequest' + $ref: '#/components/schemas/User' responses: '201': - description: Authorization created + description: | + Success. + The response contains the newly created user. content: application/json: schema: - $ref: '#/components/schemas/Authorization' - '400': - description: Invalid request - $ref: '#/components/responses/ServerError' + $ref: '#/components/schemas/UserResponse' + '401': + description: | + Unauthorized. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + tokenNotAuthorized: + summary: 'API token doesn''t have `write:users` permission' + value: + code: unauthorized + message: 'write:users/09d8462ce0764000 is unauthorized' + '422': + description: | + Unprocessable entity. + + The error may indicate one of the following problems: + + - The request body isn't valid--the request is well-formed, but InfluxDB can't process it due to semantic errors. + - You passed a parameter combination that InfluxDB doesn't support. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - '/authorizations/{authID}': + $ref: '#/components/responses/GeneralServerError' + x-codeSamples: + - label: 'cURL: create a user and set a password' + lang: Shell + source: | + # Create the user and assign the user ID to a variable. + USER_ID=$(curl --request POST \ + "http://localhost:8086/api/v2/users/" \ + --header "Authorization: Token INFLUX_OP_TOKEN" \ + --header 'Content-type: application/json' \ + --data-binary @- << EOF | jq -r '.id' + { + "name": "USER_NAME", + "status": "active" + } + EOF + ) + + # Pass the user ID and a password to set the password for the user. + curl request POST "http://localhost:8086/api/v2/users/$USER_ID/password/" \ + --header "Authorization: Token INFLUX_OP_TOKEN" \ + --header 'Content-type: application/json' \ + --data '{ "password": "USER_PASSWORD" }' + '/users/{userID}': get: - operationId: GetAuthorizationsID + operationId: GetUsersID tags: - - Authorizations - summary: Retrieve an authorization + - Security and access endpoints + - Users + summary: Retrieve a user parameters: - $ref: '#/components/parameters/TraceSpan' - in: path - name: authID + name: userID schema: type: string required: true - description: The ID of the authorization to get. + description: The user ID. responses: '200': - description: Authorization details + description: User details content: application/json: schema: - $ref: '#/components/schemas/Authorization' + $ref: '#/components/schemas/UserResponse' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' patch: - operationId: PatchAuthorizationsID - tags: - - Authorizations - summary: Update an authorization to be active or inactive + operationId: PatchUsersID + tags: + - Users + summary: Update a user requestBody: - description: Authorization to update + description: User update to apply required: true content: application/json: schema: - $ref: '#/components/schemas/AuthorizationUpdateRequest' + $ref: '#/components/schemas/User' parameters: - $ref: '#/components/parameters/TraceSpan' - in: path - name: authID + name: userID schema: type: string required: true - description: The ID of the authorization to update. + description: The ID of the user to update. responses: '200': - description: The active or inactive authorization + description: User updated content: application/json: schema: - $ref: '#/components/schemas/Authorization' + $ref: '#/components/schemas/UserResponse' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' delete: - operationId: DeleteAuthorizationsID + operationId: DeleteUsersID tags: - - Authorizations - summary: Delete an authorization + - Users + summary: Delete a user parameters: - $ref: '#/components/parameters/TraceSpan' - in: path - name: authID + name: userID schema: type: string required: true - description: The ID of the authorization to delete. + description: The ID of the user to delete. responses: '204': - description: Authorization deleted + description: User deleted + default: + description: Unexpected error + $ref: '#/components/responses/GeneralServerError' + /setup: + get: + operationId: GetSetup + tags: + - Setup + summary: 'Check if database has default user, org, bucket' + description: 'Returns `true` if no default user, organization, or bucket has been created.' + parameters: + - $ref: '#/components/parameters/TraceSpan' + responses: + '200': + description: allowed true or false + content: + application/json: + schema: + $ref: '#/components/schemas/IsOnboarding' + post: + operationId: PostSetup + tags: + - Setup + summary: 'Set up initial user, org and bucket' + description: 'Post an onboarding request to set up initial user, org and bucket.' + parameters: + - $ref: '#/components/parameters/TraceSpan' + requestBody: + description: Source to create + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingRequest' + responses: + '201': + description: 'Created default user, bucket, org' + content: + application/json: + schema: + $ref: '#/components/schemas/OnboardingResponse' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - /legacy/authorizations: - servers: - - url: /private + $ref: '#/components/responses/GeneralServerError' + /authorizations: get: - operationId: GetLegacyAuthorizations + operationId: GetAuthorizations tags: - - Legacy Authorizations - summary: List all legacy authorizations + - Authorizations + - Security and access endpoints + summary: List authorizations + description: | + Retrieves a list of authorizations. + + To limit which authorizations are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all authorizations. + + #### InfluxDB Cloud + + - Doesn't expose [API token](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#token) values in `GET /api/v2/authorizations` responses; returns `token: redacted` for all authorizations. + + #### InfluxDB OSS + + - Returns + [API token](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#token) values in authorizations. + - Requires an _[operator token](https://docs.influxdata.com/influxdb/latest/security/tokens/#operator-token))_ to view authorizations. + + #### Related guides + + - [View tokens](https://docs.influxdata.com/influxdb/v2.3/security/tokens/view-tokens/). parameters: - $ref: '#/components/parameters/TraceSpan' - in: query name: userID schema: type: string - description: Only show legacy authorizations that belong to a user ID. + description: | + A user ID. + Only returns authorizations scoped to this user. - in: query name: user schema: type: string - description: Only show legacy authorizations that belong to a user name. + description: | + A user name. + Only returns authorizations scoped to this user. - in: query name: orgID schema: type: string - description: Only show legacy authorizations that belong to an organization ID. + description: An organization ID. Only returns authorizations that belong to this organization. - in: query name: org schema: type: string - description: Only show legacy authorizations that belong to a organization name. - - in: query - name: token - schema: - type: string - description: Only show legacy authorizations with a specified token (auth name). - - in: query - name: authID - schema: - type: string - description: Only show legacy authorizations with a specified auth ID. + description: | + An organization name. + Only returns authorizations that belong to this organization. responses: '200': - description: A list of legacy authorizations + description: Success. The response body contains a list of authorizations. content: application/json: schema: $ref: '#/components/schemas/Authorizations' + '400': + description: Invalid request + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' post: - operationId: PostLegacyAuthorizations + operationId: PostAuthorizations tags: - - Legacy Authorizations - summary: Create a legacy authorization + - Authorizations + summary: Create an authorization + description: | + Creates an authorization and returns the newly created authorization. + + Use this endpoint to generate an API token with resource permissions. + A permission sets `read` or `write` access to a `type` of resource. + + Keep the following in mind when creating and updating authorizations: + + - A permission with a resource `id` applies only to the resource specified by the ID. + - A permission that doesn't have a resource `id` applies to all resources of resource `type`. + - To scope an authorization to a specific user, provide the `userID` property. + + #### Related guides + + - [Create a token](https://docs.influxdata.com/influxdb/v2.3/security/tokens/create-token/). parameters: - $ref: '#/components/parameters/TraceSpan' requestBody: - description: Legacy authorization to create + description: The authorization to create. required: true content: application/json: schema: - $ref: '#/components/schemas/LegacyAuthorizationPostRequest' + $ref: '#/components/schemas/AuthorizationPostRequest' responses: '201': - description: Legacy authorization created + description: Created. The response body contains the newly created authorization. content: application/json: schema: $ref: '#/components/schemas/Authorization' '400': description: Invalid request - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error - $ref: '#/components/responses/ServerError' - '/legacy/authorizations/{authID}': - servers: - - url: /private + $ref: '#/components/responses/GeneralServerError' + x-codeSample: + - lang: Shell + label: 'cURL: Create auth to read all buckets' + source: | + curl --request POST \ + "http://localhost:8086/api/v2/authorizations" \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header 'Content-Type: application/json' \ + --data @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "iot_users read buckets", + "permissions": [ + {"action": "read", "resource": {"type": "buckets"}} + ] + } + EOF + - lang: Shell + - label: 'cURL: Create auth scoped to a user' + - source: | + curl --request POST \ + "http://localhost:8086/api/v2/authorizations" \ + --header "Authorization: Token INFLUX_TOKEN" \ + --header 'Content-Type: application/json' \ + --data @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "userID": "INFLUX_USER_ID", + "description": "iot_user write to bucket", + "permissions": [ + {"action": "write", "resource": {"type": "buckets", "id: "INFLUX_BUCKET_ID"}} + ] + } + EOF + '/authorizations/{authID}': get: - operationId: GetLegacyAuthorizationsID + operationId: GetAuthorizationsID tags: - - Legacy Authorizations - summary: Retrieve a legacy authorization + - Authorizations + - Security and access endpoints + summary: Retrieve an authorization parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -5630,24 +9257,24 @@ paths: schema: type: string required: true - description: The ID of the legacy authorization to get. + description: The ID of the authorization to get. responses: '200': - description: Legacy authorization details + description: Authorization details content: application/json: schema: $ref: '#/components/schemas/Authorization' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' patch: - operationId: PatchLegacyAuthorizationsID + operationId: PatchAuthorizationsID tags: - - Legacy Authorizations - summary: Update a legacy authorization to be active or inactive + - Authorizations + summary: Update an authorization to be active or inactive requestBody: - description: Legacy authorization to update + description: Authorization to update required: true content: application/json: @@ -5660,44 +9287,22 @@ paths: schema: type: string required: true - description: The ID of the legacy authorization to update. + description: The ID of the authorization to update. responses: '200': - description: The active or inactive legacy authorization + description: The active or inactive authorization content: application/json: schema: $ref: '#/components/schemas/Authorization' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' delete: - operationId: DeleteLegacyAuthorizationsID - tags: - - Legacy Authorizations - summary: Delete a legacy authorization - parameters: - - $ref: '#/components/parameters/TraceSpan' - - in: path - name: authID - schema: - type: string - required: true - description: The ID of the legacy authorization to delete. - responses: - '204': - description: Legacy authorization deleted - default: - description: Unexpected error - $ref: '#/components/responses/ServerError' - '/legacy/authorizations/{authID}/password': - servers: - - url: /private - post: - operationId: PostLegacyAuthorizationsIDPassword + operationId: DeleteAuthorizationsID tags: - - Legacy Authorizations - summary: Set a legacy authorization password + - Authorizations + summary: Delete an authorization parameters: - $ref: '#/components/parameters/TraceSpan' - in: path @@ -5705,20 +9310,13 @@ paths: schema: type: string required: true - description: The ID of the legacy authorization to update. - requestBody: - description: New password - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/PasswordResetBody' + description: The ID of the authorization to delete. responses: '204': - description: Legacy authorization password set + description: Authorization deleted default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /variables: get: operationId: GetVariables @@ -5746,10 +9344,10 @@ paths: $ref: '#/components/schemas/Variables' '400': description: Invalid request - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostVariables summary: Create a variable @@ -5773,7 +9371,7 @@ paths: $ref: '#/components/schemas/Variable' default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/variables/{variableID}': get: operationId: GetVariablesID @@ -5797,10 +9395,10 @@ paths: $ref: '#/components/schemas/Variable' '404': description: Variable not found - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' delete: operationId: DeleteVariablesID tags: @@ -5819,7 +9417,7 @@ paths: description: Variable deleted default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' patch: operationId: PatchVariablesID summary: Update a variable @@ -5849,7 +9447,7 @@ paths: $ref: '#/components/schemas/Variable' default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' put: operationId: PutVariablesID summary: Replace a variable @@ -5879,7 +9477,7 @@ paths: $ref: '#/components/schemas/Variable' default: description: Internal server error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /sources: post: operationId: PostSources @@ -6529,13 +10127,17 @@ paths: operationId: GetBackupKV tags: - Backup - summary: 'Download snapshot of metadata stored in the server''s embedded KV store. Should not be used in versions greater than 2.1.x, as it doesn''t include metadata stored in embedded SQL.' + summary: Download snapshot of metadata stored in the server's embedded KV store. Don't use with InfluxDB versions greater than InfluxDB 2.1.x. + description: | + Retrieves a snapshot of metadata stored in the server's embedded KV store. + InfluxDB versions greater than 2.1.x don't include metadata stored in embedded SQL; + avoid using this endpoint with versions greater than 2.1.x. deprecated: true parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': - description: Snapshot of KV metadata + description: Success. The response contains a snapshot of KV metadata. content: application/octet-stream: schema: @@ -6543,7 +10145,7 @@ paths: format: binary default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /backup/metadata: get: operationId: GetBackupMetadata @@ -6582,7 +10184,7 @@ paths: $ref: '#/components/schemas/MetadataBackup' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/backup/shards/{shardID}': get: operationId: GetBackupShardId @@ -6610,10 +10212,14 @@ paths: description: The shard ID. - in: query name: since - description: Earliest time to include in the snapshot. RFC3339 format. + description: 'The earliest time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp) to include in the snapshot.' schema: type: string format: date-time + examples: + RFC3339: + summary: RFC3339 date/time format + value: '2006-01-02T15:04:05Z07:00' responses: '200': description: TSM snapshot. @@ -6641,7 +10247,7 @@ paths: $ref: '#/components/schemas/Error' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /restore/kv: post: operationId: PostRestoreKV @@ -6692,7 +10298,7 @@ paths: description: KV store successfully overwritten. default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /restore/sql: post: operationId: PostRestoreSQL @@ -6733,7 +10339,7 @@ paths: description: SQL store successfully overwritten. default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/restore/bucket/{bucketID}': post: operationId: PostRestoreBucketID @@ -6774,7 +10380,7 @@ paths: format: byte default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /restore/bucketMetadata: post: operationId: PostRestoreBucketMetadata @@ -6799,7 +10405,7 @@ paths: $ref: '#/components/schemas/RestoredBucketMappings' default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/restore/shards/{shardID}': post: operationId: PostRestoreShardId @@ -6846,26 +10452,38 @@ paths: description: TSM snapshot successfully restored. default: description: Unexpected error - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /config: get: operationId: GetConfig tags: - Config - summary: Get the run-time configuration of the instance + - System information endpoints + summary: Retrieve runtime configuration + description: | + Returns the active runtime configuration of the InfluxDB instance. + + In InfluxDB v2.2+, use this endpoint to view your active runtime configuration, + including flags and environment variables. + + #### Related guides + + - [View your runtime server configuration](https://docs.influxdata.com/influxdb/v2.3/reference/config-options/#view-your-runtime-server-configuration) parameters: - $ref: '#/components/parameters/TraceSpan' responses: '200': - description: Payload body contains the run-time configuration of the InfluxDB instance. + description: | + Success. + The response body contains the active runtime configuration of the InfluxDB instance. content: application/json: schema: $ref: '#/components/schemas/Config' '401': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /remotes: get: operationId: GetRemoteConnections @@ -6897,9 +10515,9 @@ paths: schema: $ref: '#/components/schemas/RemoteConnections' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostRemoteConnection tags: @@ -6919,9 +10537,9 @@ paths: schema: $ref: '#/components/schemas/RemoteConnection' '400': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/remotes/{remoteID}': get: operationId: GetRemoteConnectionByID @@ -6943,9 +10561,9 @@ paths: schema: $ref: '#/components/schemas/RemoteConnection' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' patch: operationId: PatchRemoteConnectionByID tags: @@ -6972,11 +10590,11 @@ paths: schema: $ref: '#/components/schemas/RemoteConnection' '400': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' delete: operationId: DeleteRemoteConnectionByID tags: @@ -6993,9 +10611,9 @@ paths: '204': description: Remote connection info deleted. '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /replications: get: operationId: GetReplications @@ -7030,9 +10648,9 @@ paths: schema: $ref: '#/components/schemas/Replications' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' post: operationId: PostReplication tags: @@ -7062,9 +10680,9 @@ paths: '204': description: 'Replication validated, but not saved' '400': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/replications/{replicationID}': get: operationId: GetReplicationByID @@ -7086,9 +10704,9 @@ paths: schema: $ref: '#/components/schemas/Replication' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' patch: operationId: PatchReplicationByID tags: @@ -7123,11 +10741,11 @@ paths: '204': description: 'Updated replication validated, but not saved' '400': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' delete: operationId: DeleteReplicationByID tags: @@ -7144,9 +10762,9 @@ paths: '204': description: Replication deleted. '404': - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' '/replications/{replicationID}/validate': post: operationId: PostValidateReplicationByID @@ -7165,9 +10783,9 @@ paths: description: Replication is valid '400': description: Replication failed validation - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' default: - $ref: '#/components/responses/ServerError' + $ref: '#/components/responses/GeneralServerError' /dashboards: post: operationId: PostDashboards @@ -7256,35 +10874,52 @@ paths: get: operationId: GetTasks tags: + - Data I/O endpoints - Tasks - summary: List all tasks + summary: List tasks + description: | + Retrieves a list of [tasks](https://docs.influxdata.com/influxdb/v2.3/process-data/). + + To limit which tasks are returned, pass query parameters in your request. + If no query parameters are passed, InfluxDB returns all tasks up to the default `limit`. parameters: - $ref: '#/components/parameters/TraceSpan' - in: query name: name - description: Returns task with a specific name. + description: | + Task name. + Only returns tasks with this name. + Different tasks may have the same name. schema: type: string - in: query name: after schema: type: string - description: Return tasks after a specified ID. + description: | + Task ID. + Only returns tasks created after this task. - in: query name: user schema: type: string - description: Filter tasks to a specific user ID. + description: | + User ID. + Only returns tasks owned by this user. - in: query name: org schema: type: string - description: Filter tasks to a specific organization name. + description: | + Organization name. + Only returns tasks owned by this organization. - in: query name: orgID schema: type: string - description: Filter tasks to a specific organization ID. + description: | + Organization ID. + Only returns tasks owned by this organization. - in: query name: status schema: @@ -7292,7 +10927,9 @@ paths: enum: - active - inactive - description: Filter tasks by a status--"inactive" or "active". + description: | + Task status (`active` or `inactive`). + Only returns tasks with this status. - in: query name: limit schema: @@ -7300,10 +10937,16 @@ paths: minimum: 1 maximum: 500 default: 100 - description: The number of tasks to return + description: | + Limits the number of tasks returned. + The minimum is `1`, the maximum is `500`, and the default is `100`. - in: query name: type - description: 'Type of task, unset by default.' + description: | + Task type (`basic` or `system`). + + The default (`system`) response contains all the metadata properties for tasks. + To reduce the payload size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`) from the response. required: false schema: default: '' @@ -7313,44 +10956,281 @@ paths: - system responses: '200': - description: A list of tasks + description: | + Success. + The response body contains the list of tasks. content: application/json: schema: $ref: '#/components/schemas/Tasks' + examples: + basicTypeTaskOutput: + summary: Basic output + description: Task fields returned with `?type=basic` + value: + links: + self: /api/v2/tasks?limit=100 + tasks: + - links: + labels: /api/v2/tasks/09956cbb6d378000/labels + logs: /api/v2/tasks/09956cbb6d378000/logs + members: /api/v2/tasks/09956cbb6d378000/members + owners: /api/v2/tasks/09956cbb6d378000/owners + runs: /api/v2/tasks/09956cbb6d378000/runs + self: /api/v2/tasks/09956cbb6d378000 + labels: [] + id: 09956cbb6d378000 + orgID: 48c88459ee424a04 + org: '' + ownerID: 0772396d1f411000 + name: task1 + status: active + flux: '' + every: 30m + latestCompleted: '2022-06-30T15:00:00Z' + lastRunStatus: success + systemTypeTaskOutput: + summary: System output + description: Task fields returned with `?type=system` + value: + links: + self: /api/v2/tasks?limit=100 + tasks: + - links: + labels: /api/v2/tasks/09956cbb6d378000/labels + logs: /api/v2/tasks/09956cbb6d378000/logs + members: /api/v2/tasks/09956cbb6d378000/members + owners: /api/v2/tasks/09956cbb6d378000/owners + runs: /api/v2/tasks/09956cbb6d378000/runs + self: /api/v2/tasks/09956cbb6d378000 + labels: [] + id: 09956cbb6d378000 + orgID: 48c88459ee424a04 + org: my-iot-center + ownerID: 0772396d1f411000 + name: task1 + description: IoT Center 90-day environment average. + status: active + flux: |- + option task = {name: "task1", every: 30m} + + from(bucket: "iot_center") + |> range(start: -90d) + |> filter(fn: (r) => r._measurement == "environment") + |> aggregateWindow(every: 1h, fn: mean) + every: 30m + latestCompleted: '2022-06-30T15:00:00Z' + lastRunStatus: success + createdAt: '2022-06-27T15:09:06Z' + updatedAt: '2022-06-28T18:10:15Z' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + $ref: '#/components/responses/GeneralServerError' + x-codeSamples: + - lang: Shell + label: 'cURL: all tasks, basic output' + source: | + curl https://localhost:8086/api/v2/tasks/?limit=-1&type=basic \ + --header 'Content-Type: application/json' \ + --header 'Authorization: Token INFLUX_API_TOKEN' + post: + operationId: PostTasks + tags: + - Data I/O endpoints + - Tasks + summary: Create a task + description: | + Creates a [task](https://docs.influxdata.com/influxdb/v2.3/process-data/) and returns the created task. + + #### Related guides + + - [Get started with tasks](https://docs.influxdata.com/influxdb/v2.3/process-data/get-started/) + - [Create a task](https://docs.influxdata.com/influxdb/v2.3/process-data/manage-tasks/create-task/) + - [Common tasks](https://docs.influxdata.com/influxdb/v2.3/process-data/common-tasks/) + - [Task configuration options](https://docs.influxdata.com/influxdb/v2.3/process-data/task-options/) + parameters: + - $ref: '#/components/parameters/TraceSpan' + requestBody: + description: The task to create. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TaskCreateRequest' + responses: + '201': + description: Success. The response body contains a `tasks` list with the new task. + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + description: | + Bad request. + The response body contains detail about the error. + + #### InfluxDB OSS + + - Returns this error if an incorrect value is passed for `org` or `orgID`. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + orgProvidedNotFound: + summary: The org or orgID passed doesn't own the token passed in the header + value: + code: invalid + message: 'failed to decode request body: organization not found' + missingFluxError: + summary: Task in request body is missing Flux query + value: + code: invalid + message: 'failed to decode request: missing flux' + '401': + $ref: '#/components/responses/AuthorizationError' + '500': + $ref: '#/components/responses/InternalServerError' default: description: Unexpected error content: application/json: schema: - $ref: '#/components/schemas/Error' - post: - operationId: PostTasks + $ref: '#/components/schemas/Error' + x-codeSamples: + - lang: Shell + label: 'cURL: create a task' + source: | + curl http://localhost:8086/api/v2/tasks \ + --header "Content-type: application/json" \ + --header "Authorization: Token INFLUX_API_TOKEN" \ + --data-binary @- << EOF + { + "orgID": "INFLUX_ORG_ID", + "description": "IoT Center 30d environment average.", + "flux": "option task = {name: \"iot-center-task-1\", every: 30m}\ + from(bucket: \"iot_center\")\ + |> range(start: -30d)\ + |> filter(fn: (r) => r._measurement == \"environment\")\ + |> aggregateWindow(every: 1h, fn: mean)" + } + EOF + '/tasks/{taskID}': + get: + operationId: GetTasksID + tags: + - Data I/O endpoints + - Tasks + summary: Retrieve a task + description: | + Retrieves a [task](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#task). + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: taskID + schema: + type: string + required: true + description: The ID of the task to retrieve. + responses: + '200': + description: Success. The response body contains the task. + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + $ref: '#/components/responses/GeneralServerError' + patch: + operationId: PatchTasksID + tags: + - Tasks + summary: Update a task + description: | + Updates a task and then cancels all scheduled runs of the task. + + Use this endpoint to set, modify, and clear task properties (for example: `cron`, `name`, `flux`, `status`). + Once InfluxDB applies the update, it cancels all previously scheduled runs of the task. + + To update a task, pass an object that contains the updated key-value pairs. + To activate or inactivate a task, set the `status` property. + _`"status": "inactive"`_ cancels scheduled runs and prevents manual runs of the task. + requestBody: + description: An object that contains updated task properties to apply. + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/TaskUpdateRequest' + parameters: + - $ref: '#/components/parameters/TraceSpan' + - in: path + name: taskID + schema: + type: string + required: true + description: The ID of the task to update. + responses: + '200': + description: Success. The response body contains the updated task. + content: + application/json: + schema: + $ref: '#/components/schemas/Task' + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' + default: + $ref: '#/components/responses/GeneralServerError' + delete: + operationId: DeleteTasksID tags: - Tasks - summary: Create a new task + summary: Delete a task + description: | + Deletes a task and associated records. + + Use this endpoint to delete a task and all associated records (task runs, logs, and labels). + Once the task is deleted, InfluxDB cancels all scheduled runs of the task. + + If you want to disable a task instead of delete it, [update the task status to `inactive`](#operation/PatchTasksID). parameters: - $ref: '#/components/parameters/TraceSpan' - requestBody: - description: Task to create - required: true - content: - application/json: - schema: - $ref: '#/components/schemas/TaskCreateRequest' + - in: path + name: taskID + schema: + type: string + required: true + description: The ID of the task to delete. responses: - '201': - description: Task created - content: - application/json: - schema: - $ref: '#/components/schemas/Task' + '204': + description: Success. The task and runs are deleted. Scheduled runs are canceled. + '400': + $ref: '#/components/responses/BadRequestError' + '401': + $ref: '#/components/responses/AuthorizationError' + '404': + $ref: '#/components/responses/ResourceNotFoundError' + '500': + $ref: '#/components/responses/InternalServerError' default: - description: Unexpected error - content: - application/json: - schema: - $ref: '#/components/schemas/Error' + $ref: '#/components/responses/GeneralServerError' components: parameters: TraceSpan: @@ -7369,6 +11249,9 @@ components: in: query name: offset required: false + description: | + The offset for pagination. + The number of records to skip. schema: type: integer minimum: 0 @@ -7376,6 +11259,8 @@ components: in: query name: limit required: false + description: | + Limits the number of records returned. Default is `20`. schema: type: integer minimum: 1 @@ -7410,10 +11295,11 @@ components: - query properties: query: - description: Flux query script to be analyzed + description: | + The Flux query script to be analyzed. type: string Query: - description: Query influx using the Flux language + description: Query InfluxDB with the Flux language type: object required: - query @@ -7421,7 +11307,7 @@ components: extern: $ref: '#/components/schemas/File' query: - description: Query script to execute. + description: The query script to execute. type: string type: description: The type of query. Must be "flux". @@ -7432,11 +11318,34 @@ components: type: object additionalProperties: true description: | - Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both) + Key-value pairs passed as parameters during query execution. + + To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + + ```json + query: "from(bucket: params.mybucket) |> range(start: params.rangeStart) |> limit(n:1)" + ``` + + and pass _`params`_ with the key-value pairs--for example: + + ```json + params: { + "mybucket": "environment", + "rangeStart": "-30d" + } + ``` + + During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + + #### Limitations + + - If you use _`params`_, you can't use _`extern`_. dialect: $ref: '#/components/schemas/Dialect' now: - description: Specifies the time that should be reported as "now" in the query. Default is the server's now time. + description: | + Specifies the time that should be reported as `now` in the query. + Default is the server `now` time. type: string format: date-time Package: @@ -7503,15 +11412,20 @@ components: - stop properties: start: - description: RFC3339Nano + description: | + A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + The earliest time to delete from. type: string format: date-time stop: - description: RFC3339Nano + description: | + A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + The latest time to delete from. type: string format: date-time predicate: - description: InfluxQL-like delete statement + description: | + An expression in [delete predicate syntax](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/delete-predicate/). example: tag1="value1" and (tag2="value2" and tag3!="value3") type: string Node: @@ -7572,7 +11486,7 @@ components: init: $ref: '#/components/schemas/Expression' ExpressionStatement: - description: May consist of an expression that does not return a value and is executed solely for its side-effects + description: May consist of an expression that doesn't return a value and is executed solely for its side-effects type: object properties: type: @@ -7661,7 +11575,7 @@ components: items: $ref: '#/components/schemas/DictItem' DictItem: - description: A key/value pair in a dictionary + description: A key-value pair in a dictionary. type: object properties: type: @@ -7800,7 +11714,7 @@ components: value: type: boolean DateTimeLiteral: - description: Represents an instant in time with nanosecond precision using the syntax of golang's RFC3339 Nanosecond variant + description: 'Represents an instant in time with nanosecond precision in [RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp).' type: object properties: type: @@ -7898,21 +11812,35 @@ components: name: type: string Dialect: - description: 'Dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions' + description: | + Options for tabular data output. + Default output is [annotated CSV](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/annotated-csv/#csv-response-format) with headers. + + For more information about tabular data **dialect**, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). type: object properties: header: - description: 'If true, the results will contain a header row' + description: 'If true, the results contain a header row.' type: boolean default: true delimiter: - description: 'Separator between cells; the default is ,' + description: 'The separator used between cells. Default is a comma (`,`).' type: string default: ',' maxLength: 1 minLength: 1 annotations: - description: 'https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns' + description: | + Annotation rows to include in the results. + An _annotation_ is metadata associated with an object (column) in the data model. + + #### Related guides + + - See [Annotated CSV annotations](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/annotated-csv/#annotations) for examples and more information. + + For more information about **annotations** in tabular data, + see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns). type: array uniqueItems: true items: @@ -7922,13 +11850,23 @@ components: - datatype - default commentPrefix: - description: Character prefixed to comment strings + description: The character prefixed to comment strings. Default is a number sign (`#`). type: string default: '#' maxLength: 1 minLength: 0 dateTimeFormat: - description: Format of timestamps + description: | + The format for timestamps in results. + Default is [`RFC3339` date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp). + To include nanoseconds in timestamps, use `RFC3339Nano`. + + #### Example formatted date/time values + + | Format | Value | + |:------------|:----------------------------| + | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | + | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | type: string default: RFC3339 enum: @@ -7949,22 +11887,47 @@ components: PostBucketRequest: properties: orgID: + description: | + Organization ID. + The ID of the organization. type: string name: + description: | + The name of the bucket. type: string description: + description: | + A description of the bucket. type: string rp: + description: | + Retention policy is an InfluxDB 1.x concept that represents the duration + of time that each data point in the retention policy persists. Use `rp` + for compatibility with InfluxDB 1.x. + The InfluxDB 2.x and Cloud equivalent is + [retention period](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#retention-period). type: string + default: '0' retentionRules: $ref: '#/components/schemas/RetentionRules' schemaType: + description: | + Schema Type. + Use `explicit` to enforce column names, tags, fields, and data types for + your data. + + #### InfluxDB Cloud + + - Default is `implicit`. + + #### InfluxDB OSS + + - Doesn't support `schemaType`. $ref: '#/components/schemas/SchemaType' default: implicit required: - orgID - name - - retentionRules Bucket: properties: links: @@ -8044,16 +12007,29 @@ components: $ref: '#/components/schemas/Bucket' RetentionRules: type: array - description: Rules to expire or retain data. No rules means data never expires. + description: | + Retention rules to expire or retain data. + #### InfluxDB Cloud + + - `retentionRules` is required. + + #### InfluxDB OSS + + - `retentionRules` isn't required. items: $ref: '#/components/schemas/RetentionRule' PatchBucketRequest: type: object - description: Updates to an existing bucket resource. + description: | + An object that contains updated bucket properties to apply. properties: name: type: string + description: | + The name of the bucket. description: + description: | + A description of the bucket. type: string retentionRules: $ref: '#/components/schemas/PatchRetentionRules' @@ -8064,7 +12040,6 @@ components: $ref: '#/components/schemas/PatchRetentionRule' PatchRetentionRule: type: object - description: Updates to a rule to expire or retain data. properties: type: type: string @@ -8074,15 +12049,33 @@ components: everySeconds: type: integer format: int64 - description: Duration in seconds for how long data will be kept in the database. 0 means infinite. + description: | + The number of seconds to keep data. + Default duration is `2592000` (30 days). + `0` represents infinite retention. example: 86400 + default: 2592000 minimum: 0 shardGroupDurationSeconds: type: integer format: int64 - description: Shard duration measured in seconds. + description: | + The [shard group duration](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#shard). + The number of seconds that each shard group covers. + + #### InfluxDB Cloud + + - Doesn't use `shardGroupDurationsSeconds`. + + #### InfluxDB OSS + + - Default value depends on the [bucket retention period](https://docs.influxdata.com/influxdb/v2.3/reference/internals/shards/#shard-group-duration). + + #### Related guides + + - InfluxDB [shards and shard groups](https://docs.influxdata.com/influxdb/v2.3/reference/internals/shards/) required: - - type + - everySeconds RetentionRule: type: object properties: @@ -8094,15 +12087,29 @@ components: everySeconds: type: integer format: int64 - description: Duration in seconds for how long data will be kept in the database. 0 means infinite. + description: | + The duration in seconds for how long data will be kept in the database. + The default duration is 2592000 (30 days). + 0 represents infinite retention. example: 86400 + default: 2592000 minimum: 0 shardGroupDurationSeconds: type: integer format: int64 - description: Shard duration measured in seconds. + description: | + The shard group duration. + The duration or interval (in seconds) that each shard group covers. + + #### InfluxDB Cloud + + - Does not use `shardGroupDurationsSeconds`. + + #### InfluxDB OSS + + - Default value depends on the + [bucket retention period](https://docs.influxdata.com/influxdb/v2.3/v2.3/reference/internals/shards/#shard-group-duration). required: - - type - everySeconds Link: type: string @@ -8111,6 +12118,8 @@ components: description: URI of resource. Links: type: object + description: | + URI pointers for additional paged results. properties: next: $ref: '#/components/schemas/Link' @@ -8133,9 +12142,10 @@ components: properties: time: readOnly: true - description: 'Time event occurred, RFC3339Nano.' + description: 'The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp)) that the event occurred.' type: string format: date-time + example: '2006-01-02T15:04:05.999999999Z07:00' message: readOnly: true description: A description of the event that occurred. @@ -8143,7 +12153,7 @@ components: example: Halt and catch fire runID: readOnly: true - description: the ID of the task that logged + description: The ID of the task run that generated the event. type: string Organization: properties: @@ -8232,12 +12242,45 @@ components: properties: dryRun: type: boolean + description: | + Only applies a dry run of the templates passed in the request. + + - Validates the template and generates a resource diff and summary. + - Doesn't install templates or make changes to the InfluxDB instance. orgID: type: string + description: | + Organization ID. + InfluxDB applies templates to this organization. + The organization owns all resources created by the template. + + To find your organization, see how to + [view organizations](https://docs.influxdata.com/influxdb/v2.3/organizations/view-orgs/). stackID: type: string + description: | + ID of the stack to update. + + To apply templates to an existing stack in the organization, use the `stackID` parameter. + If you apply templates without providing a stack ID, + InfluxDB initializes a new stack with all new resources. + + To find a stack ID, use the InfluxDB [`/api/v2/stacks` API endpoint](#operation/ListStacks) to list stacks. + + #### Related guides + + - [Stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) + - [View stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/view/) template: type: object + description: | + A template object to apply. + A template object has a `contents` property + with an array of InfluxDB resource configurations. + + Pass `template` to apply only one template object. + If you use `template`, you can't use the `templates` parameter. + If you want to apply multiple template objects, use `templates` instead. properties: contentType: type: string @@ -8249,6 +12292,13 @@ components: $ref: '#/components/schemas/Template' templates: type: array + description: | + A list of template objects to apply. + A template object has a `contents` property + with an array of InfluxDB resource configurations. + + Use the `templates` parameter to apply multiple template objects. + If you use `templates`, you can't use the `template` parameter. items: type: object properties: @@ -8262,6 +12312,26 @@ components: $ref: '#/components/schemas/Template' envRefs: type: object + description: | + An object with key-value pairs that map to **environment references** in templates. + + Environment references in templates are `envRef` objects with an `envRef.key` + property. + To substitute a custom environment reference value when applying templates, + pass `envRefs` with the `envRef.key` and the value. + + When you apply a template, InfluxDB replaces `envRef` objects in the template + with the values that you provide in the `envRefs` parameter. + For more examples, see how to [define environment references](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#define-environment-references). + + The following template fields may use environment references: + + - `metadata.name` + - `spec.endpointName` + - `spec.associations.name` + + For more information about including environment references in template fields, see how to + [include user-definable resource names](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/create/#include-user-definable-resource-names). additionalProperties: oneOf: - type: string @@ -8270,10 +12340,56 @@ components: - type: boolean secrets: type: object + description: | + An object with key-value pairs that map to **secrets** in queries. + + Queries may reference secrets stored in InfluxDB--for example, + the following Flux script retrieves `POSTGRES_USERNAME` and `POSTGRES_PASSWORD` + secrets and then uses them to connect to a PostgreSQL database: + + ```js + import "sql" + import "influxdata/influxdb/secrets" + + username = secrets.get(key: "POSTGRES_USERNAME") + password = secrets.get(key: "POSTGRES_PASSWORD") + + sql.from( + driverName: "postgres", + dataSourceName: "postgresql://${username}:${password}@localhost:5432", + query: "SELECT * FROM example_table", + ) + ``` + + To define secret values in your `/api/v2/templates/apply` request, + pass the `secrets` parameter with key-value pairs--for example: + + ```json + { + ... + "secrets": { + "POSTGRES_USERNAME": "pguser", + "POSTGRES_PASSWORD": "foo" + } + ... + } + ``` + + InfluxDB stores the key-value pairs as secrets that you can access with `secrets.get()`. + Once stored, you can't view secret values in InfluxDB. + + #### Related guides + + - [How to pass secrets when installing a template](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#pass-secrets-when-installing-a-template) additionalProperties: type: string remotes: type: array + description: | + A list of URLs for template files. + + To apply a template manifest file located at a URL, pass `remotes` + with an array that contains the URL. items: type: object properties: @@ -8285,6 +12401,15 @@ components: - url actions: type: array + description: | + A list of `action` objects. + Actions let you customize how InfluxDB applies templates in the request. + + You can use the following actions to prevent creating or updating resources: + + - A `skipKind` action skips template resources of a specified `kind`. + - A `skipResource` action skips template resources with a specified `metadata.name` + and `kind`. items: oneOf: - type: object @@ -8410,18 +12535,55 @@ components: type: array items: type: object + description: | + A template entry. + Defines an InfluxDB resource in a template. properties: apiVersion: type: string + example: influxdata.com/v2alpha1 kind: $ref: '#/components/schemas/TemplateKind' - meta: + metadata: type: object + description: | + Metadata properties used for the resource when the template is applied. properties: name: type: string spec: type: object + description: | + Configuration properties used for the resource when the template is applied. + Key-value pairs map to the specification for the resource. + + The following code samples show `spec` configurations for template resources: + + - A bucket: + + ```json + { "spec": { + "name": "iot_center", + "retentionRules": [{ + "everySeconds": 2.592e+06, + "type": "expire" + }] + } + } + ``` + + - A variable: + + ```json + { "spec": { + "language": "flux", + "name": "Node_Service", + "query": "import \"influxdata/influxdb/v1\"\r\nv1.tagValues(bucket: \"iot_center\", + tag: \"service\")", + "type": "query" + } + } + ``` TemplateEnvReferences: type: array items: @@ -9190,7 +13352,7 @@ components: - success - canceled scheduledFor: - description: 'Time used for run''s "now" option, RFC3339.' + description: 'The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp) used for the run''s `now` option.' type: string format: date-time log: @@ -9199,21 +13361,28 @@ components: readOnly: true items: $ref: '#/components/schemas/LogEvent' + flux: + description: Flux used for the task + type: string + readOnly: true startedAt: readOnly: true - description: 'Time run started executing, RFC3339Nano.' + description: 'The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run started executing.' type: string format: date-time + example: '2006-01-02T15:04:05.999999999Z07:00' finishedAt: readOnly: true - description: 'Time run finished executing, RFC3339Nano.' + description: 'The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run finished executing.' type: string format: date-time + example: '2006-01-02T15:04:05.999999999Z07:00' requestedAt: readOnly: true - description: 'Time run was manually requested, RFC3339Nano.' + description: 'The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp)) the run was manually requested.' type: string format: date-time + example: '2006-01-02T15:04:05.999999999Z07:00' links: type: object readOnly: true @@ -9235,139 +13404,33 @@ components: properties: scheduledFor: nullable: true - description: 'Time used for run''s "now" option, RFC3339. Default is the server''s now time.' - type: string - format: date-time - Tasks: - type: object - properties: - links: - readOnly: true - $ref: '#/components/schemas/Links' - tasks: - type: array - items: - $ref: '#/components/schemas/Task' - Task: - type: object - properties: - id: - readOnly: true - type: string - type: - description: 'Type of the task, useful for filtering a task list.' - type: string - orgID: - description: ID of the organization that owns the task. - type: string - org: - description: Name of the organization that owns the task. - type: string - name: - description: Name of the task. - type: string - ownerID: - description: ID of the user who owns this Task. - type: string - description: - description: Description of the task. - type: string - status: - $ref: '#/components/schemas/TaskStatusType' - labels: - $ref: '#/components/schemas/Labels' - authorizationID: - description: ID of the authorization used when the task communicates with the query engine. - type: string - flux: - description: Flux script to run for this task. - type: string - every: - description: |- - Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. - Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)). - type: string - format: duration - cron: - description: |- - [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. - Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview). - type: string - offset: - description: |- - [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. - The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals). - type: string - format: duration - latestCompleted: - description: |- - Timestamp of the latest scheduled and completed run. - Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax). - type: string - format: date-time - readOnly: true - lastRunStatus: - readOnly: true - type: string - enum: - - failed - - success - - canceled - lastRunError: - readOnly: true - type: string - createdAt: - type: string - format: date-time - readOnly: true - updatedAt: + description: | + The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp) + used for the run's `now` option. + Default is the server _now_ time. type: string format: date-time - readOnly: true - links: - type: object - readOnly: true - example: - self: /api/v2/tasks/1 - owners: /api/v2/tasks/1/owners - members: /api/v2/tasks/1/members - labels: /api/v2/tasks/1/labels - runs: /api/v2/tasks/1/runs - logs: /api/v2/tasks/1/logs - properties: - self: - $ref: '#/components/schemas/Link' - owners: - $ref: '#/components/schemas/Link' - members: - $ref: '#/components/schemas/Link' - runs: - $ref: '#/components/schemas/Link' - logs: - $ref: '#/components/schemas/Link' - labels: - $ref: '#/components/schemas/Link' - required: - - id - - name - - orgID - - flux TaskStatusType: type: string enum: - active - inactive + description: | + `inactive` cancels scheduled runs and prevents manual runs of the task. UserResponse: properties: id: readOnly: true type: string - oauthID: - type: string + description: | + The ID of the user. name: type: string + description: | + The name of the user. status: - description: If inactive the user is inactive. + description: | + The status of a user. An inactive user won't have access to resources. default: active type: string enum: @@ -9791,6 +13854,8 @@ components: - showNoteWhenEmpty - position properties: + adaptiveZoomHide: + type: boolean timeFormat: type: string type: @@ -9883,6 +13948,8 @@ components: - stacked - bar - monotoneX + - stepBefore + - stepAfter BandViewProperties: type: object required: @@ -9895,6 +13962,8 @@ components: - note - showNoteWhenEmpty properties: + adaptiveZoomHide: + type: boolean timeFormat: type: string type: @@ -9990,6 +14059,8 @@ components: - decimalPlaces - position properties: + adaptiveZoomHide: + type: boolean timeFormat: type: string type: @@ -10208,6 +14279,8 @@ components: - xSuffix - ySuffix properties: + adaptiveZoomHide: + type: boolean timeFormat: type: string type: @@ -10320,6 +14393,8 @@ components: - ySuffix - binSize properties: + adaptiveZoomHide: + type: boolean timeFormat: type: string type: @@ -10687,6 +14762,8 @@ components: - queries - colors properties: + adaptiveZoomHide: + type: boolean type: type: string enum: @@ -11424,7 +15501,9 @@ components: type: object properties: allowed: - description: True means that the influxdb instance has NOT had initial setup; false means that the database has been setup. + description: | + If `true`, the InfluxDB instance hasn't had initial setup; + `false` otherwise. type: boolean PasswordResetBody: properties: @@ -11437,8 +15516,12 @@ components: properties: id: type: string + description: | + The ID of the user to add to the resource. name: type: string + description: | + The name of the user to add to the resource. required: - id Ready: @@ -11497,7 +15580,9 @@ components: type: object additionalProperties: type: string - description: Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + description: | + Key-value pairs associated with this label. + To remove a property, send an update with an empty value (`""`) for the key. example: color: ffb3b3 description: this is a description @@ -11515,7 +15600,10 @@ components: type: object additionalProperties: type: string - description: Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + description: | + Key-value pairs associated with this label. + + To remove a property, send an update with an empty value (`""`) for the key. example: color: ffb3b3 description: this is a description @@ -11528,7 +15616,10 @@ components: type: object additionalProperties: type: string - description: Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + description: | + Key-value pairs associated with this label. + + To remove a property, send an update with an empty value (`""`) for the key. example: color: ffb3b3 description: this is a description @@ -11536,6 +15627,9 @@ components: type: object properties: labelID: + description: | + Label ID. + The ID of the label to attach. type: string LabelsResponse: type: object @@ -11564,48 +15658,6 @@ components: - s - us - ns - TaskCreateRequest: - type: object - properties: - orgID: - description: The ID of the organization that owns this Task. - type: string - org: - description: The name of the organization that owns this Task. - type: string - status: - $ref: '#/components/schemas/TaskStatusType' - flux: - description: The Flux script to run for this task. - type: string - description: - description: An optional description of the task. - type: string - required: - - flux - TaskUpdateRequest: - type: object - properties: - status: - $ref: '#/components/schemas/TaskStatusType' - flux: - description: The Flux script to run for this task. - type: string - name: - description: Override the 'name' option in the flux script. - type: string - every: - description: Override the 'every' option in the flux script. - type: string - cron: - description: Override the 'cron' option in the flux script. - type: string - offset: - description: Override the 'offset' option in the flux script. - type: string - description: - description: An optional description of the task. - type: string FluxResponse: description: Rendered flux that backs the check or notification. properties: @@ -11681,7 +15733,8 @@ components: description: An optional description of the check. type: string latestCompleted: - description: 'Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run.' + type: string + description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.' format: date-time readOnly: true lastRunStatus: @@ -11951,7 +16004,7 @@ components: - endpointID properties: latestCompleted: - description: 'Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run.' + description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run.' type: string format: date-time readOnly: true @@ -12165,14 +16218,14 @@ components: description: The message template as a flux interpolated string. type: string parseMode: - description: 'Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options . Defaults to "MarkdownV2" .' + description: 'Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options. Defaults to "MarkdownV2".' type: string enum: - MarkdownV2 - HTML - Markdown disableWebPagePreview: - description: Disables preview of web links in the sent messages when "true". Defaults to "false" . + description: Disables preview of web links in the sent messages when "true". Defaults to "false". type: boolean NotificationEndpointUpdate: type: object @@ -12344,7 +16397,7 @@ components: description: 'Specifies the Telegram bot token. See https://core.telegram.org/bots#creating-a-new-bot .' type: string channel: - description: 'ID of the telegram channel, a chat_id in https://core.telegram.org/bots/api#sendmessage .' + description: 'The ID of the telegram channel; a chat_id in https://core.telegram.org/bots/api#sendmessage .' type: string NotificationEndpointType: type: string @@ -12358,14 +16411,14 @@ components: properties: id: type: string - description: ID of the DBRP mapping. + description: The ID of the DBRP mapping. readOnly: true orgID: type: string - description: ID of the organization that owns this mapping. + description: The ID of the organization. bucketID: type: string - description: ID of the bucket used as the target for the translation. + description: The ID of the bucket used as the target for the translation. database: type: string description: InfluxDB v1 database @@ -12375,6 +16428,9 @@ components: default: type: boolean description: Mapping represents the default retention policy for the database specified. + virtual: + type: boolean + description: 'Indicates an autogenerated, virtual mapping based on the bucket name. Currently only available in OSS.' links: $ref: '#/components/schemas/Links' required: @@ -12402,13 +16458,13 @@ components: properties: orgID: type: string - description: ID of the organization that owns this mapping. + description: The ID of the organization. org: type: string - description: Name of the organization that owns this mapping. + description: The name of the organization that owns this mapping. bucketID: type: string - description: ID of the bucket used as the target for the translation. + description: The ID of the bucket used as the target for the translation. database: type: string description: InfluxDB v1 database @@ -12461,11 +16517,13 @@ components: readOnly: true orgID: type: string - description: ID of the organization that the authorization is scoped to. + description: The ID of the organization. permissions: type: array minItems: 1 - description: List of permissions for an authorization. An authorization must have at least one permission. + description: | + A list of permissions for an authorization. + An authorization must have at least one permission. items: $ref: '#/components/schemas/Permission' id: @@ -12474,19 +16532,20 @@ components: token: readOnly: true type: string - description: Token used to authenticate API requests. + description: | + The API token for authenticating InfluxDB API and CLI requests. userID: readOnly: true type: string - description: ID of the user that created and owns the token. + description: The ID of the user that created and owns the token. user: readOnly: true type: string - description: Name of the user that created and owns the token. + description: The name of the user that created and owns the token. org: readOnly: true type: string - description: Name of the organization that the token is scoped to. + description: The name of the organization that the token is scoped to. links: type: object readOnly: true @@ -12500,6 +16559,16 @@ components: user: readOnly: true $ref: '#/components/schemas/Link' + Authorizations: + type: object + properties: + links: + readOnly: true + $ref: '#/components/schemas/Links' + authorizations: + type: array + items: + $ref: '#/components/schemas/Authorization' AuthorizationPostRequest: required: - orgID @@ -12510,49 +16579,20 @@ components: properties: orgID: type: string - description: ID of org that authorization is scoped to. - userID: - type: string - description: ID of user that authorization is scoped to. - permissions: - type: array - minItems: 1 - description: List of permissions for an auth. An auth must have at least one Permission. - items: - $ref: '#/components/schemas/Permission' - LegacyAuthorizationPostRequest: - required: - - orgID - - permissions - allOf: - - $ref: '#/components/schemas/AuthorizationUpdateRequest' - - type: object - properties: - orgID: - type: string - description: ID of org that authorization is scoped to. + description: | + The ID of the organization that owns the authorization. userID: type: string - description: ID of user that authorization is scoped to. - token: - type: string - description: Token (name) of the authorization + description: | + The ID of the user that the authorization is scoped to. permissions: type: array minItems: 1 - description: List of permissions for an auth. An auth must have at least one Permission. + description: | + A list of permissions for an authorization. + An authorization must have at least one permission. items: $ref: '#/components/schemas/Permission' - Authorizations: - type: object - properties: - links: - readOnly: true - $ref: '#/components/schemas/Links' - authorizations: - type: array - items: - $ref: '#/components/schemas/Authorization' Permission: required: - action @@ -12595,18 +16635,29 @@ components: - annotations - remotes - replications + - instance + description: | + The type of resource. + In a `permission`, applies the permission to all resources of this type. id: type: string - description: If ID is set that is a permission for a specific resource. if it is not set it is a permission for all resources of that resource type. + description: | + The ID of a specific resource. + In a `permission`, applies the permission to only the resource with this ID. name: type: string - description: Optional name of the resource if the resource has a name field. + description: | + Optional: A name for the resource. + Not all resource types have a name field. orgID: type: string - description: If orgID is set that is a permission for all resources owned my that org. if it is not set it is a permission for all resources of that resource type. + description: | + The ID of the organization that owns the resource. + In a `permission`, applies the permission to all resources of `type` owned by this organization. org: type: string - description: Optional name of the organization of the organization with orgID. + description: | + Optional: The name of the organization with `orgID`. User: properties: id: @@ -13019,7 +17070,7 @@ components: nodeID: type: integer format: int64 - description: ID of the node that owns a shard. + description: The ID of the node that owns the shard. required: - nodeID SubscriptionManifests: @@ -13169,6 +17220,8 @@ components: type: string remoteBucketID: type: string + remoteBucketName: + type: string maxQueueSizeBytes: type: integer format: int64 @@ -13187,7 +17240,6 @@ components: - remoteID - orgID - localBucketID - - remoteBucketID - maxQueueSizeBytes - currentQueueSizeBytes Replications: @@ -13212,6 +17264,8 @@ components: type: string remoteBucketID: type: string + remoteBucketName: + type: string maxQueueSizeBytes: type: integer format: int64 @@ -13220,13 +17274,18 @@ components: dropNonRetryableData: type: boolean default: false + maxAgeSeconds: + type: integer + format: int64 + minimum: 0 + default: 604800 required: - name - orgID - remoteID - localBucketID - - remoteBucketID - maxQueueSizeBytes + - maxAgeSeconds ReplicationUpdateRequest: type: object properties: @@ -13238,19 +17297,254 @@ components: type: string remoteBucketID: type: string + remoteBucketName: + type: string maxQueueSizeBytes: type: integer format: int64 minimum: 33554430 dropNonRetryableData: type: boolean + maxAgeSeconds: + type: integer + format: int64 + minimum: 0 + Tasks: + type: object + properties: + links: + readOnly: true + $ref: '#/components/schemas/Links' + tasks: + type: array + items: + $ref: '#/components/schemas/Task' + Task: + type: object + properties: + id: + readOnly: true + type: string + orgID: + description: The ID of the organization that owns the task. + type: string + org: + description: The name of the organization that owns the task. + type: string + name: + description: The name of the task. + type: string + ownerID: + description: The ID of the user who owns the Task. + type: string + description: + description: The description of the task. + type: string + status: + $ref: '#/components/schemas/TaskStatusType' + labels: + $ref: '#/components/schemas/Labels' + authorizationID: + description: The ID of the authorization used when the task communicates with the query engine. + type: string + flux: + description: The Flux script that the task runs. + type: string + every: + description: 'An interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. `every` also determines when the task first runs, depending on the specified time.' + type: string + format: duration + cron: + description: '[Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time.' + type: string + offset: + description: 'A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset.' + type: string + format: duration + latestCompleted: + description: 'A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)) of the latest scheduled and completed run.' + type: string + format: date-time + readOnly: true + lastRunStatus: + readOnly: true + type: string + enum: + - failed + - success + - canceled + lastRunError: + readOnly: true + type: string + createdAt: + type: string + format: date-time + readOnly: true + updatedAt: + type: string + format: date-time + readOnly: true + links: + type: object + readOnly: true + example: + self: /api/v2/tasks/1 + owners: /api/v2/tasks/1/owners + members: /api/v2/tasks/1/members + labels: /api/v2/tasks/1/labels + runs: /api/v2/tasks/1/runs + logs: /api/v2/tasks/1/logs + properties: + self: + $ref: '#/components/schemas/Link' + owners: + $ref: '#/components/schemas/Link' + members: + $ref: '#/components/schemas/Link' + runs: + $ref: '#/components/schemas/Link' + logs: + $ref: '#/components/schemas/Link' + labels: + $ref: '#/components/schemas/Link' + required: + - id + - name + - orgID + - flux + TaskCreateRequest: + type: object + properties: + orgID: + description: The ID of the organization that owns this Task. + type: string + org: + description: The name of the organization that owns this Task. + type: string + status: + $ref: '#/components/schemas/TaskStatusType' + flux: + description: The Flux script to run for this task. + type: string + description: + description: An optional description of the task. + type: string + required: + - flux + TaskUpdateRequest: + type: object + properties: + status: + $ref: '#/components/schemas/TaskStatusType' + flux: + description: The Flux script that the task runs. + type: string + name: + description: Update the 'name' option in the flux script. + type: string + every: + description: Update the 'every' option in the flux script. + type: string + cron: + description: Update the 'cron' option in the flux script. + type: string + offset: + description: Update the 'offset' option in the flux script. + type: string + description: + description: Update the description of the task. + type: string responses: - ServerError: + AuthorizationError: + description: | + Unauthorized. The error may indicate one of the following: + + * The `Authorization: Token` header is missing or malformed. + * The API token value is missing from the header. + * The token doesn't have sufficient permissions to write to this organization and bucket. + content: + application/json: + schema: + properties: + code: + description: | + The HTTP status code description. Default is `unauthorized`. + readOnly: true + type: string + enum: + - unauthorized + message: + readOnly: true + description: A human-readable message that may contain detail about the error. + type: string + examples: + tokenNotAuthorized: + summary: Token is not authorized to access a resource + value: + code: unauthorized + message: unauthorized access + BadRequestError: + description: | + Bad request. + The response body contains detail about the error. + + #### InfluxDB OSS + + - Returns this error if an incorrect value is passed for `org` or `orgID`. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + orgProvidedNotFound: + summary: The org or orgID passed doesn't own the token passed in the header + value: + code: invalid + message: 'failed to decode request body: organization not found' + GeneralServerError: description: Non 2XX error response from server. content: application/json: schema: $ref: '#/components/schemas/Error' + InternalServerError: + description: | + Internal server error. + The server encountered an unexpected situation. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + ResourceNotFoundError: + description: | + Not found. + A requested resource was not found. + The response body contains the requested resource type and the name value + (if you passed it)--for example: + + - `"organization name \"my-org\" not found"` + - `"organization not found"`: indicates you passed an ID that did not match + an organization. + content: + application/json: + schema: + $ref: '#/components/schemas/Error' + examples: + org-not-found: + summary: Organization name not found + value: + code: not found + message: organization name "my-org" not found + bucket-not-found: + summary: Bucket name not found + value: + code: not found + message: bucket "air_sensor" not found + orgID-not-found: + summary: Organization ID not found + value: + code: not found + message: organization not found securitySchemes: TokenAuthentication: type: apiKey @@ -13268,13 +17562,13 @@ components: ### Syntax - `Authorization: Token YOUR_INFLUX_TOKEN` + `Authorization: Token YOUR_INFLUX_API_TOKEN` For more information and examples, see the following: - [`/authorizations`](#tag/Authorizations) endpoint. - - [Authorize API requests](https://docs.influxdata.com/influxdb/v2.1/api-guide/api_intro/#authentication). - - [Manage API tokens](https://docs.influxdata.com/influxdb/v2.1/security/tokens/). + - [Authorize API requests](https://docs.influxdata.com/influxdb/v2.3/api-guide/api_intro/#authentication). + - [Manage API tokens](https://docs.influxdata.com/influxdb/v2.3/security/tokens/). BasicAuthentication: type: http scheme: basic diff --git a/domain/templates/client-with-responses.tmpl b/domain/templates/client-with-responses.tmpl index 64658011..50929d7c 100644 --- a/domain/templates/client-with-responses.tmpl +++ b/domain/templates/client-with-responses.tmpl @@ -1,107 +1,192 @@ -// ClientWithResponses builds on ClientInterface to offer response payloads -type ClientWithResponses struct { - ClientInterface -} - -// NewClientWithResponses creates a new ClientWithResponses, which wraps -// Client with return type handling -func NewClientWithResponses(service ihttp.Service) (*ClientWithResponses) { - client := NewClient(service) - return &ClientWithResponses{client} -} - -// ClientWithResponsesInterface is the interface specification for the client with responses above. -type ClientWithResponsesInterface interface { -{{range . -}} +{{/* Generate client methods */}} +{{range .}} +{{if (hasValidRequestAndResponse .) -}}{{/* skip non-JSON bodies*/}} {{$hasParams := .RequiresParamObject -}} {{$pathParams := .PathParams -}} {{$opid := .OperationId -}} - // {{$opid}} request {{if .HasBody}} with any body{{end}} - {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse(ctx context.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*{{genResponseTypeName $opid}}, error) -{{range .Bodies}} - {{$opid}}{{.Suffix}}WithResponse(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*{{genResponseTypeName $opid}}, error) -{{end}}{{/* range .Bodies */}} -{{end}}{{/* range . $opid := .OperationId */}} -} - -{{range .}}{{$opid := .OperationId}}{{$op := .}} -type {{$opid | ucFirst}}Response struct { - Body []byte - HTTPResponse *http.Response - {{- range getResponseTypeDefinitions .}} - {{.TypeName}} *{{.Schema.TypeDecl}} - {{- end}} -} - -// Status returns HTTPResponse.Status -func (r {{$opid | ucFirst}}Response) Status() string { - if r.HTTPResponse != nil { - return r.HTTPResponse.Status +{{$hasResponse := hasSingle2xxJSONResponse . -}} +{{$lenServers := 0 -}} +{{if .Spec.Servers}} +{{$lenServers = len .Spec.Servers -}} +{{end}} +{{$response2xx := get2xxResponseTypeDefinition . -}} +{{$hasBodyOrPathParams := or .HasBody (gt (len .PathParams) 0) -}} +{{$pathStr := genParamFmtString .Path -}} + +// {{$opid}} calls the {{.Method}} on {{.Path}} +// {{.Summary}} +func (c *Client) {{$opid}}(ctx context.Context, {{if $hasBodyOrPathParams}}params *{{$opid}}AllParams{{else}}{{if $hasParams}} params *{{$opid}}Params{{end}}{{end}}) ({{if $hasResponse}}*{{$response2xx.Schema.TypeDecl}},{{end}} error) { + var err error +{{if .HasBody -}} + var bodyReader io.Reader + buf, err := json.Marshal(params.Body) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err } - return http.StatusText(0) -} - -// StatusCode returns HTTPResponse.StatusCode -func (r {{$opid | ucFirst}}Response) StatusCode() int { - if r.HTTPResponse != nil { - return r.HTTPResponse.StatusCode + bodyReader = bytes.NewReader(buf) +{{end}} +{{range $paramIdx, $param := .PathParams}} + var pathParam{{$paramIdx}} string + {{if .IsPassThrough}} + pathParam{{$paramIdx}} = params.{{.GoVariableName|ucFirst}} + {{end}} + {{if .IsJson}} + var pathParamBuf{{$paramIdx}} []byte + pathParamBuf{{$paramIdx}}, err = json.Marshal(params.{{.GoVariableName|ucFirst}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err } - return 0 -} + pathParam{{$paramIdx}} = string(pathParamBuf{{$paramIdx}}) + {{end}} + {{if .IsStyled}} + pathParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationPath, params.{{.GoVariableName|ucFirst}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } + {{end}} {{end}} + serverURL, err := url.Parse(c.{{if eq $lenServers 0}}APIEndpoint{{else}}Server{{end}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } + operationPath := fmt.Sprintf("{{if eq (index $pathStr 0) '/'}}.{{end}}{{$pathStr}}"{{range $paramIdx, $param := .PathParams}}, pathParam{{$paramIdx}}{{end}}) -{{range .}} -{{$opid := .OperationId -}} -{{/* Generate client methods (with responses)*/}} + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } -// {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse request{{if .HasBody}} with arbitrary body{{end}} returning *{{$opid}}Response -func (c *ClientWithResponses) {{$opid}}{{if .HasBody}}WithBody{{end}}WithResponse(ctx context.Context{{genParamArgs .PathParams}}{{if .RequiresParamObject}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*{{genResponseTypeName $opid}}, error){ - rsp, err := c.{{$opid}}{{if .HasBody}}WithBody{{end}}(ctx{{genParamNames .PathParams}}{{if .RequiresParamObject}}, params{{end}}{{if .HasBody}}, contentType, body{{end}}) +{{if .QueryParams}} + queryValues := queryURL.Query() +{{range $paramIdx, $param := .QueryParams}} + {{if not .Required}} if params.{{.GoName}} != nil { {{end}} + {{if .IsPassThrough}} + queryValues.Add("{{.ParamName}}", {{if not .Required}}*{{end}}params.{{.GoName}}) + {{end}} + {{if .IsJson}} + if queryParamBuf, err := json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}); err != nil { + return {{if $hasResponse}}nil, {{end}}err + } else { + queryValues.Add("{{.ParamName}}", string(queryParamBuf)) + } + + {{end}} + {{if .IsStyled}} + if queryFrag, err := runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationQuery, {{if not .Required}}*{{end}}params.{{.GoName}}); err != nil { + return {{if $hasResponse}}nil, {{end}}err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return {{if $hasResponse}}nil, {{end}}err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + {{end}} + {{if not .Required}}}{{end}} +{{end}} + queryURL.RawQuery = queryValues.Encode() +{{end}}{{/* if .QueryParams */}} + req, err := http.NewRequest("{{.Method}}", queryURL.String(), {{if .HasBody}}bodyReader{{else}}nil{{end}}) if err != nil { - return nil, err + return {{if $hasResponse}}nil, {{end}}err } - return Parse{{genResponseTypeName $opid | ucFirst}}(rsp) -} -{{$hasParams := .RequiresParamObject -}} -{{$pathParams := .PathParams -}} -{{$bodyRequired := .BodyRequired -}} -{{range .Bodies}} -func (c *ClientWithResponses) {{$opid}}{{.Suffix}}WithResponse(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*{{genResponseTypeName $opid}}, error) { - rsp, err := c.{{$opid}}{{.Suffix}}(ctx{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, body) + {{if .HasBody}}req.Header.Add("Content-Type", "{{(index .Bodies 0).ContentType}}"){{end}} +{{range $paramIdx, $param := .HeaderParams}} + {{if not .Required}} if params.{{.GoName}} != nil { {{end}} + var headerParam{{$paramIdx}} string + {{if .IsPassThrough}} + headerParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}} + {{end}} + {{if .IsJson}} + var headerParamBuf{{$paramIdx}} []byte + headerParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}) if err != nil { - return nil, err + return {{if $hasResponse}}nil, {{end}}err } - return Parse{{genResponseTypeName $opid | ucFirst}}(rsp) -} + headerParam{{$paramIdx}} = string(headerParamBuf{{$paramIdx}}) + {{end}} + {{if .IsStyled}} + headerParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, {{if not .Required}}*{{end}}params.{{.GoName}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } + {{end}} + req.Header.Set("{{.ParamName}}", headerParam{{$paramIdx}}) + {{if not .Required}}}{{end}} {{end}} -{{end}}{{/* operations */}} - -{{/* Generate parse functions for responses*/}} -{{range .}}{{$opid := .OperationId}} +{{range $paramIdx, $param := .CookieParams}} + {{if not .Required}} if params.{{.GoName}} != nil { {{end}} + var cookieParam{{$paramIdx}} string + {{if .IsPassThrough}} + cookieParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}} + {{end}} + {{if .IsJson}} + var cookieParamBuf{{$paramIdx}} []byte + cookieParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } + cookieParam{{$paramIdx}} = url.QueryEscape(string(cookieParamBuf{{$paramIdx}})) + {{end}} + {{if .IsStyled}} + cookieParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("simple", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationCookie, {{if not .Required}}*{{end}}params.{{.GoName}}) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } + {{end}} + cookie{{$paramIdx}} := &http.Cookie{ + Name:"{{.ParamName}}", + Value:cookieParam{{$paramIdx}}, + } + req.AddCookie(cookie{{$paramIdx}}) + {{if not .Required}}}{{end}} +{{end}} -// Parse{{genResponseTypeName $opid | ucFirst}} parses an HTTP response from a {{$opid}}WithResponse call -func Parse{{genResponseTypeName $opid | ucFirst}}(rsp *http.Response) (*{{genResponseTypeName $opid}}, error) { + req = req.WithContext(ctx) + rsp, err := c.Client.Do(req) + if err != nil { + return {{if $hasResponse}}nil, {{end}}err + } +{{if $hasResponse -}} bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() +{{end}} + defer func() { _ = rsp.Body.Close() }() +{{if $hasResponse -}} if err != nil { return nil, err } - response := {{genResponsePayload $opid}} + response := &{{$response2xx.Schema.TypeDecl}}{} - switch { - {{genResponseUnmarshal .}} - // Fallback for unexpected error - default: - if rsp.StatusCode > 299 { - return nil, &ihttp.Error{StatusCode: rsp.StatusCode, Message: rsp.Status} - } + switch(rsp.StatusCode) { + case {{$response2xx.ResponseName}}: + if err := unmarshalJSONResponse(bodyBytes, &response); err != nil { + return nil, err + } + default: + return nil, decodeError(bodyBytes, rsp) } - return response, nil +{{else}} + if rsp.StatusCode > 299 { + bodyBytes, err := ioutil.ReadAll(rsp.Body) + if err != nil { + return err + } + return decodeError(bodyBytes, rsp) + } + return nil +{{end}} } -{{end}}{{/* range . $opid := .OperationId */}} +{{end}}{{/* if */}} +{{end}}{{/* Range */}} + +/* + +*/ \ No newline at end of file diff --git a/domain/templates/client.tmpl b/domain/templates/client.tmpl index dc65ea13..7b27a0ae 100644 --- a/domain/templates/client.tmpl +++ b/domain/templates/client.tmpl @@ -1,213 +1,82 @@ +// Doer performs HTTP requests. +// +// The standard http.Client implements this interface. +type HTTPRequestDoer interface { + Do(req *http.Request) (*http.Response, error) +} + // Client which conforms to the OpenAPI3 specification for this service. type Client struct { - service ihttp.Service + // The endpoint of the server conforming to this interface, with scheme, + // https://api.deepmap.com for example. This can contain a path relative + // to the server, such as https://api.deepmap.com/dev-test, and all the + // paths in the swagger spec will be appended to the server. + Server string + + // Server + /api/v2/ + APIEndpoint string + + // Doer for performing requests, typically a *http.Client with any + // customized settings, such as certificate chains. + Client HTTPRequestDoer } + // Creates a new Client, with reasonable defaults -func NewClient(service ihttp.Service) (*Client) { +func NewClient(server string, doer HTTPRequestDoer) (*Client, error) { // create a client with sane default values client := Client{ - service: service, + Server: server, + Client: doer, } - return &client -} - - -// The interface specification for the client above. -type ClientInterface interface { -{{range . -}} -{{$hasParams := .RequiresParamObject -}} -{{$pathParams := .PathParams -}} -{{$opid := .OperationId -}} - // {{$opid}} request {{if .HasBody}} with any body{{end}} - {{$opid}}{{if .HasBody}}WithBody{{end}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*http.Response, error) -{{range .Bodies}} - {{$opid}}{{.Suffix}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*http.Response, error) -{{end}}{{/* range .Bodies */}} -{{end}}{{/* range . $opid := .OperationId */}} -} - - -{{/* Generate client methods */}} -{{range . -}} -{{$hasParams := .RequiresParamObject -}} -{{$pathParams := .PathParams -}} -{{$lenServers := 0 -}} -{{if .Spec.Servers}} -{{$lenServers = len .Spec.Servers -}} -{{end}} -{{$opid := .OperationId -}} - -func (c *Client) {{$opid}}{{if .HasBody}}WithBody{{end}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*http.Response, error) { - req, err := New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(c.service.{{if eq $lenServers 0}}ServerAPIURL(){{else}}ServerURL(){{end}}{{genParamNames .PathParams}}{{if $hasParams}}, params{{end}}{{if .HasBody}}, contentType, body{{end}}) - if err != nil { - return nil, err + // ensure the server URL always has a trailing slash + if !strings.HasSuffix(client.Server, "/") { + client.Server += "/" } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) -} + // API endpoint + client.APIEndpoint = client.Server + "api/v2/" -{{range .Bodies}} -func (c *Client) {{$opid}}{{.Suffix}}(ctx context.Context{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*http.Response, error) { - req, err := New{{$opid}}{{.Suffix}}Request(c.service.{{if eq $lenServers 0}}ServerAPIURL(){{else}}ServerURL(){{end}}{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, body) - if err != nil { - return nil, err + // create httpClient, if not already present + if client.Client == nil { + client.Client = &http.Client{} } - req = req.WithContext(ctx) - return c.service.DoHTTPRequestWithResponse(req, nil) + return &client, nil } -{{end}}{{/* range .Bodies */}} -{{end}} -{{/* Generate request builders */}} -{{range .}} -{{$hasParams := .RequiresParamObject -}} -{{$pathParams := .PathParams -}} -{{$bodyRequired := .BodyRequired -}} -{{$opid := .OperationId -}} - -{{range .Bodies}} -// New{{$opid}}Request{{.Suffix}} calls the generic {{$opid}} builder with {{.ContentType}} body -func New{{$opid}}Request{{.Suffix}}(server string{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}, body {{$opid}}{{.NameTag}}RequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) - return New{{$opid}}RequestWithBody(server{{genParamNames $pathParams}}{{if $hasParams}}, params{{end}}, "{{.ContentType}}", bodyReader) +func(e *Error) Error() error { + return fmt.Errorf("%s: %s", string(e.Code), *e.Message) } -{{end}} - -// New{{$opid}}Request{{if .HasBody}}WithBody{{end}} generates requests for {{$opid}}{{if .HasBody}} with any type of body{{end}} -func New{{$opid}}Request{{if .HasBody}}WithBody{{end}}(server string{{genParamArgs $pathParams}}{{if $hasParams}}, params *{{$opid}}Params{{end}}{{if .HasBody}}, contentType string, body io.Reader{{end}}) (*http.Request, error) { - var err error -{{range $paramIdx, $param := .PathParams}} - var pathParam{{$paramIdx}} string - {{if .IsPassThrough}} - pathParam{{$paramIdx}} = {{.GoVariableName}} - {{end}} - {{if .IsJson}} - var pathParamBuf{{$paramIdx}} []byte - pathParamBuf{{$paramIdx}}, err = json.Marshal({{.GoVariableName}}) - if err != nil { - return nil, err - } - pathParam{{$paramIdx}} = string(pathParamBuf{{$paramIdx}}) - {{end}} - {{if .IsStyled}} - pathParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationPath, {{.GoVariableName}}) - if err != nil { - return nil, err - } - {{end}} -{{end}} - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - operationPath := fmt.Sprintf("{{genParamFmtString .Path}}"{{range $paramIdx, $param := .PathParams}}, pathParam{{$paramIdx}}{{end}}) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - -{{if .QueryParams}} - queryValues := queryURL.Query() -{{range $paramIdx, $param := .QueryParams}} - {{if not .Required}} if params.{{.GoName}} != nil { {{end}} - {{if .IsPassThrough}} - queryValues.Add("{{.ParamName}}", {{if not .Required}}*{{end}}params.{{.GoName}}) - {{end}} - {{if .IsJson}} - if queryParamBuf, err := json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}); err != nil { - return nil, err - } else { - queryValues.Add("{{.ParamName}}", string(queryParamBuf)) - } - - {{end}} - {{if .IsStyled}} - if queryFrag, err := runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationQuery, {{if not .Required}}*{{end}}params.{{.GoName}}); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - {{end}} - {{if not .Required}}}{{end}} -{{end}} - queryURL.RawQuery = queryValues.Encode() -{{end}}{{/* if .QueryParams */}} - req, err := http.NewRequest("{{.Method}}", queryURL.String(), {{if .HasBody}}body{{else}}nil{{end}}) - if err != nil { - return nil, err - } - - {{if .HasBody}}req.Header.Add("Content-Type", contentType){{end}} -{{range $paramIdx, $param := .HeaderParams}} - {{if not .Required}} if params.{{.GoName}} != nil { {{end}} - var headerParam{{$paramIdx}} string - {{if .IsPassThrough}} - headerParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}} - {{end}} - {{if .IsJson}} - var headerParamBuf{{$paramIdx}} []byte - headerParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}) - if err != nil { - return nil, err - } - headerParam{{$paramIdx}} = string(headerParamBuf{{$paramIdx}}) - {{end}} - {{if .IsStyled}} - headerParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("{{.Style}}", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationHeader, {{if not .Required}}*{{end}}params.{{.GoName}}) - if err != nil { - return nil, err - } - {{end}} - req.Header.Set("{{.ParamName}}", headerParam{{$paramIdx}}) - {{if not .Required}}}{{end}} -{{end}} +func unmarshalJSONResponse(bodyBytes []byte, obj interface{}) error { + if err := json.Unmarshal(bodyBytes, obj); err != nil { + return err + } + return nil +} -{{range $paramIdx, $param := .CookieParams}} - {{if not .Required}} if params.{{.GoName}} != nil { {{end}} - var cookieParam{{$paramIdx}} string - {{if .IsPassThrough}} - cookieParam{{$paramIdx}} = {{if not .Required}}*{{end}}params.{{.GoName}} - {{end}} - {{if .IsJson}} - var cookieParamBuf{{$paramIdx}} []byte - cookieParamBuf{{$paramIdx}}, err = json.Marshal({{if not .Required}}*{{end}}params.{{.GoName}}) - if err != nil { - return nil, err - } - cookieParam{{$paramIdx}} = url.QueryEscape(string(cookieParamBuf{{$paramIdx}})) - {{end}} - {{if .IsStyled}} - cookieParam{{$paramIdx}}, err = runtime.StyleParamWithLocation("simple", {{.Explode}}, "{{.ParamName}}", runtime.ParamLocationCookie, {{if not .Required}}*{{end}}params.{{.GoName}}) - if err != nil { - return nil, err - } - {{end}} - cookie{{$paramIdx}} := &http.Cookie{ - Name:"{{.ParamName}}", - Value:cookieParam{{$paramIdx}}, - } - req.AddCookie(cookie{{$paramIdx}}) - {{if not .Required}}}{{end}} -{{end}} - return req, nil +func isJSON(rsp *http.Response) bool { + ctype, _, _ := mime.ParseMediaType(rsp.Header.Get("Content-Type")) + return ctype == "application/json" } -{{end}}{{/* Range */}} +func decodeError(body []byte, rsp *http.Response) error { + if isJSON(rsp) { + var serverError Error + err := json.Unmarshal(body, &serverError) + if err != nil { + message := fmt.Sprintf("cannot decode error response: %v", err) + serverError.Message = &message + } + if serverError.Message == nil && serverError.Code == "" { + serverError.Message = &rsp.Status + } + return serverError.Error() + } else { + message := rsp.Status + if len(body) > 0 { + message = message + ": " + string(body) + } + return errors.New(message) + } +} diff --git a/domain/templates/param-types.tmpl b/domain/templates/param-types.tmpl new file mode 100644 index 00000000..534a58a4 --- /dev/null +++ b/domain/templates/param-types.tmpl @@ -0,0 +1,22 @@ +{{range .}}{{$opid := .OperationId}} +{{if (hasValidRequestAndResponse .) -}}{{/* skip non-JSON bodies*/}} +{{range .TypeDefinitions}} +// {{.TypeName}} defines parameters for {{$opid}}. +type {{.TypeName}} {{if and (opts.AliasTypes) (.CanAlias)}}={{end}} {{.Schema.TypeDecl}} +{{end}} +{{if or .HasBody (gt (len .PathParams) 0) -}} +// {{$opid}}AllParams defines type for all parameters for {{$opid}}. +type {{$opid}}AllParams struct { +{{if .RequiresParamObject -}} + {{$opid}}Params +{{end}} +{{range .PathParams}} +{{.GoVariableName|ucFirst}} {{.TypeDef}} +{{end}} +{{if (and .HasBody (len .Bodies))}} + Body {{$opid}}{{(index .Bodies 0).NameTag}}RequestBody +{{end}} +} +{{end}}{{/* if */}} +{{end}}{{/* if */}} +{{end}}{{/* Range */}} \ No newline at end of file diff --git a/domain/templates/request-bodies.tmpl b/domain/templates/request-bodies.tmpl new file mode 100644 index 00000000..8887d252 --- /dev/null +++ b/domain/templates/request-bodies.tmpl @@ -0,0 +1,10 @@ +{{range .}}{{$opid := .OperationId}} +{{if (hasValidRequestAndResponse .) -}}{{/* skip non-JSON bodies*/}} +{{range .Bodies}} +{{with .TypeDef $opid}} +// {{.TypeName}} defines body for {{$opid}} for application/json ContentType. +type {{.TypeName}} {{if and (opts.AliasTypes) (.CanAlias)}}={{end}} {{.Schema.TypeDecl}} +{{end}} +{{end}} +{{end}} +{{end}} diff --git a/domain/types.gen.go b/domain/types.gen.go index e279fe6a..d8b1ca3b 100644 --- a/domain/types.gen.go +++ b/domain/types.gen.go @@ -1,14 +1,12 @@ // Package domain provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen version (devel) DO NOT EDIT. +// Code generated by version DO NOT EDIT. package domain import ( "encoding/json" "fmt" "time" - - "github.com/pkg/errors" ) const ( @@ -25,11 +23,11 @@ const ( // Defines values for AxisBase. const ( - AxisBase10 AxisBase = "10" + AxisBaseEmpty AxisBase = "" - AxisBase2 AxisBase = "2" + AxisBaseN10 AxisBase = "10" - AxisBaseEmpty AxisBase = "" + AxisBaseN2 AxisBase = "2" ) // Defines values for AxisScale. @@ -493,6 +491,8 @@ const ( ResourceTypeDocuments ResourceType = "documents" + ResourceTypeInstance ResourceType = "instance" + ResourceTypeLabels ResourceType = "labels" ResourceTypeNotebooks ResourceType = "notebooks" @@ -767,6 +767,10 @@ const ( XYGeomStacked XYGeom = "stacked" XYGeomStep XYGeom = "step" + + XYGeomStepAfter XYGeom = "stepAfter" + + XYGeomStepBefore XYGeom = "stepBefore" ) // Defines values for XYViewPropertiesHoverDimension. @@ -797,6 +801,11 @@ const ( XYViewPropertiesTypeXy XYViewPropertiesType = "xy" ) +// Defines values for AuthorizationErrorCode. +const ( + AuthorizationErrorCodeUnauthorized AuthorizationErrorCode = "unauthorized" +) + // Contains the AST for the supplied Flux query type ASTResponse struct { // Represents a complete package source tree. @@ -805,7 +814,10 @@ type ASTResponse struct { // AddResourceMemberRequestBody defines model for AddResourceMemberRequestBody. type AddResourceMemberRequestBody struct { - Id string `json:"id"` + // The ID of the user to add to the resource. + Id string `json:"id"` + + // The name of the user to add to the resource. Name *string `json:"name,omitempty"` } @@ -843,23 +855,24 @@ type Authorization struct { User *Link `json:"user,omitempty"` } `json:"links,omitempty"` - // Name of the organization that the token is scoped to. + // The name of the organization that the token is scoped to. Org *string `json:"org,omitempty"` - // ID of the organization that the authorization is scoped to. + // The ID of the organization. OrgID *string `json:"orgID,omitempty"` - // List of permissions for an authorization. An authorization must have at least one permission. + // A list of permissions for an authorization. + // An authorization must have at least one permission. Permissions *[]Permission `json:"permissions,omitempty"` - // Token used to authenticate API requests. + // The API token for authenticating InfluxDB API and CLI requests. Token *string `json:"token,omitempty"` UpdatedAt *time.Time `json:"updatedAt,omitempty"` - // Name of the user that created and owns the token. + // The name of the user that created and owns the token. User *string `json:"user,omitempty"` - // ID of the user that created and owns the token. + // The ID of the user that created and owns the token. UserID *string `json:"userID,omitempty"` } @@ -868,13 +881,14 @@ type AuthorizationPostRequest struct { // Embedded struct due to allOf(#/components/schemas/AuthorizationUpdateRequest) AuthorizationUpdateRequest `yaml:",inline"` // Embedded fields due to inline allOf schema - // ID of org that authorization is scoped to. + // The ID of the organization that owns the authorization. OrgID *string `json:"orgID,omitempty"` - // List of permissions for an auth. An auth must have at least one Permission. + // A list of permissions for an authorization. + // An authorization must have at least one permission. Permissions *[]Permission `json:"permissions,omitempty"` - // ID of user that authorization is scoped to. + // The ID of the user that the authorization is scoped to. UserID *string `json:"userID,omitempty"` } @@ -893,7 +907,9 @@ type AuthorizationUpdateRequestStatus string // Authorizations defines model for Authorizations. type Authorizations struct { Authorizations *[]Authorization `json:"authorizations,omitempty"` - Links *Links `json:"links,omitempty"` + + // URI pointers for additional paged results. + Links *Links `json:"links,omitempty"` } // The viewport for a View's visualizations @@ -943,6 +959,8 @@ type BadStatement struct { // BandViewProperties defines model for BandViewProperties. type BandViewProperties struct { + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + // The viewport for a View's visualizations Axes Axes `json:"axes"` @@ -1043,7 +1061,14 @@ type Bucket struct { Name string `json:"name"` OrgID *string `json:"orgID,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. + // #### InfluxDB Cloud + // + // - `retentionRules` is required. + // + // #### InfluxDB OSS + // + // - `retentionRules` isn't required. RetentionRules RetentionRules `json:"retentionRules"` Rp *string `json:"rp,omitempty"` SchemaType *SchemaType `json:"schemaType,omitempty"` @@ -1080,7 +1105,9 @@ type BucketShardMappings []BucketShardMapping // Buckets defines model for Buckets. type Buckets struct { Buckets *[]Bucket `json:"buckets,omitempty"` - Links *Links `json:"links,omitempty"` + + // URI pointers for additional paged results. + Links *Links `json:"links,omitempty"` } // BuilderAggregateFunctionType defines model for BuilderAggregateFunctionType. @@ -1184,8 +1211,8 @@ type CheckBase struct { LastRunError *string `json:"lastRunError,omitempty"` LastRunStatus *CheckBaseLastRunStatus `json:"lastRunStatus,omitempty"` - // Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run. - LatestCompleted *interface{} `json:"latestCompleted,omitempty"` + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. + LatestCompleted *time.Time `json:"latestCompleted,omitempty"` Links *struct { // URI of resource. Labels *Link `json:"labels,omitempty"` @@ -1208,9 +1235,11 @@ type CheckBase struct { OrgID string `json:"orgID"` // The ID of creator used to create this check. - OwnerID *string `json:"ownerID,omitempty"` - Query DashboardQuery `json:"query"` - Status *TaskStatusType `json:"status,omitempty"` + OwnerID *string `json:"ownerID,omitempty"` + Query DashboardQuery `json:"query"` + + // `inactive` cancels scheduled runs and prevents manual runs of the task. + Status *TaskStatusType `json:"status,omitempty"` // The ID of the task associated with this check. TaskID *string `json:"taskID,omitempty"` @@ -1238,8 +1267,9 @@ type CheckStatusLevel string // CheckViewProperties defines model for CheckViewProperties. type CheckViewProperties struct { - Check *Check `json:"check,omitempty"` - CheckID string `json:"checkID"` + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + Check *Check `json:"check,omitempty"` + CheckID string `json:"checkID"` // Colors define color encoding of data into a visualization Colors []DashboardColor `json:"colors"` @@ -1261,7 +1291,9 @@ type CheckViewPropertiesType string // Checks defines model for Checks. type Checks struct { Checks *[]Check `json:"checks,omitempty"` - Links *Links `json:"links,omitempty"` + + // URI pointers for additional paged results. + Links *Links `json:"links,omitempty"` } // A color mapping is an object that maps time series data to a UI color scheme to allow the UI to render graphs consistent colors across reloads. @@ -1330,7 +1362,7 @@ type CustomCheckType string // DBRP defines model for DBRP. type DBRP struct { - // ID of the bucket used as the target for the translation. + // The ID of the bucket used as the target for the translation. BucketID string `json:"bucketID"` // InfluxDB v1 database @@ -1339,20 +1371,25 @@ type DBRP struct { // Mapping represents the default retention policy for the database specified. Default bool `json:"default"` - // ID of the DBRP mapping. - Id string `json:"id"` + // The ID of the DBRP mapping. + Id string `json:"id"` + + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` - // ID of the organization that owns this mapping. + // The ID of the organization. OrgID string `json:"orgID"` // InfluxDB v1 retention policy RetentionPolicy string `json:"retention_policy"` + + // Indicates an autogenerated, virtual mapping based on the bucket name. Currently only available in OSS. + Virtual *bool `json:"virtual,omitempty"` } // DBRPCreate defines model for DBRPCreate. type DBRPCreate struct { - // ID of the bucket used as the target for the translation. + // The ID of the bucket used as the target for the translation. BucketID string `json:"bucketID"` // InfluxDB v1 database @@ -1361,10 +1398,10 @@ type DBRPCreate struct { // Mapping represents the default retention policy for the database specified. Default *bool `json:"default,omitempty"` - // Name of the organization that owns this mapping. + // The name of the organization that owns this mapping. Org *string `json:"org,omitempty"` - // ID of the organization that owns this mapping. + // The ID of the organization. OrgID *string `json:"orgID,omitempty"` // InfluxDB v1 retention policy @@ -1489,10 +1526,12 @@ type DashboardWithViewProperties struct { // Dashboards defines model for Dashboards. type Dashboards struct { Dashboards *[]Dashboard `json:"dashboards,omitempty"` - Links *Links `json:"links,omitempty"` + + // URI pointers for additional paged results. + Links *Links `json:"links,omitempty"` } -// Represents an instant in time with nanosecond precision using the syntax of golang's RFC3339 Nanosecond variant +// Represents an instant in time with nanosecond precision in [RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp). type DateTimeLiteral struct { // Type of AST node Type *NodeType `json:"type,omitempty"` @@ -1547,38 +1586,70 @@ type DecimalPlaces struct { // The delete predicate request. type DeletePredicateRequest struct { - // InfluxQL-like delete statement + // An expression in [delete predicate syntax](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/delete-predicate/). Predicate *string `json:"predicate,omitempty"` - // RFC3339Nano + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + // The earliest time to delete from. Start time.Time `json:"start"` - // RFC3339Nano + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + // The latest time to delete from. Stop time.Time `json:"stop"` } -// Dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions +// Options for tabular data output. +// Default output is [annotated CSV](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/annotated-csv/#csv-response-format) with headers. +// +// For more information about tabular data **dialect**, +// see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). type Dialect struct { - // https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns + // Annotation rows to include in the results. + // An _annotation_ is metadata associated with an object (column) in the data model. + // + // #### Related guides + // + // - See [Annotated CSV annotations](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/annotated-csv/#annotations) for examples and more information. + // + // For more information about **annotations** in tabular data, + // see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-data-model-20151217/#columns). Annotations *[]DialectAnnotations `json:"annotations,omitempty"` - // Character prefixed to comment strings + // The character prefixed to comment strings. Default is a number sign (`#`). CommentPrefix *string `json:"commentPrefix,omitempty"` - // Format of timestamps + // The format for timestamps in results. + // Default is [`RFC3339` date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp). + // To include nanoseconds in timestamps, use `RFC3339Nano`. + // + // #### Example formatted date/time values + // + // | Format | Value | + // |:------------|:----------------------------| + // | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | + // | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | DateTimeFormat *DialectDateTimeFormat `json:"dateTimeFormat,omitempty"` - // Separator between cells; the default is , + // The separator used between cells. Default is a comma (`,`). Delimiter *string `json:"delimiter,omitempty"` - // If true, the results will contain a header row + // If true, the results contain a header row. Header *bool `json:"header,omitempty"` } // DialectAnnotations defines model for Dialect.Annotations. type DialectAnnotations string -// Format of timestamps +// The format for timestamps in results. +// Default is [`RFC3339` date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp). +// To include nanoseconds in timestamps, use `RFC3339Nano`. +// +// #### Example formatted date/time values +// +// | Format | Value | +// |:------------|:----------------------------| +// | `RFC3339` | `"2006-01-02T15:04:05Z07:00"` | +// | `RFC3339Nano` | `"2006-01-02T15:04:05.999999999Z07:00"` | type DialectDateTimeFormat string // Used to create and directly specify the elements of a dictionary @@ -1590,7 +1661,7 @@ type DictExpression struct { Type *NodeType `json:"type,omitempty"` } -// A key/value pair in a dictionary +// A key-value pair in a dictionary. type DictItem struct { Key *Expression `json:"key,omitempty"` @@ -1638,7 +1709,7 @@ type ErrorCode string // Expression defines model for Expression. type Expression interface{} -// May consist of an expression that does not return a value and is executed solely for its side-effects +// May consist of an expression that doesn't return a value and is executed solely for its side-effects type ExpressionStatement struct { Expression *Expression `json:"expression,omitempty"` @@ -1923,14 +1994,14 @@ type HTTPNotificationEndpoint struct { // HTTPNotificationEndpointAuthMethod defines model for HTTPNotificationEndpoint.AuthMethod. type HTTPNotificationEndpointAuthMethod string +// HTTPNotificationEndpointMethod defines model for HTTPNotificationEndpoint.Method. +type HTTPNotificationEndpointMethod string + // Customized headers. type HTTPNotificationEndpoint_Headers struct { AdditionalProperties map[string]string `json:"-"` } -// HTTPNotificationEndpointMethod defines model for HTTPNotificationEndpoint.Method. -type HTTPNotificationEndpointMethod string - // HTTPNotificationRule defines model for HTTPNotificationRule. type HTTPNotificationRule struct { // Embedded struct due to allOf(#/components/schemas/NotificationRuleBase) @@ -1963,7 +2034,8 @@ type HealthCheckStatus string // HeatmapViewProperties defines model for HeatmapViewProperties. type HeatmapViewProperties struct { - BinSize float32 `json:"binSize"` + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + BinSize float32 `json:"binSize"` // Colors define color encoding of data into a visualization Colors []string `json:"colors"` @@ -2076,7 +2148,8 @@ type IntegerLiteral struct { // IsOnboarding defines model for IsOnboarding. type IsOnboarding struct { - // True means that the influxdb instance has NOT had initial setup; false means that the database has been setup. + // If `true`, the InfluxDB instance hasn't had initial setup; + // `false` otherwise. Allowed *bool `json:"allowed,omitempty"` } @@ -2086,11 +2159,13 @@ type Label struct { Name *string `json:"name,omitempty"` OrgID *string `json:"orgID,omitempty"` - // Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + // Key-value pairs associated with this label. + // To remove a property, send an update with an empty value (`""`) for the key. Properties *Label_Properties `json:"properties,omitempty"` } -// Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. +// Key-value pairs associated with this label. +// To remove a property, send an update with an empty value (`""`) for the key. type Label_Properties struct { AdditionalProperties map[string]string `json:"-"` } @@ -2100,35 +2175,41 @@ type LabelCreateRequest struct { Name string `json:"name"` OrgID string `json:"orgID"` - // Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + // Key-value pairs associated with this label. + // + // To remove a property, send an update with an empty value (`""`) for the key. Properties *LabelCreateRequest_Properties `json:"properties,omitempty"` } -// Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. +// Key-value pairs associated with this label. +// +// To remove a property, send an update with an empty value (`""`) for the key. type LabelCreateRequest_Properties struct { AdditionalProperties map[string]string `json:"-"` } // LabelMapping defines model for LabelMapping. type LabelMapping struct { + // Label ID. + // The ID of the label to attach. LabelID *string `json:"labelID,omitempty"` } // LabelResponse defines model for LabelResponse. type LabelResponse struct { Label *Label `json:"label,omitempty"` + + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` } // LabelUpdate defines model for LabelUpdate. type LabelUpdate struct { - Name *string `json:"name,omitempty"` - - // Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. + Name *string `json:"name,omitempty"` Properties *LabelUpdate_Properties `json:"properties,omitempty"` } -// Key/Value pairs associated with this label. Keys can be removed by sending an update with an empty value. +// LabelUpdate_Properties defines model for LabelUpdate.Properties. type LabelUpdate_Properties struct { AdditionalProperties map[string]string `json:"-"` } @@ -2139,12 +2220,14 @@ type Labels []Label // LabelsResponse defines model for LabelsResponse. type LabelsResponse struct { Labels *Labels `json:"labels,omitempty"` - Links *Links `json:"links,omitempty"` + + // URI pointers for additional paged results. + Links *Links `json:"links,omitempty"` } // Flux query to be analyzed. type LanguageRequest struct { - // Flux query script to be analyzed + // The Flux query script to be analyzed. Query string `json:"query"` } @@ -2166,24 +2249,6 @@ type LatLonColumns struct { Lon LatLonColumn `json:"lon"` } -// LegacyAuthorizationPostRequest defines model for LegacyAuthorizationPostRequest. -type LegacyAuthorizationPostRequest struct { - // Embedded struct due to allOf(#/components/schemas/AuthorizationUpdateRequest) - AuthorizationUpdateRequest `yaml:",inline"` - // Embedded fields due to inline allOf schema - // ID of org that authorization is scoped to. - OrgID *string `json:"orgID,omitempty"` - - // List of permissions for an auth. An auth must have at least one Permission. - Permissions *[]Permission `json:"permissions,omitempty"` - - // Token (name) of the authorization - Token *string `json:"token,omitempty"` - - // ID of user that authorization is scoped to. - UserID *string `json:"userID,omitempty"` -} - // LesserThreshold defines model for LesserThreshold. type LesserThreshold struct { // Embedded struct due to allOf(#/components/schemas/ThresholdBase) @@ -2198,6 +2263,8 @@ type LesserThresholdType string // LinePlusSingleStatProperties defines model for LinePlusSingleStatProperties. type LinePlusSingleStatProperties struct { + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + // The viewport for a View's visualizations Axes Axes `json:"axes"` @@ -2286,7 +2353,7 @@ type LineProtocolLengthErrorCode string // URI of resource. type Link string -// Links defines model for Links. +// URI pointers for additional paged results. type Links struct { // URI of resource. Next *Link `json:"next,omitempty"` @@ -2303,10 +2370,10 @@ type LogEvent struct { // A description of the event that occurred. Message *string `json:"message,omitempty"` - // the ID of the task that logged + // The ID of the task run that generated the event. RunID *string `json:"runID,omitempty"` - // Time event occurred, RFC3339Nano. + // The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp)) that the event occurred. Time *time.Time `json:"time,omitempty"` } @@ -2488,6 +2555,7 @@ type NotificationEndpointUpdateStatus string // NotificationEndpoints defines model for NotificationEndpoints. type NotificationEndpoints struct { + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` NotificationEndpoints *[]NotificationEndpoint `json:"notificationEndpoints,omitempty"` } @@ -2513,7 +2581,7 @@ type NotificationRuleBase struct { LastRunError *string `json:"lastRunError,omitempty"` LastRunStatus *NotificationRuleBaseLastRunStatus `json:"lastRunStatus,omitempty"` - // Timestamp (in RFC3339 date/time format](https://datatracker.ietf.org/doc/html/rfc3339)) of the latest scheduled and completed run. + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)) of the latest scheduled and completed run. LatestCompleted *time.Time `json:"latestCompleted,omitempty"` // Don't notify me more than times every seconds. If set, limitEvery cannot be empty. @@ -2548,10 +2616,12 @@ type NotificationRuleBase struct { OrgID string `json:"orgID"` // The ID of creator used to create this notification rule. - OwnerID *string `json:"ownerID,omitempty"` - RunbookLink *string `json:"runbookLink,omitempty"` - SleepUntil *string `json:"sleepUntil,omitempty"` - Status TaskStatusType `json:"status"` + OwnerID *string `json:"ownerID,omitempty"` + RunbookLink *string `json:"runbookLink,omitempty"` + SleepUntil *string `json:"sleepUntil,omitempty"` + + // `inactive` cancels scheduled runs and prevents manual runs of the task. + Status TaskStatusType `json:"status"` // List of status rules the notification rule attempts to match. StatusRules []StatusRule `json:"statusRules"` @@ -2582,6 +2652,7 @@ type NotificationRuleUpdateStatus string // NotificationRules defines model for NotificationRules. type NotificationRules struct { + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` NotificationRules *[]NotificationRule `json:"notificationRules,omitempty"` } @@ -2668,6 +2739,7 @@ type OrganizationStatus string // Organizations defines model for Organizations. type Organizations struct { + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` Orgs *[]Organization `json:"orgs,omitempty"` } @@ -2735,10 +2807,13 @@ type PasswordResetBody struct { Password string `json:"password"` } -// Updates to an existing bucket resource. +// An object that contains updated bucket properties to apply. type PatchBucketRequest struct { + // A description of the bucket. Description *string `json:"description,omitempty"` - Name *string `json:"name,omitempty"` + + // The name of the bucket. + Name *string `json:"name,omitempty"` // Updates to rules to expire or retain data. No rules means no updates. RetentionRules *PatchRetentionRules `json:"retentionRules,omitempty"` @@ -2753,14 +2828,29 @@ type PatchOrganizationRequest struct { Name *string `json:"name,omitempty"` } -// Updates to a rule to expire or retain data. +// PatchRetentionRule defines model for PatchRetentionRule. type PatchRetentionRule struct { - // Duration in seconds for how long data will be kept in the database. 0 means infinite. - EverySeconds *int64 `json:"everySeconds,omitempty"` + // The number of seconds to keep data. + // Default duration is `2592000` (30 days). + // `0` represents infinite retention. + EverySeconds int64 `json:"everySeconds"` - // Shard duration measured in seconds. - ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty"` - Type PatchRetentionRuleType `json:"type"` + // The [shard group duration](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#shard). + // The number of seconds that each shard group covers. + // + // #### InfluxDB Cloud + // + // - Doesn't use `shardGroupDurationsSeconds`. + // + // #### InfluxDB OSS + // + // - Default value depends on the [bucket retention period](https://docs.influxdata.com/influxdb/v2.3/reference/internals/shards/#shard-group-duration). + // + // #### Related guides + // + // - InfluxDB [shards and shard groups](https://docs.influxdata.com/influxdb/v2.3/reference/internals/shards/) + ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty"` + Type *PatchRetentionRuleType `json:"type,omitempty"` } // PatchRetentionRuleType defines model for PatchRetentionRule.Type. @@ -2797,14 +2887,33 @@ type PipeLiteral struct { // PostBucketRequest defines model for PostBucketRequest. type PostBucketRequest struct { + // A description of the bucket. Description *string `json:"description,omitempty"` - Name string `json:"name"` - OrgID string `json:"orgID"` - // Rules to expire or retain data. No rules means data never expires. - RetentionRules RetentionRules `json:"retentionRules"` - Rp *string `json:"rp,omitempty"` - SchemaType *SchemaType `json:"schemaType,omitempty"` + // The name of the bucket. + Name string `json:"name"` + + // Organization ID. + // The ID of the organization. + OrgID string `json:"orgID"` + + // Retention rules to expire or retain data. + // #### InfluxDB Cloud + // + // - `retentionRules` is required. + // + // #### InfluxDB OSS + // + // - `retentionRules` isn't required. + RetentionRules *RetentionRules `json:"retentionRules,omitempty"` + + // Retention policy is an InfluxDB 1.x concept that represents the duration + // of time that each data point in the retention policy persists. Use `rp` + // for compatibility with InfluxDB 1.x. + // The InfluxDB 2.x and Cloud equivalent is + // [retention period](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#retention-period). + Rp *string `json:"rp,omitempty"` + SchemaType *SchemaType `json:"schemaType,omitempty"` } // PostCheck defines model for PostCheck. @@ -2843,35 +2952,82 @@ type Property struct { // PropertyKey defines model for PropertyKey. type PropertyKey interface{} -// Query influx using the Flux language +// Query InfluxDB with the Flux language type Query struct { - // Dialect are options to change the default CSV output format; https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions + // Options for tabular data output. + // Default output is [annotated CSV](https://docs.influxdata.com/influxdb/v2.3/reference/syntax/annotated-csv/#csv-response-format) with headers. + // + // For more information about tabular data **dialect**, + // see [W3 metadata vocabulary for tabular data](https://www.w3.org/TR/2015/REC-tabular-metadata-20151217/#dialect-descriptions). Dialect *Dialect `json:"dialect,omitempty"` // Represents a source from a single file Extern *File `json:"extern,omitempty"` - // Specifies the time that should be reported as "now" in the query. Default is the server's now time. + // Specifies the time that should be reported as `now` in the query. + // Default is the server `now` time. Now *time.Time `json:"now,omitempty"` - // Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both) + // Key-value pairs passed as parameters during query execution. + // + // To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: + // + // ```json + // query: "from(bucket: params.mybucket) |> range(start: params.rangeStart) |> limit(n:1)" + // ``` + // + // and pass _`params`_ with the key-value pairs--for example: + // + // ```json + // params: { + // "mybucket": "environment", + // "rangeStart": "-30d" + // } + // ``` + // + // During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. + // + // #### Limitations + // + // - If you use _`params`_, you can't use _`extern`_. Params *Query_Params `json:"params,omitempty"` - // Query script to execute. + // The query script to execute. Query string `json:"query"` // The type of query. Must be "flux". Type *QueryType `json:"type,omitempty"` } -// Enumeration of key/value pairs that respresent parameters to be injected into query (can only specify either this field or extern and not both) +// The type of query. Must be "flux". +type QueryType string + +// Key-value pairs passed as parameters during query execution. +// +// To use parameters in your query, pass a _`query`_ with `params` references (in dot notation)--for example: +// +// ```json +// query: "from(bucket: params.mybucket) |> range(start: params.rangeStart) |> limit(n:1)" +// ``` +// +// and pass _`params`_ with the key-value pairs--for example: +// +// ```json +// params: { +// "mybucket": "environment", +// "rangeStart": "-30d" +// } +// ``` +// +// During query execution, InfluxDB passes _`params`_ to your script and substitutes the values. +// +// #### Limitations +// +// - If you use _`params`_, you can't use _`extern`_. type Query_Params struct { AdditionalProperties map[string]interface{} `json:"-"` } -// The type of query. Must be "flux". -type QueryType string - // QueryEditMode defines model for QueryEditMode. type QueryEditMode string @@ -2979,7 +3135,8 @@ type Replication struct { MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes"` Name string `json:"name"` OrgID string `json:"orgID"` - RemoteBucketID string `json:"remoteBucketID"` + RemoteBucketID *string `json:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty"` RemoteID string `json:"remoteID"` } @@ -2988,10 +3145,12 @@ type ReplicationCreationRequest struct { Description *string `json:"description,omitempty"` DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty"` LocalBucketID string `json:"localBucketID"` + MaxAgeSeconds int64 `json:"maxAgeSeconds"` MaxQueueSizeBytes int64 `json:"maxQueueSizeBytes"` Name string `json:"name"` OrgID string `json:"orgID"` - RemoteBucketID string `json:"remoteBucketID"` + RemoteBucketID *string `json:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty"` RemoteID string `json:"remoteID"` } @@ -2999,9 +3158,11 @@ type ReplicationCreationRequest struct { type ReplicationUpdateRequest struct { Description *string `json:"description,omitempty"` DropNonRetryableData *bool `json:"dropNonRetryableData,omitempty"` + MaxAgeSeconds *int64 `json:"maxAgeSeconds,omitempty"` MaxQueueSizeBytes *int64 `json:"maxQueueSizeBytes,omitempty"` Name *string `json:"name,omitempty"` RemoteBucketID *string `json:"remoteBucketID,omitempty"` + RemoteBucketName *string `json:"remoteBucketName,omitempty"` RemoteID *string `json:"remoteID,omitempty"` } @@ -3012,21 +3173,28 @@ type Replications struct { // Resource defines model for Resource. type Resource struct { - // If ID is set that is a permission for a specific resource. if it is not set it is a permission for all resources of that resource type. + // The ID of a specific resource. + // In a `permission`, applies the permission to only the resource with this ID. Id *string `json:"id,omitempty"` - // Optional name of the resource if the resource has a name field. + // Optional: A name for the resource. + // Not all resource types have a name field. Name *string `json:"name,omitempty"` - // Optional name of the organization of the organization with orgID. + // Optional: The name of the organization with `orgID`. Org *string `json:"org,omitempty"` - // If orgID is set that is a permission for all resources owned my that org. if it is not set it is a permission for all resources of that resource type. - OrgID *string `json:"orgID,omitempty"` - Type ResourceType `json:"type"` + // The ID of the organization that owns the resource. + // In a `permission`, applies the permission to all resources of `type` owned by this organization. + OrgID *string `json:"orgID,omitempty"` + + // The type of resource. + // In a `permission`, applies the permission to all resources of this type. + Type ResourceType `json:"type"` } -// ResourceType defines model for Resource.Type. +// The type of resource. +// In a `permission`, applies the permission to all resources of this type. type ResourceType string // ResourceMember defines model for ResourceMember. @@ -3090,18 +3258,37 @@ type RetentionPolicyManifests []RetentionPolicyManifest // RetentionRule defines model for RetentionRule. type RetentionRule struct { - // Duration in seconds for how long data will be kept in the database. 0 means infinite. + // The duration in seconds for how long data will be kept in the database. + // The default duration is 2592000 (30 days). + // 0 represents infinite retention. EverySeconds int64 `json:"everySeconds"` - // Shard duration measured in seconds. - ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty"` - Type RetentionRuleType `json:"type"` + // The shard group duration. + // The duration or interval (in seconds) that each shard group covers. + // + // #### InfluxDB Cloud + // + // - Does not use `shardGroupDurationsSeconds`. + // + // #### InfluxDB OSS + // + // - Default value depends on the + // [bucket retention period](https://docs.influxdata.com/influxdb/v2.3/v2.3/reference/internals/shards/#shard-group-duration). + ShardGroupDurationSeconds *int64 `json:"shardGroupDurationSeconds,omitempty"` + Type *RetentionRuleType `json:"type,omitempty"` } // RetentionRuleType defines model for RetentionRule.Type. type RetentionRuleType string -// Rules to expire or retain data. No rules means data never expires. +// Retention rules to expire or retain data. +// #### InfluxDB Cloud +// +// - `retentionRules` is required. +// +// #### InfluxDB OSS +// +// - `retentionRules` isn't required. type RetentionRules []RetentionRule // Defines an expression to return @@ -3150,10 +3337,13 @@ type RuleStatusLevel string // Run defines model for Run. type Run struct { - // Time run finished executing, RFC3339Nano. + // The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run finished executing. FinishedAt *time.Time `json:"finishedAt,omitempty"` - Id *string `json:"id,omitempty"` - Links *struct { + + // Flux used for the task + Flux *string `json:"flux,omitempty"` + Id *string `json:"id,omitempty"` + Links *struct { Retry *string `json:"retry,omitempty"` Self *string `json:"self,omitempty"` Task *string `json:"task,omitempty"` @@ -3162,13 +3352,13 @@ type Run struct { // An array of logs associated with the run. Log *[]LogEvent `json:"log,omitempty"` - // Time run was manually requested, RFC3339Nano. + // The time ([RFC3339Nano date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339nano-timestamp)) the run was manually requested. RequestedAt *time.Time `json:"requestedAt,omitempty"` - // Time used for run's "now" option, RFC3339. + // The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp) used for the run's `now` option. ScheduledFor *time.Time `json:"scheduledFor,omitempty"` - // Time run started executing, RFC3339Nano. + // The time ([RFC3339Nano date/time format](https://go.dev/src/time/format.go)) the run started executing. StartedAt *time.Time `json:"startedAt,omitempty"` Status *RunStatus `json:"status,omitempty"` TaskID *string `json:"taskID,omitempty"` @@ -3179,12 +3369,15 @@ type RunStatus string // RunManually defines model for RunManually. type RunManually struct { - // Time used for run's "now" option, RFC3339. Default is the server's now time. + // The time [RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp) + // used for the run's `now` option. + // Default is the server _now_ time. ScheduledFor *time.Time `json:"scheduledFor"` } // Runs defines model for Runs. type Runs struct { + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` Runs *[]Run `json:"runs,omitempty"` } @@ -3210,6 +3403,8 @@ type SMTPNotificationRuleBaseType string // ScatterViewProperties defines model for ScatterViewProperties. type ScatterViewProperties struct { + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + // Colors define color encoding of data into a visualization Colors []string `json:"colors"` FillColumns []string `json:"fillColumns"` @@ -3358,7 +3553,7 @@ type ShardManifests []ShardManifest // ShardOwner defines model for ShardOwner. type ShardOwner struct { - // ID of the node that owns a shard. + // The ID of the node that owns the shard. NodeID int64 `json:"nodeID"` } @@ -3608,30 +3803,27 @@ type TagRuleOperator string // Task defines model for Task. type Task struct { - // ID of the authorization used when the task communicates with the query engine. + // The ID of the authorization used when the task communicates with the query engine. AuthorizationID *string `json:"authorizationID,omitempty"` CreatedAt *time.Time `json:"createdAt,omitempty"` - // [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. Cron scheduling is based on system time. - // Value is a [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview). + // [Cron expression](https://en.wikipedia.org/wiki/Cron#Overview) that defines the schedule on which the task runs. InfluxDB bases cron runs on the system time. Cron *string `json:"cron,omitempty"` - // Description of the task. + // The description of the task. Description *string `json:"description,omitempty"` - // Interval at which the task runs. `every` also determines when the task first runs, depending on the specified time. - // Value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals)). + // An interval ([duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals))) at which the task runs. `every` also determines when the task first runs, depending on the specified time. Every *string `json:"every,omitempty"` - // Flux script to run for this task. + // The Flux script that the task runs. Flux string `json:"flux"` Id string `json:"id"` Labels *Labels `json:"labels,omitempty"` LastRunError *string `json:"lastRunError,omitempty"` LastRunStatus *TaskLastRunStatus `json:"lastRunStatus,omitempty"` - // Timestamp of the latest scheduled and completed run. - // Value is a timestamp in [RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax). + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/flux/v0.x/data-types/basic/time/#time-syntax)) of the latest scheduled and completed run. LatestCompleted *time.Time `json:"latestCompleted,omitempty"` Links *struct { // URI of resource. @@ -3653,26 +3845,24 @@ type Task struct { Self *Link `json:"self,omitempty"` } `json:"links,omitempty"` - // Name of the task. + // The name of the task. Name string `json:"name"` - // [Duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. - // The value is a [duration literal](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals). + // A [duration](https://docs.influxdata.com/flux/v0.x/spec/lexical-elements/#duration-literals) to delay execution of the task after the scheduled time has elapsed. `0` removes the offset. Offset *string `json:"offset,omitempty"` - // Name of the organization that owns the task. + // The name of the organization that owns the task. Org *string `json:"org,omitempty"` - // ID of the organization that owns the task. + // The ID of the organization that owns the task. OrgID string `json:"orgID"` - // ID of the user who owns this Task. - OwnerID *string `json:"ownerID,omitempty"` - Status *TaskStatusType `json:"status,omitempty"` + // The ID of the user who owns the Task. + OwnerID *string `json:"ownerID,omitempty"` - // Type of the task, useful for filtering a task list. - Type *string `json:"type,omitempty"` - UpdatedAt *time.Time `json:"updatedAt,omitempty"` + // `inactive` cancels scheduled runs and prevents manual runs of the task. + Status *TaskStatusType `json:"status,omitempty"` + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } // TaskLastRunStatus defines model for Task.LastRunStatus. @@ -3690,37 +3880,42 @@ type TaskCreateRequest struct { Org *string `json:"org,omitempty"` // The ID of the organization that owns this Task. - OrgID *string `json:"orgID,omitempty"` + OrgID *string `json:"orgID,omitempty"` + + // `inactive` cancels scheduled runs and prevents manual runs of the task. Status *TaskStatusType `json:"status,omitempty"` } -// TaskStatusType defines model for TaskStatusType. +// `inactive` cancels scheduled runs and prevents manual runs of the task. type TaskStatusType string // TaskUpdateRequest defines model for TaskUpdateRequest. type TaskUpdateRequest struct { - // Override the 'cron' option in the flux script. + // Update the 'cron' option in the flux script. Cron *string `json:"cron,omitempty"` - // An optional description of the task. + // Update the description of the task. Description *string `json:"description,omitempty"` - // Override the 'every' option in the flux script. + // Update the 'every' option in the flux script. Every *string `json:"every,omitempty"` - // The Flux script to run for this task. + // The Flux script that the task runs. Flux *string `json:"flux,omitempty"` - // Override the 'name' option in the flux script. + // Update the 'name' option in the flux script. Name *string `json:"name,omitempty"` - // Override the 'offset' option in the flux script. - Offset *string `json:"offset,omitempty"` + // Update the 'offset' option in the flux script. + Offset *string `json:"offset,omitempty"` + + // `inactive` cancels scheduled runs and prevents manual runs of the task. Status *TaskStatusType `json:"status,omitempty"` } // Tasks defines model for Tasks. type Tasks struct { + // URI pointers for additional paged results. Links *Links `json:"links,omitempty"` Tasks *[]Task `json:"tasks,omitempty"` } @@ -3801,7 +3996,7 @@ type TelegramNotificationEndpoint struct { // Embedded struct due to allOf(#/components/schemas/NotificationEndpointBase) NotificationEndpointBase `yaml:",inline"` // Embedded fields due to inline allOf schema - // ID of the telegram channel, a chat_id in https://core.telegram.org/bots/api#sendmessage . + // The ID of the telegram channel; a chat_id in https://core.telegram.org/bots/api#sendmessage . Channel string `json:"channel"` // Specifies the Telegram bot token. See https://core.telegram.org/bots#creating-a-new-bot . @@ -3818,20 +4013,20 @@ type TelegramNotificationRule struct { // TelegramNotificationRuleBase defines model for TelegramNotificationRuleBase. type TelegramNotificationRuleBase struct { - // Disables preview of web links in the sent messages when "true". Defaults to "false" . + // Disables preview of web links in the sent messages when "true". Defaults to "false". DisableWebPagePreview *bool `json:"disableWebPagePreview,omitempty"` // The message template as a flux interpolated string. MessageTemplate string `json:"messageTemplate"` - // Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options . Defaults to "MarkdownV2" . + // Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options. Defaults to "MarkdownV2". ParseMode *TelegramNotificationRuleBaseParseMode `json:"parseMode,omitempty"` // The discriminator between other types of notification rules is "telegram". Type TelegramNotificationRuleBaseType `json:"type"` } -// Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options . Defaults to "MarkdownV2" . +// Parse mode of the message text per https://core.telegram.org/bots/api#formatting-options. Defaults to "MarkdownV2". type TelegramNotificationRuleBaseParseMode string // The discriminator between other types of notification rules is "telegram". @@ -3841,29 +4036,176 @@ type TelegramNotificationRuleBaseType string type Template []struct { ApiVersion *string `json:"apiVersion,omitempty"` Kind *TemplateKind `json:"kind,omitempty"` - Meta *struct { + + // Metadata properties used for the resource when the template is applied. + Metadata *struct { Name *string `json:"name,omitempty"` - } `json:"meta,omitempty"` + } `json:"metadata,omitempty"` + + // Configuration properties used for the resource when the template is applied. + // Key-value pairs map to the specification for the resource. + // + // The following code samples show `spec` configurations for template resources: + // + // - A bucket: + // + // ```json + // { "spec": { + // "name": "iot_center", + // "retentionRules": [{ + // "everySeconds": 2.592e+06, + // "type": "expire" + // }] + // } + // } + // ``` + // + // - A variable: + // + // ```json + // { "spec": { + // "language": "flux", + // "name": "Node_Service", + // "query": "import \"influxdata/influxdb/v1\"\r\nv1.tagValues(bucket: \"iot_center\", + // tag: \"service\")", + // "type": "query" + // } + // } + // ``` Spec *map[string]interface{} `json:"spec,omitempty"` } // TemplateApply defines model for TemplateApply. type TemplateApply struct { - Actions *[]interface{} `json:"actions,omitempty"` - DryRun *bool `json:"dryRun,omitempty"` + // A list of `action` objects. + // Actions let you customize how InfluxDB applies templates in the request. + // + // You can use the following actions to prevent creating or updating resources: + // + // - A `skipKind` action skips template resources of a specified `kind`. + // - A `skipResource` action skips template resources with a specified `metadata.name` + // and `kind`. + Actions *[]interface{} `json:"actions,omitempty"` + + // Only applies a dry run of the templates passed in the request. + // + // - Validates the template and generates a resource diff and summary. + // - Doesn't install templates or make changes to the InfluxDB instance. + DryRun *bool `json:"dryRun,omitempty"` + + // An object with key-value pairs that map to **environment references** in templates. + // + // Environment references in templates are `envRef` objects with an `envRef.key` + // property. + // To substitute a custom environment reference value when applying templates, + // pass `envRefs` with the `envRef.key` and the value. + // + // When you apply a template, InfluxDB replaces `envRef` objects in the template + // with the values that you provide in the `envRefs` parameter. + // For more examples, see how to [define environment references](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#define-environment-references). + // + // The following template fields may use environment references: + // + // - `metadata.name` + // - `spec.endpointName` + // - `spec.associations.name` + // + // For more information about including environment references in template fields, see how to + // [include user-definable resource names](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/create/#include-user-definable-resource-names). EnvRefs *TemplateApply_EnvRefs `json:"envRefs,omitempty"` - OrgID *string `json:"orgID,omitempty"` + + // Organization ID. + // InfluxDB applies templates to this organization. + // The organization owns all resources created by the template. + // + // To find your organization, see how to + // [view organizations](https://docs.influxdata.com/influxdb/v2.3/organizations/view-orgs/). + OrgID *string `json:"orgID,omitempty"` + + // A list of URLs for template files. + // + // To apply a template manifest file located at a URL, pass `remotes` + // with an array that contains the URL. Remotes *[]struct { ContentType *string `json:"contentType,omitempty"` Url string `json:"url"` } `json:"remotes,omitempty"` - Secrets *TemplateApply_Secrets `json:"secrets,omitempty"` - StackID *string `json:"stackID,omitempty"` + + // An object with key-value pairs that map to **secrets** in queries. + // + // Queries may reference secrets stored in InfluxDB--for example, + // the following Flux script retrieves `POSTGRES_USERNAME` and `POSTGRES_PASSWORD` + // secrets and then uses them to connect to a PostgreSQL database: + // + // ```js + // import "sql" + // import "influxdata/influxdb/secrets" + // + // username = secrets.get(key: "POSTGRES_USERNAME") + // password = secrets.get(key: "POSTGRES_PASSWORD") + // + // sql.from( + // driverName: "postgres", + // dataSourceName: "postgresql://${username}:${password}@localhost:5432", + // query: "SELECT * FROM example_table", + // ) + // ``` + // + // To define secret values in your `/api/v2/templates/apply` request, + // pass the `secrets` parameter with key-value pairs--for example: + // + // ```json + // { + // ... + // "secrets": { + // "POSTGRES_USERNAME": "pguser", + // "POSTGRES_PASSWORD": "foo" + // } + // ... + // } + // ``` + // + // InfluxDB stores the key-value pairs as secrets that you can access with `secrets.get()`. + // Once stored, you can't view secret values in InfluxDB. + // + // #### Related guides + // + // - [How to pass secrets when installing a template](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#pass-secrets-when-installing-a-template) + Secrets *TemplateApply_Secrets `json:"secrets,omitempty"` + + // ID of the stack to update. + // + // To apply templates to an existing stack in the organization, use the `stackID` parameter. + // If you apply templates without providing a stack ID, + // InfluxDB initializes a new stack with all new resources. + // + // To find a stack ID, use the InfluxDB [`/api/v2/stacks` API endpoint](#operation/ListStacks) to list stacks. + // + // #### Related guides + // + // - [Stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/) + // - [View stacks](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/stacks/view/) + StackID *string `json:"stackID,omitempty"` + + // A template object to apply. + // A template object has a `contents` property + // with an array of InfluxDB resource configurations. + // + // Pass `template` to apply only one template object. + // If you use `template`, you can't use the `templates` parameter. + // If you want to apply multiple template objects, use `templates` instead. Template *struct { ContentType *string `json:"contentType,omitempty"` Contents *Template `json:"contents,omitempty"` Sources *[]string `json:"sources,omitempty"` } `json:"template,omitempty"` + + // A list of template objects to apply. + // A template object has a `contents` property + // with an array of InfluxDB resource configurations. + // + // Use the `templates` parameter to apply multiple template objects. + // If you use `templates`, you can't use the `template` parameter. Templates *[]struct { ContentType *string `json:"contentType,omitempty"` Contents *Template `json:"contents,omitempty"` @@ -3871,12 +4213,69 @@ type TemplateApply struct { } `json:"templates,omitempty"` } -// TemplateApply_EnvRefs defines model for TemplateApply.EnvRefs. +// An object with key-value pairs that map to **environment references** in templates. +// +// Environment references in templates are `envRef` objects with an `envRef.key` +// property. +// To substitute a custom environment reference value when applying templates, +// pass `envRefs` with the `envRef.key` and the value. +// +// When you apply a template, InfluxDB replaces `envRef` objects in the template +// with the values that you provide in the `envRefs` parameter. +// For more examples, see how to [define environment references](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#define-environment-references). +// +// The following template fields may use environment references: +// +// - `metadata.name` +// - `spec.endpointName` +// - `spec.associations.name` +// +// For more information about including environment references in template fields, see how to +// [include user-definable resource names](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/create/#include-user-definable-resource-names). type TemplateApply_EnvRefs struct { AdditionalProperties map[string]interface{} `json:"-"` } -// TemplateApply_Secrets defines model for TemplateApply.Secrets. +// An object with key-value pairs that map to **secrets** in queries. +// +// Queries may reference secrets stored in InfluxDB--for example, +// the following Flux script retrieves `POSTGRES_USERNAME` and `POSTGRES_PASSWORD` +// secrets and then uses them to connect to a PostgreSQL database: +// +// ```js +// import "sql" +// import "influxdata/influxdb/secrets" +// +// username = secrets.get(key: "POSTGRES_USERNAME") +// password = secrets.get(key: "POSTGRES_PASSWORD") +// +// sql.from( +// driverName: "postgres", +// dataSourceName: "postgresql://${username}:${password}@localhost:5432", +// query: "SELECT * FROM example_table", +// ) +// ``` +// +// To define secret values in your `/api/v2/templates/apply` request, +// pass the `secrets` parameter with key-value pairs--for example: +// +// ```json +// { +// ... +// "secrets": { +// "POSTGRES_USERNAME": "pguser", +// "POSTGRES_PASSWORD": "foo" +// } +// ... +// } +// ``` +// +// InfluxDB stores the key-value pairs as secrets that you can access with `secrets.get()`. +// Once stored, you can't view secret values in InfluxDB. +// +// #### Related guides +// +// - [How to pass secrets when installing a template](https://docs.influxdata.com/influxdb/v2.3/influxdb-templates/use/#pass-secrets-when-installing-a-template) type TemplateApply_Secrets struct { AdditionalProperties map[string]string `json:"-"` } @@ -3953,14 +4352,28 @@ type TemplateSummary struct { Description *string `json:"description,omitempty"` Name *string `json:"name,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. + // #### InfluxDB Cloud + // + // - `retentionRules` is required. + // + // #### InfluxDB OSS + // + // - `retentionRules` isn't required. RetentionRules *RetentionRules `json:"retentionRules,omitempty"` } `json:"new,omitempty"` Old *struct { Description *string `json:"description,omitempty"` Name *string `json:"name,omitempty"` - // Rules to expire or retain data. No rules means data never expires. + // Retention rules to expire or retain data. + // #### InfluxDB Cloud + // + // - `retentionRules` is required. + // + // #### InfluxDB OSS + // + // - `retentionRules` isn't required. RetentionRules *RetentionRules `json:"retentionRules,omitempty"` } `json:"old,omitempty"` StateStatus *string `json:"stateStatus,omitempty"` @@ -4333,18 +4746,20 @@ type UserStatus string // UserResponse defines model for UserResponse. type UserResponse struct { + // The ID of the user. Id *string `json:"id,omitempty"` Links *struct { Self *string `json:"self,omitempty"` } `json:"links,omitempty"` - Name string `json:"name"` - OauthID *string `json:"oauthID,omitempty"` - // If inactive the user is inactive. + // The name of the user. + Name string `json:"name"` + + // The status of a user. An inactive user won't have access to resources. Status *UserResponseStatus `json:"status,omitempty"` } -// If inactive the user is inactive. +// The status of a user. An inactive user won't have access to resources. type UserResponseStatus string // Users defines model for Users. @@ -4412,6 +4827,8 @@ type XYGeom string // XYViewProperties defines model for XYViewProperties. type XYViewProperties struct { + AdaptiveZoomHide *bool `json:"adaptiveZoomHide,omitempty"` + // The viewport for a View's visualizations Axes Axes `json:"axes"` @@ -4478,27 +4895,45 @@ type Offset int // TraceSpan defines model for TraceSpan. type TraceSpan string -// ServerError defines model for ServerError. -type ServerError Error +// AuthorizationError defines model for AuthorizationError. +type AuthorizationError struct { + // The HTTP status code description. Default is `unauthorized`. + Code *AuthorizationErrorCode `json:"code,omitempty"` -// GetRoutesParams defines parameters for GetRoutes. -type GetRoutesParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + // A human-readable message that may contain detail about the error. + Message *string `json:"message,omitempty"` } +// The HTTP status code description. Default is `unauthorized`. +type AuthorizationErrorCode string + +// BadRequestError defines model for BadRequestError. +type BadRequestError Error + +// GeneralServerError defines model for GeneralServerError. +type GeneralServerError Error + +// InternalServerError defines model for InternalServerError. +type InternalServerError Error + +// ResourceNotFoundError defines model for ResourceNotFoundError. +type ResourceNotFoundError Error + // GetAuthorizationsParams defines parameters for GetAuthorizations. type GetAuthorizationsParams struct { - // Only show authorizations that belong to a user ID. + // A user ID. + // Only returns authorizations scoped to this user. UserID *string `json:"userID,omitempty"` - // Only show authorizations that belong to a user name. + // A user name. + // Only returns authorizations scoped to this user. User *string `json:"user,omitempty"` - // Only show authorizations that belong to an organization ID. + // An organization ID. Only returns authorizations that belong to this organization. OrgID *string `json:"orgID,omitempty"` - // Only show authorizations that belong to a organization name. + // An organization name. + // Only returns authorizations that belong to this organization. Org *string `json:"org,omitempty"` // OpenTracing span context @@ -4514,18 +4949,39 @@ type PostAuthorizationsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostAuthorizationsAllParams defines type for all parameters for PostAuthorizations. +type PostAuthorizationsAllParams struct { + PostAuthorizationsParams + + Body PostAuthorizationsJSONRequestBody +} + // DeleteAuthorizationsIDParams defines parameters for DeleteAuthorizationsID. type DeleteAuthorizationsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteAuthorizationsIDAllParams defines type for all parameters for DeleteAuthorizationsID. +type DeleteAuthorizationsIDAllParams struct { + DeleteAuthorizationsIDParams + + AuthID string +} + // GetAuthorizationsIDParams defines parameters for GetAuthorizationsID. type GetAuthorizationsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetAuthorizationsIDAllParams defines type for all parameters for GetAuthorizationsID. +type GetAuthorizationsIDAllParams struct { + GetAuthorizationsIDParams + + AuthID string +} + // PatchAuthorizationsIDJSONBody defines parameters for PatchAuthorizationsID. type PatchAuthorizationsIDJSONBody AuthorizationUpdateRequest @@ -4535,57 +4991,61 @@ type PatchAuthorizationsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// GetBackupKVParams defines parameters for GetBackupKV. -type GetBackupKVParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` -} - -// GetBackupMetadataParams defines parameters for GetBackupMetadata. -type GetBackupMetadataParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - - // Indicates the content encoding (usually a compression algorithm) that the client can understand. - AcceptEncoding *GetBackupMetadataParamsAcceptEncoding `json:"Accept-Encoding,omitempty"` -} - -// GetBackupMetadataParamsAcceptEncoding defines parameters for GetBackupMetadata. -type GetBackupMetadataParamsAcceptEncoding string +// PatchAuthorizationsIDAllParams defines type for all parameters for PatchAuthorizationsID. +type PatchAuthorizationsIDAllParams struct { + PatchAuthorizationsIDParams -// GetBackupShardIdParams defines parameters for GetBackupShardId. -type GetBackupShardIdParams struct { - // Earliest time to include in the snapshot. RFC3339 format. - Since *time.Time `json:"since,omitempty"` + AuthID string - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - - // Indicates the content encoding (usually a compression algorithm) that the client can understand. - AcceptEncoding *GetBackupShardIdParamsAcceptEncoding `json:"Accept-Encoding,omitempty"` + Body PatchAuthorizationsIDJSONRequestBody } -// GetBackupShardIdParamsAcceptEncoding defines parameters for GetBackupShardId. -type GetBackupShardIdParamsAcceptEncoding string - // GetBucketsParams defines parameters for GetBuckets. type GetBucketsParams struct { + // The offset for pagination. + // The number of records to skip. Offset *Offset `json:"offset,omitempty"` - Limit *Limit `json:"limit,omitempty"` + + // Limits the number of records returned. Default is `20`. + Limit *Limit `json:"limit,omitempty"` // Resource ID to seek from. Results are not inclusive of this ID. Use `after` instead of `offset`. After *After `json:"after,omitempty"` + // Organization name. // The name of the organization. + // + // #### InfluxDB Cloud + // + // - Doesn't use `org` or `orgID`. + // - Creates a bucket in the organization associated with the authorization (API token). + // + // #### InfluxDB OSS + // + // - Accepts either `org` or `orgID`. + // - InfluxDB creates the bucket within this organization. Org *string `json:"org,omitempty"` + // Organization ID. // The organization ID. + // + // #### InfluxDB Cloud + // + // - Doesn't use `org` or `orgID`. + // - Creates a bucket in the organization associated with the authorization (API token). + // + // #### InfluxDB OSS + // + // - Accepts either `org` or `orgID`. + // - InfluxDB creates the bucket within this organization. OrgID *string `json:"orgID,omitempty"` - // Only returns buckets with a specific name. + // Bucket name. + // Only returns buckets with this specific name. Name *string `json:"name,omitempty"` - // Only returns buckets with a specific ID. + // Bucket ID. + // Only returns the bucket with this ID. Id *string `json:"id,omitempty"` // OpenTracing span context @@ -4601,18 +5061,39 @@ type PostBucketsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostBucketsAllParams defines type for all parameters for PostBuckets. +type PostBucketsAllParams struct { + PostBucketsParams + + Body PostBucketsJSONRequestBody +} + // DeleteBucketsIDParams defines parameters for DeleteBucketsID. type DeleteBucketsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteBucketsIDAllParams defines type for all parameters for DeleteBucketsID. +type DeleteBucketsIDAllParams struct { + DeleteBucketsIDParams + + BucketID string +} + // GetBucketsIDParams defines parameters for GetBucketsID. type GetBucketsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetBucketsIDAllParams defines type for all parameters for GetBucketsID. +type GetBucketsIDAllParams struct { + GetBucketsIDParams + + BucketID string +} + // PatchBucketsIDJSONBody defines parameters for PatchBucketsID. type PatchBucketsIDJSONBody PatchBucketRequest @@ -4622,12 +5103,28 @@ type PatchBucketsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchBucketsIDAllParams defines type for all parameters for PatchBucketsID. +type PatchBucketsIDAllParams struct { + PatchBucketsIDParams + + BucketID string + + Body PatchBucketsIDJSONRequestBody +} + // GetBucketsIDLabelsParams defines parameters for GetBucketsIDLabels. type GetBucketsIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetBucketsIDLabelsAllParams defines type for all parameters for GetBucketsIDLabels. +type GetBucketsIDLabelsAllParams struct { + GetBucketsIDLabelsParams + + BucketID string +} + // PostBucketsIDLabelsJSONBody defines parameters for PostBucketsIDLabels. type PostBucketsIDLabelsJSONBody LabelMapping @@ -4637,18 +5134,43 @@ type PostBucketsIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostBucketsIDLabelsAllParams defines type for all parameters for PostBucketsIDLabels. +type PostBucketsIDLabelsAllParams struct { + PostBucketsIDLabelsParams + + BucketID string + + Body PostBucketsIDLabelsJSONRequestBody +} + // DeleteBucketsIDLabelsIDParams defines parameters for DeleteBucketsIDLabelsID. type DeleteBucketsIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteBucketsIDLabelsIDAllParams defines type for all parameters for DeleteBucketsIDLabelsID. +type DeleteBucketsIDLabelsIDAllParams struct { + DeleteBucketsIDLabelsIDParams + + BucketID string + + LabelID string +} + // GetBucketsIDMembersParams defines parameters for GetBucketsIDMembers. type GetBucketsIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetBucketsIDMembersAllParams defines type for all parameters for GetBucketsIDMembers. +type GetBucketsIDMembersAllParams struct { + GetBucketsIDMembersParams + + BucketID string +} + // PostBucketsIDMembersJSONBody defines parameters for PostBucketsIDMembers. type PostBucketsIDMembersJSONBody AddResourceMemberRequestBody @@ -4658,18 +5180,43 @@ type PostBucketsIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostBucketsIDMembersAllParams defines type for all parameters for PostBucketsIDMembers. +type PostBucketsIDMembersAllParams struct { + PostBucketsIDMembersParams + + BucketID string + + Body PostBucketsIDMembersJSONRequestBody +} + // DeleteBucketsIDMembersIDParams defines parameters for DeleteBucketsIDMembersID. type DeleteBucketsIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteBucketsIDMembersIDAllParams defines type for all parameters for DeleteBucketsIDMembersID. +type DeleteBucketsIDMembersIDAllParams struct { + DeleteBucketsIDMembersIDParams + + BucketID string + + UserID string +} + // GetBucketsIDOwnersParams defines parameters for GetBucketsIDOwners. type GetBucketsIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetBucketsIDOwnersAllParams defines type for all parameters for GetBucketsIDOwners. +type GetBucketsIDOwnersAllParams struct { + GetBucketsIDOwnersParams + + BucketID string +} + // PostBucketsIDOwnersJSONBody defines parameters for PostBucketsIDOwners. type PostBucketsIDOwnersJSONBody AddResourceMemberRequestBody @@ -4679,16 +5226,38 @@ type PostBucketsIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostBucketsIDOwnersAllParams defines type for all parameters for PostBucketsIDOwners. +type PostBucketsIDOwnersAllParams struct { + PostBucketsIDOwnersParams + + BucketID string + + Body PostBucketsIDOwnersJSONRequestBody +} + // DeleteBucketsIDOwnersIDParams defines parameters for DeleteBucketsIDOwnersID. type DeleteBucketsIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteBucketsIDOwnersIDAllParams defines type for all parameters for DeleteBucketsIDOwnersID. +type DeleteBucketsIDOwnersIDAllParams struct { + DeleteBucketsIDOwnersIDParams + + BucketID string + + UserID string +} + // GetChecksParams defines parameters for GetChecks. type GetChecksParams struct { + // The offset for pagination. + // The number of records to skip. Offset *Offset `json:"offset,omitempty"` - Limit *Limit `json:"limit,omitempty"` + + // Limits the number of records returned. Default is `20`. + Limit *Limit `json:"limit,omitempty"` // Only show checks that belong to a specific organization ID. OrgID string `json:"orgID"` @@ -4700,18 +5269,37 @@ type GetChecksParams struct { // CreateCheckJSONBody defines parameters for CreateCheck. type CreateCheckJSONBody PostCheck +// CreateCheckAllParams defines type for all parameters for CreateCheck. +type CreateCheckAllParams struct { + Body CreateCheckJSONRequestBody +} + // DeleteChecksIDParams defines parameters for DeleteChecksID. type DeleteChecksIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteChecksIDAllParams defines type for all parameters for DeleteChecksID. +type DeleteChecksIDAllParams struct { + DeleteChecksIDParams + + CheckID string +} + // GetChecksIDParams defines parameters for GetChecksID. type GetChecksIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetChecksIDAllParams defines type for all parameters for GetChecksID. +type GetChecksIDAllParams struct { + GetChecksIDParams + + CheckID string +} + // PatchChecksIDJSONBody defines parameters for PatchChecksID. type PatchChecksIDJSONBody CheckPatch @@ -4721,6 +5309,15 @@ type PatchChecksIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchChecksIDAllParams defines type for all parameters for PatchChecksID. +type PatchChecksIDAllParams struct { + PatchChecksIDParams + + CheckID string + + Body PatchChecksIDJSONRequestBody +} + // PutChecksIDJSONBody defines parameters for PutChecksID. type PutChecksIDJSONBody Check @@ -4730,12 +5327,28 @@ type PutChecksIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutChecksIDAllParams defines type for all parameters for PutChecksID. +type PutChecksIDAllParams struct { + PutChecksIDParams + + CheckID string + + Body PutChecksIDJSONRequestBody +} + // GetChecksIDLabelsParams defines parameters for GetChecksIDLabels. type GetChecksIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetChecksIDLabelsAllParams defines type for all parameters for GetChecksIDLabels. +type GetChecksIDLabelsAllParams struct { + GetChecksIDLabelsParams + + CheckID string +} + // PostChecksIDLabelsJSONBody defines parameters for PostChecksIDLabels. type PostChecksIDLabelsJSONBody LabelMapping @@ -4745,18 +5358,43 @@ type PostChecksIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostChecksIDLabelsAllParams defines type for all parameters for PostChecksIDLabels. +type PostChecksIDLabelsAllParams struct { + PostChecksIDLabelsParams + + CheckID string + + Body PostChecksIDLabelsJSONRequestBody +} + // DeleteChecksIDLabelsIDParams defines parameters for DeleteChecksIDLabelsID. type DeleteChecksIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteChecksIDLabelsIDAllParams defines type for all parameters for DeleteChecksIDLabelsID. +type DeleteChecksIDLabelsIDAllParams struct { + DeleteChecksIDLabelsIDParams + + CheckID string + + LabelID string +} + // GetChecksIDQueryParams defines parameters for GetChecksIDQuery. type GetChecksIDQueryParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetChecksIDQueryAllParams defines type for all parameters for GetChecksIDQuery. +type GetChecksIDQueryAllParams struct { + GetChecksIDQueryParams + + CheckID string +} + // GetConfigParams defines parameters for GetConfig. type GetConfigParams struct { // OpenTracing span context @@ -4765,7 +5403,11 @@ type GetConfigParams struct { // GetDashboardsParams defines parameters for GetDashboards. type GetDashboardsParams struct { - Offset *Offset `json:"offset,omitempty"` + // The offset for pagination. + // The number of records to skip. + Offset *Offset `json:"offset,omitempty"` + + // Limits the number of records returned. Default is `20`. Limit *Limit `json:"limit,omitempty"` Descending *Descending `json:"descending,omitempty"` @@ -4791,33 +5433,19 @@ type GetDashboardsParams struct { // GetDashboardsParamsSortBy defines parameters for GetDashboards. type GetDashboardsParamsSortBy string -// PostDashboardsJSONBody defines parameters for PostDashboards. -type PostDashboardsJSONBody CreateDashboardRequest - -// PostDashboardsParams defines parameters for PostDashboards. -type PostDashboardsParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` -} - // DeleteDashboardsIDParams defines parameters for DeleteDashboardsID. type DeleteDashboardsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// GetDashboardsIDParams defines parameters for GetDashboardsID. -type GetDashboardsIDParams struct { - // Includes the cell view properties in the response if set to `properties` - Include *GetDashboardsIDParamsInclude `json:"include,omitempty"` +// DeleteDashboardsIDAllParams defines type for all parameters for DeleteDashboardsID. +type DeleteDashboardsIDAllParams struct { + DeleteDashboardsIDParams - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + DashboardID string } -// GetDashboardsIDParamsInclude defines parameters for GetDashboardsID. -type GetDashboardsIDParamsInclude string - // PatchDashboardsIDJSONBody defines parameters for PatchDashboardsID. type PatchDashboardsIDJSONBody struct { Cells *CellWithViewProperties `json:"cells,omitempty"` @@ -4835,6 +5463,15 @@ type PatchDashboardsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchDashboardsIDAllParams defines type for all parameters for PatchDashboardsID. +type PatchDashboardsIDAllParams struct { + PatchDashboardsIDParams + + DashboardID string + + Body PatchDashboardsIDJSONRequestBody +} + // PostDashboardsIDCellsJSONBody defines parameters for PostDashboardsIDCells. type PostDashboardsIDCellsJSONBody CreateCell @@ -4844,6 +5481,15 @@ type PostDashboardsIDCellsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDashboardsIDCellsAllParams defines type for all parameters for PostDashboardsIDCells. +type PostDashboardsIDCellsAllParams struct { + PostDashboardsIDCellsParams + + DashboardID string + + Body PostDashboardsIDCellsJSONRequestBody +} + // PutDashboardsIDCellsJSONBody defines parameters for PutDashboardsIDCells. type PutDashboardsIDCellsJSONBody Cells @@ -4853,12 +5499,30 @@ type PutDashboardsIDCellsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutDashboardsIDCellsAllParams defines type for all parameters for PutDashboardsIDCells. +type PutDashboardsIDCellsAllParams struct { + PutDashboardsIDCellsParams + + DashboardID string + + Body PutDashboardsIDCellsJSONRequestBody +} + // DeleteDashboardsIDCellsIDParams defines parameters for DeleteDashboardsIDCellsID. type DeleteDashboardsIDCellsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteDashboardsIDCellsIDAllParams defines type for all parameters for DeleteDashboardsIDCellsID. +type DeleteDashboardsIDCellsIDAllParams struct { + DeleteDashboardsIDCellsIDParams + + DashboardID string + + CellID string +} + // PatchDashboardsIDCellsIDJSONBody defines parameters for PatchDashboardsIDCellsID. type PatchDashboardsIDCellsIDJSONBody CellUpdate @@ -4868,12 +5532,32 @@ type PatchDashboardsIDCellsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchDashboardsIDCellsIDAllParams defines type for all parameters for PatchDashboardsIDCellsID. +type PatchDashboardsIDCellsIDAllParams struct { + PatchDashboardsIDCellsIDParams + + DashboardID string + + CellID string + + Body PatchDashboardsIDCellsIDJSONRequestBody +} + // GetDashboardsIDCellsIDViewParams defines parameters for GetDashboardsIDCellsIDView. type GetDashboardsIDCellsIDViewParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetDashboardsIDCellsIDViewAllParams defines type for all parameters for GetDashboardsIDCellsIDView. +type GetDashboardsIDCellsIDViewAllParams struct { + GetDashboardsIDCellsIDViewParams + + DashboardID string + + CellID string +} + // PatchDashboardsIDCellsIDViewJSONBody defines parameters for PatchDashboardsIDCellsIDView. type PatchDashboardsIDCellsIDViewJSONBody View @@ -4883,12 +5567,30 @@ type PatchDashboardsIDCellsIDViewParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchDashboardsIDCellsIDViewAllParams defines type for all parameters for PatchDashboardsIDCellsIDView. +type PatchDashboardsIDCellsIDViewAllParams struct { + PatchDashboardsIDCellsIDViewParams + + DashboardID string + + CellID string + + Body PatchDashboardsIDCellsIDViewJSONRequestBody +} + // GetDashboardsIDLabelsParams defines parameters for GetDashboardsIDLabels. type GetDashboardsIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetDashboardsIDLabelsAllParams defines type for all parameters for GetDashboardsIDLabels. +type GetDashboardsIDLabelsAllParams struct { + GetDashboardsIDLabelsParams + + DashboardID string +} + // PostDashboardsIDLabelsJSONBody defines parameters for PostDashboardsIDLabels. type PostDashboardsIDLabelsJSONBody LabelMapping @@ -4898,18 +5600,43 @@ type PostDashboardsIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDashboardsIDLabelsAllParams defines type for all parameters for PostDashboardsIDLabels. +type PostDashboardsIDLabelsAllParams struct { + PostDashboardsIDLabelsParams + + DashboardID string + + Body PostDashboardsIDLabelsJSONRequestBody +} + // DeleteDashboardsIDLabelsIDParams defines parameters for DeleteDashboardsIDLabelsID. type DeleteDashboardsIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteDashboardsIDLabelsIDAllParams defines type for all parameters for DeleteDashboardsIDLabelsID. +type DeleteDashboardsIDLabelsIDAllParams struct { + DeleteDashboardsIDLabelsIDParams + + DashboardID string + + LabelID string +} + // GetDashboardsIDMembersParams defines parameters for GetDashboardsIDMembers. type GetDashboardsIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetDashboardsIDMembersAllParams defines type for all parameters for GetDashboardsIDMembers. +type GetDashboardsIDMembersAllParams struct { + GetDashboardsIDMembersParams + + DashboardID string +} + // PostDashboardsIDMembersJSONBody defines parameters for PostDashboardsIDMembers. type PostDashboardsIDMembersJSONBody AddResourceMemberRequestBody @@ -4919,18 +5646,43 @@ type PostDashboardsIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDashboardsIDMembersAllParams defines type for all parameters for PostDashboardsIDMembers. +type PostDashboardsIDMembersAllParams struct { + PostDashboardsIDMembersParams + + DashboardID string + + Body PostDashboardsIDMembersJSONRequestBody +} + // DeleteDashboardsIDMembersIDParams defines parameters for DeleteDashboardsIDMembersID. type DeleteDashboardsIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteDashboardsIDMembersIDAllParams defines type for all parameters for DeleteDashboardsIDMembersID. +type DeleteDashboardsIDMembersIDAllParams struct { + DeleteDashboardsIDMembersIDParams + + DashboardID string + + UserID string +} + // GetDashboardsIDOwnersParams defines parameters for GetDashboardsIDOwners. type GetDashboardsIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetDashboardsIDOwnersAllParams defines type for all parameters for GetDashboardsIDOwners. +type GetDashboardsIDOwnersAllParams struct { + GetDashboardsIDOwnersParams + + DashboardID string +} + // PostDashboardsIDOwnersJSONBody defines parameters for PostDashboardsIDOwners. type PostDashboardsIDOwnersJSONBody AddResourceMemberRequestBody @@ -4940,12 +5692,30 @@ type PostDashboardsIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDashboardsIDOwnersAllParams defines type for all parameters for PostDashboardsIDOwners. +type PostDashboardsIDOwnersAllParams struct { + PostDashboardsIDOwnersParams + + DashboardID string + + Body PostDashboardsIDOwnersJSONRequestBody +} + // DeleteDashboardsIDOwnersIDParams defines parameters for DeleteDashboardsIDOwnersID. type DeleteDashboardsIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteDashboardsIDOwnersIDAllParams defines type for all parameters for DeleteDashboardsIDOwnersID. +type DeleteDashboardsIDOwnersIDAllParams struct { + DeleteDashboardsIDOwnersIDParams + + DashboardID string + + UserID string +} + // GetDBRPsParams defines parameters for GetDBRPs. type GetDBRPsParams struct { // Specifies the organization ID to filter on @@ -4982,6 +5752,13 @@ type PostDBRPParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDBRPAllParams defines type for all parameters for PostDBRP. +type PostDBRPAllParams struct { + PostDBRPParams + + Body PostDBRPJSONRequestBody +} + // DeleteDBRPIDParams defines parameters for DeleteDBRPID. type DeleteDBRPIDParams struct { // Specifies the organization ID of the mapping @@ -4994,6 +5771,13 @@ type DeleteDBRPIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteDBRPIDAllParams defines type for all parameters for DeleteDBRPID. +type DeleteDBRPIDAllParams struct { + DeleteDBRPIDParams + + DbrpID string +} + // GetDBRPsIDParams defines parameters for GetDBRPsID. type GetDBRPsIDParams struct { // Specifies the organization ID of the mapping @@ -5006,6 +5790,13 @@ type GetDBRPsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetDBRPsIDAllParams defines type for all parameters for GetDBRPsID. +type GetDBRPsIDAllParams struct { + GetDBRPsIDParams + + DbrpID string +} + // PatchDBRPIDJSONBody defines parameters for PatchDBRPID. type PatchDBRPIDJSONBody DBRPUpdate @@ -5021,27 +5812,65 @@ type PatchDBRPIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchDBRPIDAllParams defines type for all parameters for PatchDBRPID. +type PatchDBRPIDAllParams struct { + PatchDBRPIDParams + + DbrpID string + + Body PatchDBRPIDJSONRequestBody +} + // PostDeleteJSONBody defines parameters for PostDelete. type PostDeleteJSONBody DeletePredicateRequest // PostDeleteParams defines parameters for PostDelete. type PostDeleteParams struct { - // Specifies the organization to delete data from. + // The organization to delete data from. + // If you pass both `orgID` and `org`, they must both be valid. + // + // #### InfluxDB Cloud + // + // - Doesn't require `org` or `orgID`. + // - Deletes data from the bucket in the organization associated with the authorization (API token). + // + // #### InfluxDB OSS + // + // - Requires either `org` or `orgID`. Org *string `json:"org,omitempty"` - // Specifies the bucket to delete data from. + // The name or ID of the bucket to delete data from. + // If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. Bucket *string `json:"bucket,omitempty"` - // Specifies the organization ID of the resource. + // The ID of the organization to delete data from. + // If you pass both `orgID` and `org`, they must both be valid. + // + // #### InfluxDB Cloud + // + // - Doesn't require `org` or `orgID`. + // - Deletes data from the bucket in the organization associated with the authorization (API token). + // + // #### InfluxDB OSS + // + // - Requires either `org` or `orgID`. OrgID *string `json:"orgID,omitempty"` - // Specifies the bucket ID to delete data from. + // The ID of the bucket to delete data from. + // If you pass both `bucket` and `bucketID`, `bucketID` takes precedence. BucketID *string `json:"bucketID,omitempty"` // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostDeleteAllParams defines type for all parameters for PostDelete. +type PostDeleteAllParams struct { + PostDeleteParams + + Body PostDeleteJSONRequestBody +} + // GetFlagsParams defines parameters for GetFlags. type GetFlagsParams struct { // OpenTracing span context @@ -5066,88 +5895,53 @@ type GetLabelsParams struct { // PostLabelsJSONBody defines parameters for PostLabels. type PostLabelsJSONBody LabelCreateRequest -// DeleteLabelsIDParams defines parameters for DeleteLabelsID. -type DeleteLabelsIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` +// PostLabelsAllParams defines type for all parameters for PostLabels. +type PostLabelsAllParams struct { + Body PostLabelsJSONRequestBody } -// GetLabelsIDParams defines parameters for GetLabelsID. -type GetLabelsIDParams struct { +// DeleteLabelsIDParams defines parameters for DeleteLabelsID. +type DeleteLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PatchLabelsIDJSONBody defines parameters for PatchLabelsID. -type PatchLabelsIDJSONBody LabelUpdate +// DeleteLabelsIDAllParams defines type for all parameters for DeleteLabelsID. +type DeleteLabelsIDAllParams struct { + DeleteLabelsIDParams -// PatchLabelsIDParams defines parameters for PatchLabelsID. -type PatchLabelsIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + LabelID string } -// GetLegacyAuthorizationsParams defines parameters for GetLegacyAuthorizations. -type GetLegacyAuthorizationsParams struct { - // Only show legacy authorizations that belong to a user ID. - UserID *string `json:"userID,omitempty"` - - // Only show legacy authorizations that belong to a user name. - User *string `json:"user,omitempty"` - - // Only show legacy authorizations that belong to an organization ID. - OrgID *string `json:"orgID,omitempty"` - - // Only show legacy authorizations that belong to a organization name. - Org *string `json:"org,omitempty"` - - // Only show legacy authorizations with a specified token (auth name). - Token *string `json:"token,omitempty"` - - // Only show legacy authorizations with a specified auth ID. - AuthID *string `json:"authID,omitempty"` - +// GetLabelsIDParams defines parameters for GetLabelsID. +type GetLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PostLegacyAuthorizationsJSONBody defines parameters for PostLegacyAuthorizations. -type PostLegacyAuthorizationsJSONBody LegacyAuthorizationPostRequest +// GetLabelsIDAllParams defines type for all parameters for GetLabelsID. +type GetLabelsIDAllParams struct { + GetLabelsIDParams -// PostLegacyAuthorizationsParams defines parameters for PostLegacyAuthorizations. -type PostLegacyAuthorizationsParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + LabelID string } -// DeleteLegacyAuthorizationsIDParams defines parameters for DeleteLegacyAuthorizationsID. -type DeleteLegacyAuthorizationsIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` -} +// PatchLabelsIDJSONBody defines parameters for PatchLabelsID. +type PatchLabelsIDJSONBody LabelUpdate -// GetLegacyAuthorizationsIDParams defines parameters for GetLegacyAuthorizationsID. -type GetLegacyAuthorizationsIDParams struct { +// PatchLabelsIDParams defines parameters for PatchLabelsID. +type PatchLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PatchLegacyAuthorizationsIDJSONBody defines parameters for PatchLegacyAuthorizationsID. -type PatchLegacyAuthorizationsIDJSONBody AuthorizationUpdateRequest - -// PatchLegacyAuthorizationsIDParams defines parameters for PatchLegacyAuthorizationsID. -type PatchLegacyAuthorizationsIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` -} +// PatchLabelsIDAllParams defines type for all parameters for PatchLabelsID. +type PatchLabelsIDAllParams struct { + PatchLabelsIDParams -// PostLegacyAuthorizationsIDPasswordJSONBody defines parameters for PostLegacyAuthorizationsIDPassword. -type PostLegacyAuthorizationsIDPasswordJSONBody PasswordResetBody + LabelID string -// PostLegacyAuthorizationsIDPasswordParams defines parameters for PostLegacyAuthorizationsIDPassword. -type PostLegacyAuthorizationsIDPasswordParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + Body PatchLabelsIDJSONRequestBody } // GetMeParams defines parameters for GetMe. @@ -5165,16 +5959,21 @@ type PutMePasswordParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// GetMetricsParams defines parameters for GetMetrics. -type GetMetricsParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` +// PutMePasswordAllParams defines type for all parameters for PutMePassword. +type PutMePasswordAllParams struct { + PutMePasswordParams + + Body PutMePasswordJSONRequestBody } // GetNotificationEndpointsParams defines parameters for GetNotificationEndpoints. type GetNotificationEndpointsParams struct { + // The offset for pagination. + // The number of records to skip. Offset *Offset `json:"offset,omitempty"` - Limit *Limit `json:"limit,omitempty"` + + // Limits the number of records returned. Default is `20`. + Limit *Limit `json:"limit,omitempty"` // Only show notification endpoints that belong to specific organization ID. OrgID string `json:"orgID"` @@ -5186,18 +5985,37 @@ type GetNotificationEndpointsParams struct { // CreateNotificationEndpointJSONBody defines parameters for CreateNotificationEndpoint. type CreateNotificationEndpointJSONBody PostNotificationEndpoint +// CreateNotificationEndpointAllParams defines type for all parameters for CreateNotificationEndpoint. +type CreateNotificationEndpointAllParams struct { + Body CreateNotificationEndpointJSONRequestBody +} + // DeleteNotificationEndpointsIDParams defines parameters for DeleteNotificationEndpointsID. type DeleteNotificationEndpointsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteNotificationEndpointsIDAllParams defines type for all parameters for DeleteNotificationEndpointsID. +type DeleteNotificationEndpointsIDAllParams struct { + DeleteNotificationEndpointsIDParams + + EndpointID string +} + // GetNotificationEndpointsIDParams defines parameters for GetNotificationEndpointsID. type GetNotificationEndpointsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetNotificationEndpointsIDAllParams defines type for all parameters for GetNotificationEndpointsID. +type GetNotificationEndpointsIDAllParams struct { + GetNotificationEndpointsIDParams + + EndpointID string +} + // PatchNotificationEndpointsIDJSONBody defines parameters for PatchNotificationEndpointsID. type PatchNotificationEndpointsIDJSONBody NotificationEndpointUpdate @@ -5207,6 +6025,15 @@ type PatchNotificationEndpointsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchNotificationEndpointsIDAllParams defines type for all parameters for PatchNotificationEndpointsID. +type PatchNotificationEndpointsIDAllParams struct { + PatchNotificationEndpointsIDParams + + EndpointID string + + Body PatchNotificationEndpointsIDJSONRequestBody +} + // PutNotificationEndpointsIDJSONBody defines parameters for PutNotificationEndpointsID. type PutNotificationEndpointsIDJSONBody NotificationEndpoint @@ -5216,12 +6043,28 @@ type PutNotificationEndpointsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutNotificationEndpointsIDAllParams defines type for all parameters for PutNotificationEndpointsID. +type PutNotificationEndpointsIDAllParams struct { + PutNotificationEndpointsIDParams + + EndpointID string + + Body PutNotificationEndpointsIDJSONRequestBody +} + // GetNotificationEndpointsIDLabelsParams defines parameters for GetNotificationEndpointsIDLabels. type GetNotificationEndpointsIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetNotificationEndpointsIDLabelsAllParams defines type for all parameters for GetNotificationEndpointsIDLabels. +type GetNotificationEndpointsIDLabelsAllParams struct { + GetNotificationEndpointsIDLabelsParams + + EndpointID string +} + // PostNotificationEndpointIDLabelsJSONBody defines parameters for PostNotificationEndpointIDLabels. type PostNotificationEndpointIDLabelsJSONBody LabelMapping @@ -5231,16 +6074,38 @@ type PostNotificationEndpointIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostNotificationEndpointIDLabelsAllParams defines type for all parameters for PostNotificationEndpointIDLabels. +type PostNotificationEndpointIDLabelsAllParams struct { + PostNotificationEndpointIDLabelsParams + + EndpointID string + + Body PostNotificationEndpointIDLabelsJSONRequestBody +} + // DeleteNotificationEndpointsIDLabelsIDParams defines parameters for DeleteNotificationEndpointsIDLabelsID. type DeleteNotificationEndpointsIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteNotificationEndpointsIDLabelsIDAllParams defines type for all parameters for DeleteNotificationEndpointsIDLabelsID. +type DeleteNotificationEndpointsIDLabelsIDAllParams struct { + DeleteNotificationEndpointsIDLabelsIDParams + + EndpointID string + + LabelID string +} + // GetNotificationRulesParams defines parameters for GetNotificationRules. type GetNotificationRulesParams struct { + // The offset for pagination. + // The number of records to skip. Offset *Offset `json:"offset,omitempty"` - Limit *Limit `json:"limit,omitempty"` + + // Limits the number of records returned. Default is `20`. + Limit *Limit `json:"limit,omitempty"` // Only show notification rules that belong to a specific organization ID. OrgID string `json:"orgID"` @@ -5258,18 +6123,37 @@ type GetNotificationRulesParams struct { // CreateNotificationRuleJSONBody defines parameters for CreateNotificationRule. type CreateNotificationRuleJSONBody PostNotificationRule +// CreateNotificationRuleAllParams defines type for all parameters for CreateNotificationRule. +type CreateNotificationRuleAllParams struct { + Body CreateNotificationRuleJSONRequestBody +} + // DeleteNotificationRulesIDParams defines parameters for DeleteNotificationRulesID. type DeleteNotificationRulesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteNotificationRulesIDAllParams defines type for all parameters for DeleteNotificationRulesID. +type DeleteNotificationRulesIDAllParams struct { + DeleteNotificationRulesIDParams + + RuleID string +} + // GetNotificationRulesIDParams defines parameters for GetNotificationRulesID. type GetNotificationRulesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetNotificationRulesIDAllParams defines type for all parameters for GetNotificationRulesID. +type GetNotificationRulesIDAllParams struct { + GetNotificationRulesIDParams + + RuleID string +} + // PatchNotificationRulesIDJSONBody defines parameters for PatchNotificationRulesID. type PatchNotificationRulesIDJSONBody NotificationRuleUpdate @@ -5279,6 +6163,15 @@ type PatchNotificationRulesIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchNotificationRulesIDAllParams defines type for all parameters for PatchNotificationRulesID. +type PatchNotificationRulesIDAllParams struct { + PatchNotificationRulesIDParams + + RuleID string + + Body PatchNotificationRulesIDJSONRequestBody +} + // PutNotificationRulesIDJSONBody defines parameters for PutNotificationRulesID. type PutNotificationRulesIDJSONBody NotificationRule @@ -5288,12 +6181,28 @@ type PutNotificationRulesIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutNotificationRulesIDAllParams defines type for all parameters for PutNotificationRulesID. +type PutNotificationRulesIDAllParams struct { + PutNotificationRulesIDParams + + RuleID string + + Body PutNotificationRulesIDJSONRequestBody +} + // GetNotificationRulesIDLabelsParams defines parameters for GetNotificationRulesIDLabels. type GetNotificationRulesIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetNotificationRulesIDLabelsAllParams defines type for all parameters for GetNotificationRulesIDLabels. +type GetNotificationRulesIDLabelsAllParams struct { + GetNotificationRulesIDLabelsParams + + RuleID string +} + // PostNotificationRuleIDLabelsJSONBody defines parameters for PostNotificationRuleIDLabels. type PostNotificationRuleIDLabelsJSONBody LabelMapping @@ -5303,31 +6212,63 @@ type PostNotificationRuleIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostNotificationRuleIDLabelsAllParams defines type for all parameters for PostNotificationRuleIDLabels. +type PostNotificationRuleIDLabelsAllParams struct { + PostNotificationRuleIDLabelsParams + + RuleID string + + Body PostNotificationRuleIDLabelsJSONRequestBody +} + // DeleteNotificationRulesIDLabelsIDParams defines parameters for DeleteNotificationRulesIDLabelsID. type DeleteNotificationRulesIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteNotificationRulesIDLabelsIDAllParams defines type for all parameters for DeleteNotificationRulesIDLabelsID. +type DeleteNotificationRulesIDLabelsIDAllParams struct { + DeleteNotificationRulesIDLabelsIDParams + + RuleID string + + LabelID string +} + // GetNotificationRulesIDQueryParams defines parameters for GetNotificationRulesIDQuery. type GetNotificationRulesIDQueryParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetNotificationRulesIDQueryAllParams defines type for all parameters for GetNotificationRulesIDQuery. +type GetNotificationRulesIDQueryAllParams struct { + GetNotificationRulesIDQueryParams + + RuleID string +} + // GetOrgsParams defines parameters for GetOrgs. type GetOrgsParams struct { - Offset *Offset `json:"offset,omitempty"` + // The offset for pagination. + // The number of records to skip. + Offset *Offset `json:"offset,omitempty"` + + // Limits the number of records returned. Default is `20`. Limit *Limit `json:"limit,omitempty"` Descending *Descending `json:"descending,omitempty"` - // Filter organizations to a specific organization name. + // An organization name. + // Only returns organizations with this name. Org *string `json:"org,omitempty"` - // Filter organizations to a specific organization ID. + // An organization ID. + // Only returns the organization with this ID. OrgID *string `json:"orgID,omitempty"` - // Filter organizations to a specific user ID. + // A user ID. + // Only returns organizations where this user is a member or owner. UserID *string `json:"userID,omitempty"` // OpenTracing span context @@ -5343,18 +6284,39 @@ type PostOrgsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostOrgsAllParams defines type for all parameters for PostOrgs. +type PostOrgsAllParams struct { + PostOrgsParams + + Body PostOrgsJSONRequestBody +} + // DeleteOrgsIDParams defines parameters for DeleteOrgsID. type DeleteOrgsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteOrgsIDAllParams defines type for all parameters for DeleteOrgsID. +type DeleteOrgsIDAllParams struct { + DeleteOrgsIDParams + + OrgID string +} + // GetOrgsIDParams defines parameters for GetOrgsID. type GetOrgsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetOrgsIDAllParams defines type for all parameters for GetOrgsID. +type GetOrgsIDAllParams struct { + GetOrgsIDParams + + OrgID string +} + // PatchOrgsIDJSONBody defines parameters for PatchOrgsID. type PatchOrgsIDJSONBody PatchOrganizationRequest @@ -5364,12 +6326,28 @@ type PatchOrgsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchOrgsIDAllParams defines type for all parameters for PatchOrgsID. +type PatchOrgsIDAllParams struct { + PatchOrgsIDParams + + OrgID string + + Body PatchOrgsIDJSONRequestBody +} + // GetOrgsIDMembersParams defines parameters for GetOrgsIDMembers. type GetOrgsIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetOrgsIDMembersAllParams defines type for all parameters for GetOrgsIDMembers. +type GetOrgsIDMembersAllParams struct { + GetOrgsIDMembersParams + + OrgID string +} + // PostOrgsIDMembersJSONBody defines parameters for PostOrgsIDMembers. type PostOrgsIDMembersJSONBody AddResourceMemberRequestBody @@ -5379,18 +6357,43 @@ type PostOrgsIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostOrgsIDMembersAllParams defines type for all parameters for PostOrgsIDMembers. +type PostOrgsIDMembersAllParams struct { + PostOrgsIDMembersParams + + OrgID string + + Body PostOrgsIDMembersJSONRequestBody +} + // DeleteOrgsIDMembersIDParams defines parameters for DeleteOrgsIDMembersID. type DeleteOrgsIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteOrgsIDMembersIDAllParams defines type for all parameters for DeleteOrgsIDMembersID. +type DeleteOrgsIDMembersIDAllParams struct { + DeleteOrgsIDMembersIDParams + + OrgID string + + UserID string +} + // GetOrgsIDOwnersParams defines parameters for GetOrgsIDOwners. type GetOrgsIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetOrgsIDOwnersAllParams defines type for all parameters for GetOrgsIDOwners. +type GetOrgsIDOwnersAllParams struct { + GetOrgsIDOwnersParams + + OrgID string +} + // PostOrgsIDOwnersJSONBody defines parameters for PostOrgsIDOwners. type PostOrgsIDOwnersJSONBody AddResourceMemberRequestBody @@ -5400,18 +6403,43 @@ type PostOrgsIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostOrgsIDOwnersAllParams defines type for all parameters for PostOrgsIDOwners. +type PostOrgsIDOwnersAllParams struct { + PostOrgsIDOwnersParams + + OrgID string + + Body PostOrgsIDOwnersJSONRequestBody +} + // DeleteOrgsIDOwnersIDParams defines parameters for DeleteOrgsIDOwnersID. type DeleteOrgsIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteOrgsIDOwnersIDAllParams defines type for all parameters for DeleteOrgsIDOwnersID. +type DeleteOrgsIDOwnersIDAllParams struct { + DeleteOrgsIDOwnersIDParams + + OrgID string + + UserID string +} + // GetOrgsIDSecretsParams defines parameters for GetOrgsIDSecrets. type GetOrgsIDSecretsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetOrgsIDSecretsAllParams defines type for all parameters for GetOrgsIDSecrets. +type GetOrgsIDSecretsAllParams struct { + GetOrgsIDSecretsParams + + OrgID string +} + // PatchOrgsIDSecretsJSONBody defines parameters for PatchOrgsIDSecrets. type PatchOrgsIDSecretsJSONBody Secrets @@ -5421,6 +6449,15 @@ type PatchOrgsIDSecretsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchOrgsIDSecretsAllParams defines type for all parameters for PatchOrgsIDSecrets. +type PatchOrgsIDSecretsAllParams struct { + PatchOrgsIDSecretsParams + + OrgID string + + Body PatchOrgsIDSecretsJSONRequestBody +} + // PostOrgsIDSecretsJSONBody defines parameters for PostOrgsIDSecrets. type PostOrgsIDSecretsJSONBody SecretKeys @@ -5430,37 +6467,30 @@ type PostOrgsIDSecretsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostOrgsIDSecretsAllParams defines type for all parameters for PostOrgsIDSecrets. +type PostOrgsIDSecretsAllParams struct { + PostOrgsIDSecretsParams + + OrgID string + + Body PostOrgsIDSecretsJSONRequestBody +} + // DeleteOrgsIDSecretsIDParams defines parameters for DeleteOrgsIDSecretsID. type DeleteOrgsIDSecretsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PostQueryJSONBody defines parameters for PostQuery. -type PostQueryJSONBody Query - -// PostQueryParams defines parameters for PostQuery. -type PostQueryParams struct { - // Specifies the name of the organization executing the query. Takes either the ID or Name. If both `orgID` and `org` are specified, `org` takes precedence. - Org *string `json:"org,omitempty"` - - // Specifies the ID of the organization executing the query. If both `orgID` and `org` are specified, `org` takes precedence. - OrgID *string `json:"orgID,omitempty"` +// DeleteOrgsIDSecretsIDAllParams defines type for all parameters for DeleteOrgsIDSecretsID. +type DeleteOrgsIDSecretsIDAllParams struct { + DeleteOrgsIDSecretsIDParams - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` + OrgID string - // Indicates the content encoding (usually a compression algorithm) that the client can understand. - AcceptEncoding *PostQueryParamsAcceptEncoding `json:"Accept-Encoding,omitempty"` - ContentType *PostQueryParamsContentType `json:"Content-Type,omitempty"` + SecretID string } -// PostQueryParamsAcceptEncoding defines parameters for PostQuery. -type PostQueryParamsAcceptEncoding string - -// PostQueryParamsContentType defines parameters for PostQuery. -type PostQueryParamsContentType string - // PostQueryAnalyzeJSONBody defines parameters for PostQueryAnalyze. type PostQueryAnalyzeJSONBody Query @@ -5474,6 +6504,13 @@ type PostQueryAnalyzeParams struct { // PostQueryAnalyzeParamsContentType defines parameters for PostQueryAnalyze. type PostQueryAnalyzeParamsContentType string +// PostQueryAnalyzeAllParams defines type for all parameters for PostQueryAnalyze. +type PostQueryAnalyzeAllParams struct { + PostQueryAnalyzeParams + + Body PostQueryAnalyzeJSONRequestBody +} + // PostQueryAstJSONBody defines parameters for PostQueryAst. type PostQueryAstJSONBody LanguageRequest @@ -5487,6 +6524,13 @@ type PostQueryAstParams struct { // PostQueryAstParamsContentType defines parameters for PostQueryAst. type PostQueryAstParamsContentType string +// PostQueryAstAllParams defines type for all parameters for PostQueryAst. +type PostQueryAstAllParams struct { + PostQueryAstParams + + Body PostQueryAstJSONRequestBody +} + // GetQuerySuggestionsParams defines parameters for GetQuerySuggestions. type GetQuerySuggestionsParams struct { // OpenTracing span context @@ -5499,6 +6543,13 @@ type GetQuerySuggestionsNameParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetQuerySuggestionsNameAllParams defines type for all parameters for GetQuerySuggestionsName. +type GetQuerySuggestionsNameAllParams struct { + GetQuerySuggestionsNameParams + + Name string +} + // GetReadyParams defines parameters for GetReady. type GetReadyParams struct { // OpenTracing span context @@ -5519,18 +6570,37 @@ type GetRemoteConnectionsParams struct { // PostRemoteConnectionJSONBody defines parameters for PostRemoteConnection. type PostRemoteConnectionJSONBody RemoteConnectionCreationRequest +// PostRemoteConnectionAllParams defines type for all parameters for PostRemoteConnection. +type PostRemoteConnectionAllParams struct { + Body PostRemoteConnectionJSONRequestBody +} + // DeleteRemoteConnectionByIDParams defines parameters for DeleteRemoteConnectionByID. type DeleteRemoteConnectionByIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteRemoteConnectionByIDAllParams defines type for all parameters for DeleteRemoteConnectionByID. +type DeleteRemoteConnectionByIDAllParams struct { + DeleteRemoteConnectionByIDParams + + RemoteID string +} + // GetRemoteConnectionByIDParams defines parameters for GetRemoteConnectionByID. type GetRemoteConnectionByIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetRemoteConnectionByIDAllParams defines type for all parameters for GetRemoteConnectionByID. +type GetRemoteConnectionByIDAllParams struct { + GetRemoteConnectionByIDParams + + RemoteID string +} + // PatchRemoteConnectionByIDJSONBody defines parameters for PatchRemoteConnectionByID. type PatchRemoteConnectionByIDJSONBody RemoteConnectionUpdateRequest @@ -5540,6 +6610,15 @@ type PatchRemoteConnectionByIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchRemoteConnectionByIDAllParams defines type for all parameters for PatchRemoteConnectionByID. +type PatchRemoteConnectionByIDAllParams struct { + PatchRemoteConnectionByIDParams + + RemoteID string + + Body PatchRemoteConnectionByIDJSONRequestBody +} + // GetReplicationsParams defines parameters for GetReplications. type GetReplicationsParams struct { // The organization ID. @@ -5564,18 +6643,39 @@ type PostReplicationParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostReplicationAllParams defines type for all parameters for PostReplication. +type PostReplicationAllParams struct { + PostReplicationParams + + Body PostReplicationJSONRequestBody +} + // DeleteReplicationByIDParams defines parameters for DeleteReplicationByID. type DeleteReplicationByIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteReplicationByIDAllParams defines type for all parameters for DeleteReplicationByID. +type DeleteReplicationByIDAllParams struct { + DeleteReplicationByIDParams + + ReplicationID string +} + // GetReplicationByIDParams defines parameters for GetReplicationByID. type GetReplicationByIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetReplicationByIDAllParams defines type for all parameters for GetReplicationByID. +type GetReplicationByIDAllParams struct { + GetReplicationByIDParams + + ReplicationID string +} + // PatchReplicationByIDJSONBody defines parameters for PatchReplicationByID. type PatchReplicationByIDJSONBody ReplicationUpdateRequest @@ -5588,28 +6688,34 @@ type PatchReplicationByIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchReplicationByIDAllParams defines type for all parameters for PatchReplicationByID. +type PatchReplicationByIDAllParams struct { + PatchReplicationByIDParams + + ReplicationID string + + Body PatchReplicationByIDJSONRequestBody +} + // PostValidateReplicationByIDParams defines parameters for PostValidateReplicationByID. type PostValidateReplicationByIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostValidateReplicationByIDAllParams defines type for all parameters for PostValidateReplicationByID. +type PostValidateReplicationByIDAllParams struct { + PostValidateReplicationByIDParams + + ReplicationID string +} + // GetResourcesParams defines parameters for GetResources. type GetResourcesParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PostRestoreBucketIDParams defines parameters for PostRestoreBucketID. -type PostRestoreBucketIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - ContentType *PostRestoreBucketIDParamsContentType `json:"Content-Type,omitempty"` -} - -// PostRestoreBucketIDParamsContentType defines parameters for PostRestoreBucketID. -type PostRestoreBucketIDParamsContentType string - // PostRestoreBucketMetadataJSONBody defines parameters for PostRestoreBucketMetadata. type PostRestoreBucketMetadataJSONBody BucketMetadataManifest @@ -5619,57 +6725,13 @@ type PostRestoreBucketMetadataParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// PostRestoreKVParams defines parameters for PostRestoreKV. -type PostRestoreKVParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` +// PostRestoreBucketMetadataAllParams defines type for all parameters for PostRestoreBucketMetadata. +type PostRestoreBucketMetadataAllParams struct { + PostRestoreBucketMetadataParams - // The value tells InfluxDB what compression is applied to the line protocol in the request payload. - // To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. - ContentEncoding *PostRestoreKVParamsContentEncoding `json:"Content-Encoding,omitempty"` - ContentType *PostRestoreKVParamsContentType `json:"Content-Type,omitempty"` + Body PostRestoreBucketMetadataJSONRequestBody } -// PostRestoreKVParamsContentEncoding defines parameters for PostRestoreKV. -type PostRestoreKVParamsContentEncoding string - -// PostRestoreKVParamsContentType defines parameters for PostRestoreKV. -type PostRestoreKVParamsContentType string - -// PostRestoreShardIdParams defines parameters for PostRestoreShardId. -type PostRestoreShardIdParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - - // The value tells InfluxDB what compression is applied to the line protocol in the request payload. - // To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. - ContentEncoding *PostRestoreShardIdParamsContentEncoding `json:"Content-Encoding,omitempty"` - ContentType *PostRestoreShardIdParamsContentType `json:"Content-Type,omitempty"` -} - -// PostRestoreShardIdParamsContentEncoding defines parameters for PostRestoreShardId. -type PostRestoreShardIdParamsContentEncoding string - -// PostRestoreShardIdParamsContentType defines parameters for PostRestoreShardId. -type PostRestoreShardIdParamsContentType string - -// PostRestoreSQLParams defines parameters for PostRestoreSQL. -type PostRestoreSQLParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - - // The value tells InfluxDB what compression is applied to the line protocol in the request payload. - // To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. - ContentEncoding *PostRestoreSQLParamsContentEncoding `json:"Content-Encoding,omitempty"` - ContentType *PostRestoreSQLParamsContentType `json:"Content-Type,omitempty"` -} - -// PostRestoreSQLParamsContentEncoding defines parameters for PostRestoreSQL. -type PostRestoreSQLParamsContentEncoding string - -// PostRestoreSQLParamsContentType defines parameters for PostRestoreSQL. -type PostRestoreSQLParamsContentType string - // GetScrapersParams defines parameters for GetScrapers. type GetScrapersParams struct { // Specifies the name of the scraper target. @@ -5697,18 +6759,39 @@ type PostScrapersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostScrapersAllParams defines type for all parameters for PostScrapers. +type PostScrapersAllParams struct { + PostScrapersParams + + Body PostScrapersJSONRequestBody +} + // DeleteScrapersIDParams defines parameters for DeleteScrapersID. type DeleteScrapersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteScrapersIDAllParams defines type for all parameters for DeleteScrapersID. +type DeleteScrapersIDAllParams struct { + DeleteScrapersIDParams + + ScraperTargetID string +} + // GetScrapersIDParams defines parameters for GetScrapersID. type GetScrapersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetScrapersIDAllParams defines type for all parameters for GetScrapersID. +type GetScrapersIDAllParams struct { + GetScrapersIDParams + + ScraperTargetID string +} + // PatchScrapersIDJSONBody defines parameters for PatchScrapersID. type PatchScrapersIDJSONBody ScraperTargetRequest @@ -5718,12 +6801,28 @@ type PatchScrapersIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchScrapersIDAllParams defines type for all parameters for PatchScrapersID. +type PatchScrapersIDAllParams struct { + PatchScrapersIDParams + + ScraperTargetID string + + Body PatchScrapersIDJSONRequestBody +} + // GetScrapersIDLabelsParams defines parameters for GetScrapersIDLabels. type GetScrapersIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetScrapersIDLabelsAllParams defines type for all parameters for GetScrapersIDLabels. +type GetScrapersIDLabelsAllParams struct { + GetScrapersIDLabelsParams + + ScraperTargetID string +} + // PostScrapersIDLabelsJSONBody defines parameters for PostScrapersIDLabels. type PostScrapersIDLabelsJSONBody LabelMapping @@ -5733,18 +6832,43 @@ type PostScrapersIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostScrapersIDLabelsAllParams defines type for all parameters for PostScrapersIDLabels. +type PostScrapersIDLabelsAllParams struct { + PostScrapersIDLabelsParams + + ScraperTargetID string + + Body PostScrapersIDLabelsJSONRequestBody +} + // DeleteScrapersIDLabelsIDParams defines parameters for DeleteScrapersIDLabelsID. type DeleteScrapersIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteScrapersIDLabelsIDAllParams defines type for all parameters for DeleteScrapersIDLabelsID. +type DeleteScrapersIDLabelsIDAllParams struct { + DeleteScrapersIDLabelsIDParams + + ScraperTargetID string + + LabelID string +} + // GetScrapersIDMembersParams defines parameters for GetScrapersIDMembers. type GetScrapersIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetScrapersIDMembersAllParams defines type for all parameters for GetScrapersIDMembers. +type GetScrapersIDMembersAllParams struct { + GetScrapersIDMembersParams + + ScraperTargetID string +} + // PostScrapersIDMembersJSONBody defines parameters for PostScrapersIDMembers. type PostScrapersIDMembersJSONBody AddResourceMemberRequestBody @@ -5754,18 +6878,43 @@ type PostScrapersIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostScrapersIDMembersAllParams defines type for all parameters for PostScrapersIDMembers. +type PostScrapersIDMembersAllParams struct { + PostScrapersIDMembersParams + + ScraperTargetID string + + Body PostScrapersIDMembersJSONRequestBody +} + // DeleteScrapersIDMembersIDParams defines parameters for DeleteScrapersIDMembersID. type DeleteScrapersIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteScrapersIDMembersIDAllParams defines type for all parameters for DeleteScrapersIDMembersID. +type DeleteScrapersIDMembersIDAllParams struct { + DeleteScrapersIDMembersIDParams + + ScraperTargetID string + + UserID string +} + // GetScrapersIDOwnersParams defines parameters for GetScrapersIDOwners. type GetScrapersIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetScrapersIDOwnersAllParams defines type for all parameters for GetScrapersIDOwners. +type GetScrapersIDOwnersAllParams struct { + GetScrapersIDOwnersParams + + ScraperTargetID string +} + // PostScrapersIDOwnersJSONBody defines parameters for PostScrapersIDOwners. type PostScrapersIDOwnersJSONBody AddResourceMemberRequestBody @@ -5775,12 +6924,30 @@ type PostScrapersIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostScrapersIDOwnersAllParams defines type for all parameters for PostScrapersIDOwners. +type PostScrapersIDOwnersAllParams struct { + PostScrapersIDOwnersParams + + ScraperTargetID string + + Body PostScrapersIDOwnersJSONRequestBody +} + // DeleteScrapersIDOwnersIDParams defines parameters for DeleteScrapersIDOwnersID. type DeleteScrapersIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteScrapersIDOwnersIDAllParams defines type for all parameters for DeleteScrapersIDOwnersID. +type DeleteScrapersIDOwnersIDAllParams struct { + DeleteScrapersIDOwnersIDParams + + ScraperTargetID string + + UserID string +} + // GetSetupParams defines parameters for GetSetup. type GetSetupParams struct { // OpenTracing span context @@ -5796,6 +6963,13 @@ type PostSetupParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostSetupAllParams defines type for all parameters for PostSetup. +type PostSetupAllParams struct { + PostSetupParams + + Body PostSetupJSONRequestBody +} + // PostSigninParams defines parameters for PostSignin. type PostSigninParams struct { // OpenTracing span context @@ -5826,18 +7000,39 @@ type PostSourcesParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostSourcesAllParams defines type for all parameters for PostSources. +type PostSourcesAllParams struct { + PostSourcesParams + + Body PostSourcesJSONRequestBody +} + // DeleteSourcesIDParams defines parameters for DeleteSourcesID. type DeleteSourcesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteSourcesIDAllParams defines type for all parameters for DeleteSourcesID. +type DeleteSourcesIDAllParams struct { + DeleteSourcesIDParams + + SourceID string +} + // GetSourcesIDParams defines parameters for GetSourcesID. type GetSourcesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetSourcesIDAllParams defines type for all parameters for GetSourcesID. +type GetSourcesIDAllParams struct { + GetSourcesIDParams + + SourceID string +} + // PatchSourcesIDJSONBody defines parameters for PatchSourcesID. type PatchSourcesIDJSONBody Source @@ -5847,6 +7042,15 @@ type PatchSourcesIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchSourcesIDAllParams defines type for all parameters for PatchSourcesID. +type PatchSourcesIDAllParams struct { + PatchSourcesIDParams + + SourceID string + + Body PatchSourcesIDJSONRequestBody +} + // GetSourcesIDBucketsParams defines parameters for GetSourcesIDBuckets. type GetSourcesIDBucketsParams struct { // The name of the organization. @@ -5856,21 +7060,55 @@ type GetSourcesIDBucketsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetSourcesIDBucketsAllParams defines type for all parameters for GetSourcesIDBuckets. +type GetSourcesIDBucketsAllParams struct { + GetSourcesIDBucketsParams + + SourceID string +} + // GetSourcesIDHealthParams defines parameters for GetSourcesIDHealth. type GetSourcesIDHealthParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetSourcesIDHealthAllParams defines type for all parameters for GetSourcesIDHealth. +type GetSourcesIDHealthAllParams struct { + GetSourcesIDHealthParams + + SourceID string +} + // ListStacksParams defines parameters for ListStacks. type ListStacksParams struct { - // The organization ID of the stacks + // The ID of the organization that owns the stacks. + // Only returns stacks owned by this organization. + // + // #### InfluxDB Cloud + // + // - Doesn't require this parameter; + // InfluxDB only returns resources allowed by the API token. OrgID string `json:"orgID"` - // A collection of names to filter the list by. + // The stack name. + // Finds stack `events` with this name and returns the stacks. + // + // Repeatable. + // To filter for more than one stack name, + // repeat this parameter with each name--for example: + // + // - `http://localhost:8086/api/v2/stacks?&orgID=INFLUX_ORG_ID&name=project-stack-0&name=project-stack-1` Name *string `json:"name,omitempty"` - // A collection of stackIDs to filter the list by. + // The stack ID. + // Only returns stacks with this ID. + // + // Repeatable. + // To filter for more than one stack ID, + // repeat this parameter with each ID--for example: + // + // - `http://localhost:8086/api/v2/stacks?&orgID=INFLUX_ORG_ID&stackID=09bd87cd33be3000&stackID=09bef35081fe3000` StackID *string `json:"stackID,omitempty"` } @@ -5882,12 +7120,29 @@ type CreateStackJSONBody struct { Urls *[]string `json:"urls,omitempty"` } +// CreateStackAllParams defines type for all parameters for CreateStack. +type CreateStackAllParams struct { + Body CreateStackJSONRequestBody +} + // DeleteStackParams defines parameters for DeleteStack. type DeleteStackParams struct { // The identifier of the organization. OrgID string `json:"orgID"` } +// DeleteStackAllParams defines type for all parameters for DeleteStack. +type DeleteStackAllParams struct { + DeleteStackParams + + StackId string +} + +// ReadStackAllParams defines type for all parameters for ReadStack. +type ReadStackAllParams struct { + StackId string +} + // UpdateStackJSONBody defines parameters for UpdateStack. type UpdateStackJSONBody struct { AdditionalResources *[]struct { @@ -5900,30 +7155,53 @@ type UpdateStackJSONBody struct { TemplateURLs *[]string `json:"templateURLs"` } +// UpdateStackAllParams defines type for all parameters for UpdateStack. +type UpdateStackAllParams struct { + StackId string + + Body UpdateStackJSONRequestBody +} + +// UninstallStackAllParams defines type for all parameters for UninstallStack. +type UninstallStackAllParams struct { + StackId string +} + // GetTasksParams defines parameters for GetTasks. type GetTasksParams struct { - // Returns task with a specific name. + // Task name. + // Only returns tasks with this name. + // Different tasks may have the same name. Name *string `json:"name,omitempty"` - // Return tasks after a specified ID. + // Task ID. + // Only returns tasks created after this task. After *string `json:"after,omitempty"` - // Filter tasks to a specific user ID. + // User ID. + // Only returns tasks owned by this user. User *string `json:"user,omitempty"` - // Filter tasks to a specific organization name. + // Organization name. + // Only returns tasks owned by this organization. Org *string `json:"org,omitempty"` - // Filter tasks to a specific organization ID. + // Organization ID. + // Only returns tasks owned by this organization. OrgID *string `json:"orgID,omitempty"` - // Filter tasks by a status--"inactive" or "active". + // Task status (`active` or `inactive`). + // Only returns tasks with this status. Status *GetTasksParamsStatus `json:"status,omitempty"` - // The number of tasks to return + // Limits the number of tasks returned. + // The minimum is `1`, the maximum is `500`, and the default is `100`. Limit *int `json:"limit,omitempty"` - // Type of task, unset by default. + // Task type (`basic` or `system`). + // + // The default (`system`) response contains all the metadata properties for tasks. + // To reduce the payload size, pass `basic` to omit some task properties (`flux`, `createdAt`, `updatedAt`) from the response. Type *GetTasksParamsType `json:"type,omitempty"` // OpenTracing span context @@ -5945,18 +7223,39 @@ type PostTasksParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksAllParams defines type for all parameters for PostTasks. +type PostTasksAllParams struct { + PostTasksParams + + Body PostTasksJSONRequestBody +} + // DeleteTasksIDParams defines parameters for DeleteTasksID. type DeleteTasksIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTasksIDAllParams defines type for all parameters for DeleteTasksID. +type DeleteTasksIDAllParams struct { + DeleteTasksIDParams + + TaskID string +} + // GetTasksIDParams defines parameters for GetTasksID. type GetTasksIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDAllParams defines type for all parameters for GetTasksID. +type GetTasksIDAllParams struct { + GetTasksIDParams + + TaskID string +} + // PatchTasksIDJSONBody defines parameters for PatchTasksID. type PatchTasksIDJSONBody TaskUpdateRequest @@ -5966,12 +7265,28 @@ type PatchTasksIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchTasksIDAllParams defines type for all parameters for PatchTasksID. +type PatchTasksIDAllParams struct { + PatchTasksIDParams + + TaskID string + + Body PatchTasksIDJSONRequestBody +} + // GetTasksIDLabelsParams defines parameters for GetTasksIDLabels. type GetTasksIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDLabelsAllParams defines type for all parameters for GetTasksIDLabels. +type GetTasksIDLabelsAllParams struct { + GetTasksIDLabelsParams + + TaskID string +} + // PostTasksIDLabelsJSONBody defines parameters for PostTasksIDLabels. type PostTasksIDLabelsJSONBody LabelMapping @@ -5981,24 +7296,56 @@ type PostTasksIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksIDLabelsAllParams defines type for all parameters for PostTasksIDLabels. +type PostTasksIDLabelsAllParams struct { + PostTasksIDLabelsParams + + TaskID string + + Body PostTasksIDLabelsJSONRequestBody +} + // DeleteTasksIDLabelsIDParams defines parameters for DeleteTasksIDLabelsID. type DeleteTasksIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTasksIDLabelsIDAllParams defines type for all parameters for DeleteTasksIDLabelsID. +type DeleteTasksIDLabelsIDAllParams struct { + DeleteTasksIDLabelsIDParams + + TaskID string + + LabelID string +} + // GetTasksIDLogsParams defines parameters for GetTasksIDLogs. type GetTasksIDLogsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDLogsAllParams defines type for all parameters for GetTasksIDLogs. +type GetTasksIDLogsAllParams struct { + GetTasksIDLogsParams + + TaskID string +} + // GetTasksIDMembersParams defines parameters for GetTasksIDMembers. type GetTasksIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDMembersAllParams defines type for all parameters for GetTasksIDMembers. +type GetTasksIDMembersAllParams struct { + GetTasksIDMembersParams + + TaskID string +} + // PostTasksIDMembersJSONBody defines parameters for PostTasksIDMembers. type PostTasksIDMembersJSONBody AddResourceMemberRequestBody @@ -6008,18 +7355,43 @@ type PostTasksIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksIDMembersAllParams defines type for all parameters for PostTasksIDMembers. +type PostTasksIDMembersAllParams struct { + PostTasksIDMembersParams + + TaskID string + + Body PostTasksIDMembersJSONRequestBody +} + // DeleteTasksIDMembersIDParams defines parameters for DeleteTasksIDMembersID. type DeleteTasksIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTasksIDMembersIDAllParams defines type for all parameters for DeleteTasksIDMembersID. +type DeleteTasksIDMembersIDAllParams struct { + DeleteTasksIDMembersIDParams + + TaskID string + + UserID string +} + // GetTasksIDOwnersParams defines parameters for GetTasksIDOwners. type GetTasksIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDOwnersAllParams defines type for all parameters for GetTasksIDOwners. +type GetTasksIDOwnersAllParams struct { + GetTasksIDOwnersParams + + TaskID string +} + // PostTasksIDOwnersJSONBody defines parameters for PostTasksIDOwners. type PostTasksIDOwnersJSONBody AddResourceMemberRequestBody @@ -6029,30 +7401,57 @@ type PostTasksIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksIDOwnersAllParams defines type for all parameters for PostTasksIDOwners. +type PostTasksIDOwnersAllParams struct { + PostTasksIDOwnersParams + + TaskID string + + Body PostTasksIDOwnersJSONRequestBody +} + // DeleteTasksIDOwnersIDParams defines parameters for DeleteTasksIDOwnersID. type DeleteTasksIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTasksIDOwnersIDAllParams defines type for all parameters for DeleteTasksIDOwnersID. +type DeleteTasksIDOwnersIDAllParams struct { + DeleteTasksIDOwnersIDParams + + TaskID string + + UserID string +} + // GetTasksIDRunsParams defines parameters for GetTasksIDRuns. type GetTasksIDRunsParams struct { - // Returns runs after a specific ID. + // A task run ID. Only returns runs created after this run. After *string `json:"after,omitempty"` - // The number of runs to return + // Limits the number of task runs returned. Default is `100`. Limit *int `json:"limit,omitempty"` - // Filter runs to those scheduled after this time, RFC3339 + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + // Only returns runs scheduled after this time. AfterTime *time.Time `json:"afterTime,omitempty"` - // Filter runs to those scheduled before this time, RFC3339 + // A timestamp ([RFC3339 date/time format](https://docs.influxdata.com/influxdb/v2.3/reference/glossary/#rfc3339-timestamp)). + // Only returns runs scheduled before this time. BeforeTime *time.Time `json:"beforeTime,omitempty"` // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDRunsAllParams defines type for all parameters for GetTasksIDRuns. +type GetTasksIDRunsAllParams struct { + GetTasksIDRunsParams + + TaskID string +} + // PostTasksIDRunsJSONBody defines parameters for PostTasksIDRuns. type PostTasksIDRunsJSONBody RunManually @@ -6062,30 +7461,80 @@ type PostTasksIDRunsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksIDRunsAllParams defines type for all parameters for PostTasksIDRuns. +type PostTasksIDRunsAllParams struct { + PostTasksIDRunsParams + + TaskID string + + Body PostTasksIDRunsJSONRequestBody +} + // DeleteTasksIDRunsIDParams defines parameters for DeleteTasksIDRunsID. type DeleteTasksIDRunsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTasksIDRunsIDAllParams defines type for all parameters for DeleteTasksIDRunsID. +type DeleteTasksIDRunsIDAllParams struct { + DeleteTasksIDRunsIDParams + + TaskID string + + RunID string +} + // GetTasksIDRunsIDParams defines parameters for GetTasksIDRunsID. type GetTasksIDRunsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDRunsIDAllParams defines type for all parameters for GetTasksIDRunsID. +type GetTasksIDRunsIDAllParams struct { + GetTasksIDRunsIDParams + + TaskID string + + RunID string +} + // GetTasksIDRunsIDLogsParams defines parameters for GetTasksIDRunsIDLogs. type GetTasksIDRunsIDLogsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTasksIDRunsIDLogsAllParams defines type for all parameters for GetTasksIDRunsIDLogs. +type GetTasksIDRunsIDLogsAllParams struct { + GetTasksIDRunsIDLogsParams + + TaskID string + + RunID string +} + +// PostTasksIDRunsIDRetryJSONBody defines parameters for PostTasksIDRunsIDRetry. +type PostTasksIDRunsIDRetryJSONBody map[string]interface{} + // PostTasksIDRunsIDRetryParams defines parameters for PostTasksIDRunsIDRetry. type PostTasksIDRunsIDRetryParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTasksIDRunsIDRetryAllParams defines type for all parameters for PostTasksIDRunsIDRetry. +type PostTasksIDRunsIDRetryAllParams struct { + PostTasksIDRunsIDRetryParams + + TaskID string + + RunID string + + Body PostTasksIDRunsIDRetryJSONRequestBody +} + // GetTelegrafPluginsParams defines parameters for GetTelegrafPlugins. type GetTelegrafPluginsParams struct { // The type of plugin desired. @@ -6113,12 +7562,26 @@ type PostTelegrafsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTelegrafsAllParams defines type for all parameters for PostTelegrafs. +type PostTelegrafsAllParams struct { + PostTelegrafsParams + + Body PostTelegrafsJSONRequestBody +} + // DeleteTelegrafsIDParams defines parameters for DeleteTelegrafsID. type DeleteTelegrafsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTelegrafsIDAllParams defines type for all parameters for DeleteTelegrafsID. +type DeleteTelegrafsIDAllParams struct { + DeleteTelegrafsIDParams + + TelegrafID string +} + // GetTelegrafsIDParams defines parameters for GetTelegrafsID. type GetTelegrafsIDParams struct { // OpenTracing span context @@ -6129,6 +7592,13 @@ type GetTelegrafsIDParams struct { // GetTelegrafsIDParamsAccept defines parameters for GetTelegrafsID. type GetTelegrafsIDParamsAccept string +// GetTelegrafsIDAllParams defines type for all parameters for GetTelegrafsID. +type GetTelegrafsIDAllParams struct { + GetTelegrafsIDParams + + TelegrafID string +} + // PutTelegrafsIDJSONBody defines parameters for PutTelegrafsID. type PutTelegrafsIDJSONBody TelegrafPluginRequest @@ -6138,12 +7608,28 @@ type PutTelegrafsIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutTelegrafsIDAllParams defines type for all parameters for PutTelegrafsID. +type PutTelegrafsIDAllParams struct { + PutTelegrafsIDParams + + TelegrafID string + + Body PutTelegrafsIDJSONRequestBody +} + // GetTelegrafsIDLabelsParams defines parameters for GetTelegrafsIDLabels. type GetTelegrafsIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTelegrafsIDLabelsAllParams defines type for all parameters for GetTelegrafsIDLabels. +type GetTelegrafsIDLabelsAllParams struct { + GetTelegrafsIDLabelsParams + + TelegrafID string +} + // PostTelegrafsIDLabelsJSONBody defines parameters for PostTelegrafsIDLabels. type PostTelegrafsIDLabelsJSONBody LabelMapping @@ -6153,18 +7639,43 @@ type PostTelegrafsIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTelegrafsIDLabelsAllParams defines type for all parameters for PostTelegrafsIDLabels. +type PostTelegrafsIDLabelsAllParams struct { + PostTelegrafsIDLabelsParams + + TelegrafID string + + Body PostTelegrafsIDLabelsJSONRequestBody +} + // DeleteTelegrafsIDLabelsIDParams defines parameters for DeleteTelegrafsIDLabelsID. type DeleteTelegrafsIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTelegrafsIDLabelsIDAllParams defines type for all parameters for DeleteTelegrafsIDLabelsID. +type DeleteTelegrafsIDLabelsIDAllParams struct { + DeleteTelegrafsIDLabelsIDParams + + TelegrafID string + + LabelID string +} + // GetTelegrafsIDMembersParams defines parameters for GetTelegrafsIDMembers. type GetTelegrafsIDMembersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTelegrafsIDMembersAllParams defines type for all parameters for GetTelegrafsIDMembers. +type GetTelegrafsIDMembersAllParams struct { + GetTelegrafsIDMembersParams + + TelegrafID string +} + // PostTelegrafsIDMembersJSONBody defines parameters for PostTelegrafsIDMembers. type PostTelegrafsIDMembersJSONBody AddResourceMemberRequestBody @@ -6174,18 +7685,43 @@ type PostTelegrafsIDMembersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTelegrafsIDMembersAllParams defines type for all parameters for PostTelegrafsIDMembers. +type PostTelegrafsIDMembersAllParams struct { + PostTelegrafsIDMembersParams + + TelegrafID string + + Body PostTelegrafsIDMembersJSONRequestBody +} + // DeleteTelegrafsIDMembersIDParams defines parameters for DeleteTelegrafsIDMembersID. type DeleteTelegrafsIDMembersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteTelegrafsIDMembersIDAllParams defines type for all parameters for DeleteTelegrafsIDMembersID. +type DeleteTelegrafsIDMembersIDAllParams struct { + DeleteTelegrafsIDMembersIDParams + + TelegrafID string + + UserID string +} + // GetTelegrafsIDOwnersParams defines parameters for GetTelegrafsIDOwners. type GetTelegrafsIDOwnersParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetTelegrafsIDOwnersAllParams defines type for all parameters for GetTelegrafsIDOwners. +type GetTelegrafsIDOwnersAllParams struct { + GetTelegrafsIDOwnersParams + + TelegrafID string +} + // PostTelegrafsIDOwnersJSONBody defines parameters for PostTelegrafsIDOwners. type PostTelegrafsIDOwnersJSONBody AddResourceMemberRequestBody @@ -6195,22 +7731,46 @@ type PostTelegrafsIDOwnersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostTelegrafsIDOwnersAllParams defines type for all parameters for PostTelegrafsIDOwners. +type PostTelegrafsIDOwnersAllParams struct { + PostTelegrafsIDOwnersParams + + TelegrafID string + + Body PostTelegrafsIDOwnersJSONRequestBody +} + // DeleteTelegrafsIDOwnersIDParams defines parameters for DeleteTelegrafsIDOwnersID. type DeleteTelegrafsIDOwnersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// ApplyTemplateJSONBody defines parameters for ApplyTemplate. -type ApplyTemplateJSONBody TemplateApply +// DeleteTelegrafsIDOwnersIDAllParams defines type for all parameters for DeleteTelegrafsIDOwnersID. +type DeleteTelegrafsIDOwnersIDAllParams struct { + DeleteTelegrafsIDOwnersIDParams + + TelegrafID string + + UserID string +} // ExportTemplateJSONBody defines parameters for ExportTemplate. type ExportTemplateJSONBody interface{} +// ExportTemplateAllParams defines type for all parameters for ExportTemplate. +type ExportTemplateAllParams struct { + Body ExportTemplateJSONRequestBody +} + // GetUsersParams defines parameters for GetUsers. type GetUsersParams struct { + // The offset for pagination. + // The number of records to skip. Offset *Offset `json:"offset,omitempty"` - Limit *Limit `json:"limit,omitempty"` + + // Limits the number of records returned. Default is `20`. + Limit *Limit `json:"limit,omitempty"` // Resource ID to seek from. Results are not inclusive of this ID. Use `after` instead of `offset`. After *After `json:"after,omitempty"` @@ -6230,18 +7790,39 @@ type PostUsersParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostUsersAllParams defines type for all parameters for PostUsers. +type PostUsersAllParams struct { + PostUsersParams + + Body PostUsersJSONRequestBody +} + // DeleteUsersIDParams defines parameters for DeleteUsersID. type DeleteUsersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteUsersIDAllParams defines type for all parameters for DeleteUsersID. +type DeleteUsersIDAllParams struct { + DeleteUsersIDParams + + UserID string +} + // GetUsersIDParams defines parameters for GetUsersID. type GetUsersIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetUsersIDAllParams defines type for all parameters for GetUsersID. +type GetUsersIDAllParams struct { + GetUsersIDParams + + UserID string +} + // PatchUsersIDJSONBody defines parameters for PatchUsersID. type PatchUsersIDJSONBody User @@ -6251,6 +7832,15 @@ type PatchUsersIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchUsersIDAllParams defines type for all parameters for PatchUsersID. +type PatchUsersIDAllParams struct { + PatchUsersIDParams + + UserID string + + Body PatchUsersIDJSONRequestBody +} + // PostUsersIDPasswordJSONBody defines parameters for PostUsersIDPassword. type PostUsersIDPasswordJSONBody PasswordResetBody @@ -6260,6 +7850,15 @@ type PostUsersIDPasswordParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostUsersIDPasswordAllParams defines type for all parameters for PostUsersIDPassword. +type PostUsersIDPasswordAllParams struct { + PostUsersIDPasswordParams + + UserID string + + Body PostUsersIDPasswordJSONRequestBody +} + // GetVariablesParams defines parameters for GetVariables. type GetVariablesParams struct { // The name of the organization. @@ -6281,18 +7880,39 @@ type PostVariablesParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PostVariablesAllParams defines type for all parameters for PostVariables. +type PostVariablesAllParams struct { + PostVariablesParams + + Body PostVariablesJSONRequestBody +} + // DeleteVariablesIDParams defines parameters for DeleteVariablesID. type DeleteVariablesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// DeleteVariablesIDAllParams defines type for all parameters for DeleteVariablesID. +type DeleteVariablesIDAllParams struct { + DeleteVariablesIDParams + + VariableID string +} + // GetVariablesIDParams defines parameters for GetVariablesID. type GetVariablesIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetVariablesIDAllParams defines type for all parameters for GetVariablesID. +type GetVariablesIDAllParams struct { + GetVariablesIDParams + + VariableID string +} + // PatchVariablesIDJSONBody defines parameters for PatchVariablesID. type PatchVariablesIDJSONBody Variable @@ -6302,6 +7922,15 @@ type PatchVariablesIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PatchVariablesIDAllParams defines type for all parameters for PatchVariablesID. +type PatchVariablesIDAllParams struct { + PatchVariablesIDParams + + VariableID string + + Body PatchVariablesIDJSONRequestBody +} + // PutVariablesIDJSONBody defines parameters for PutVariablesID. type PutVariablesIDJSONBody Variable @@ -6311,12 +7940,28 @@ type PutVariablesIDParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// PutVariablesIDAllParams defines type for all parameters for PutVariablesID. +type PutVariablesIDAllParams struct { + PutVariablesIDParams + + VariableID string + + Body PutVariablesIDJSONRequestBody +} + // GetVariablesIDLabelsParams defines parameters for GetVariablesIDLabels. type GetVariablesIDLabelsParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } +// GetVariablesIDLabelsAllParams defines type for all parameters for GetVariablesIDLabels. +type GetVariablesIDLabelsAllParams struct { + GetVariablesIDLabelsParams + + VariableID string +} + // PostVariablesIDLabelsJSONBody defines parameters for PostVariablesIDLabels. type PostVariablesIDLabelsJSONBody LabelMapping @@ -6326,51 +7971,29 @@ type PostVariablesIDLabelsParams struct { ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` } -// DeleteVariablesIDLabelsIDParams defines parameters for DeleteVariablesIDLabelsID. -type DeleteVariablesIDLabelsIDParams struct { - // OpenTracing span context - ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` -} - -// PostWriteParams defines parameters for PostWrite. -type PostWriteParams struct { - // The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both `orgID` and `org` parameters, `org` takes precedence. - Org string `json:"org"` - - // The parameter value specifies the ID of the destination organization for writes. If both `orgID` and `org` are specified, `org` takes precedence. - OrgID *string `json:"orgID,omitempty"` +// PostVariablesIDLabelsAllParams defines type for all parameters for PostVariablesIDLabels. +type PostVariablesIDLabelsAllParams struct { + PostVariablesIDLabelsParams - // The destination bucket for writes. - Bucket string `json:"bucket"` + VariableID string - // The precision for the unix timestamps within the body line-protocol. - Precision *WritePrecision `json:"precision,omitempty"` + Body PostVariablesIDLabelsJSONRequestBody +} +// DeleteVariablesIDLabelsIDParams defines parameters for DeleteVariablesIDLabelsID. +type DeleteVariablesIDLabelsIDParams struct { // OpenTracing span context ZapTraceSpan *TraceSpan `json:"Zap-Trace-Span,omitempty"` - - // The value tells InfluxDB what compression is applied to the line protocol in the request payload. - // To make an API request with a GZIP payload, send `Content-Encoding: gzip` as a request header. - ContentEncoding *PostWriteParamsContentEncoding `json:"Content-Encoding,omitempty"` - - // The header value indicates the format of the data in the request body. - ContentType *PostWriteParamsContentType `json:"Content-Type,omitempty"` - - // The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's `max body` configuration option, the server responds with status code `413`. - ContentLength *int `json:"Content-Length,omitempty"` - - // The header value specifies the response format. - Accept *PostWriteParamsAccept `json:"Accept,omitempty"` } -// PostWriteParamsContentEncoding defines parameters for PostWrite. -type PostWriteParamsContentEncoding string +// DeleteVariablesIDLabelsIDAllParams defines type for all parameters for DeleteVariablesIDLabelsID. +type DeleteVariablesIDLabelsIDAllParams struct { + DeleteVariablesIDLabelsIDParams -// PostWriteParamsContentType defines parameters for PostWrite. -type PostWriteParamsContentType string + VariableID string -// PostWriteParamsAccept defines parameters for PostWrite. -type PostWriteParamsAccept string + LabelID string +} // PostAuthorizationsJSONRequestBody defines body for PostAuthorizations for application/json ContentType. type PostAuthorizationsJSONRequestBody PostAuthorizationsJSONBody @@ -6405,9 +8028,6 @@ type PutChecksIDJSONRequestBody PutChecksIDJSONBody // PostChecksIDLabelsJSONRequestBody defines body for PostChecksIDLabels for application/json ContentType. type PostChecksIDLabelsJSONRequestBody PostChecksIDLabelsJSONBody -// PostDashboardsJSONRequestBody defines body for PostDashboards for application/json ContentType. -type PostDashboardsJSONRequestBody PostDashboardsJSONBody - // PatchDashboardsIDJSONRequestBody defines body for PatchDashboardsID for application/json ContentType. type PatchDashboardsIDJSONRequestBody PatchDashboardsIDJSONBody @@ -6447,15 +8067,6 @@ type PostLabelsJSONRequestBody PostLabelsJSONBody // PatchLabelsIDJSONRequestBody defines body for PatchLabelsID for application/json ContentType. type PatchLabelsIDJSONRequestBody PatchLabelsIDJSONBody -// PostLegacyAuthorizationsJSONRequestBody defines body for PostLegacyAuthorizations for application/json ContentType. -type PostLegacyAuthorizationsJSONRequestBody PostLegacyAuthorizationsJSONBody - -// PatchLegacyAuthorizationsIDJSONRequestBody defines body for PatchLegacyAuthorizationsID for application/json ContentType. -type PatchLegacyAuthorizationsIDJSONRequestBody PatchLegacyAuthorizationsIDJSONBody - -// PostLegacyAuthorizationsIDPasswordJSONRequestBody defines body for PostLegacyAuthorizationsIDPassword for application/json ContentType. -type PostLegacyAuthorizationsIDPasswordJSONRequestBody PostLegacyAuthorizationsIDPasswordJSONBody - // PutMePasswordJSONRequestBody defines body for PutMePassword for application/json ContentType. type PutMePasswordJSONRequestBody PutMePasswordJSONBody @@ -6501,9 +8112,6 @@ type PatchOrgsIDSecretsJSONRequestBody PatchOrgsIDSecretsJSONBody // PostOrgsIDSecretsJSONRequestBody defines body for PostOrgsIDSecrets for application/json ContentType. type PostOrgsIDSecretsJSONRequestBody PostOrgsIDSecretsJSONBody -// PostQueryJSONRequestBody defines body for PostQuery for application/json ContentType. -type PostQueryJSONRequestBody PostQueryJSONBody - // PostQueryAnalyzeJSONRequestBody defines body for PostQueryAnalyze for application/json ContentType. type PostQueryAnalyzeJSONRequestBody PostQueryAnalyzeJSONBody @@ -6573,6 +8181,9 @@ type PostTasksIDOwnersJSONRequestBody PostTasksIDOwnersJSONBody // PostTasksIDRunsJSONRequestBody defines body for PostTasksIDRuns for application/json ContentType. type PostTasksIDRunsJSONRequestBody PostTasksIDRunsJSONBody +// PostTasksIDRunsIDRetryJSONRequestBody defines body for PostTasksIDRunsIDRetry for application/json ContentType. +type PostTasksIDRunsIDRetryJSONRequestBody PostTasksIDRunsIDRetryJSONBody + // PostTelegrafsJSONRequestBody defines body for PostTelegrafs for application/json ContentType. type PostTelegrafsJSONRequestBody PostTelegrafsJSONBody @@ -6588,9 +8199,6 @@ type PostTelegrafsIDMembersJSONRequestBody PostTelegrafsIDMembersJSONBody // PostTelegrafsIDOwnersJSONRequestBody defines body for PostTelegrafsIDOwners for application/json ContentType. type PostTelegrafsIDOwnersJSONRequestBody PostTelegrafsIDOwnersJSONBody -// ApplyTemplateJSONRequestBody defines body for ApplyTemplate for application/json ContentType. -type ApplyTemplateJSONRequestBody ApplyTemplateJSONBody - // ExportTemplateJSONRequestBody defines body for ExportTemplate for application/json ContentType. type ExportTemplateJSONRequestBody ExportTemplateJSONBody @@ -6646,7 +8254,7 @@ func (a *ColorMapping) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6662,7 +8270,7 @@ func (a ColorMapping) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6699,7 +8307,7 @@ func (a *Flags) UnmarshalJSON(b []byte) error { var fieldVal interface{} err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6715,7 +8323,7 @@ func (a Flags) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6752,7 +8360,7 @@ func (a *FluxSuggestion_Params) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6768,7 +8376,7 @@ func (a FluxSuggestion_Params) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6805,7 +8413,7 @@ func (a *HTTPNotificationEndpoint_Headers) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6821,7 +8429,7 @@ func (a HTTPNotificationEndpoint_Headers) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6858,7 +8466,7 @@ func (a *Label_Properties) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6874,7 +8482,7 @@ func (a Label_Properties) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6911,7 +8519,7 @@ func (a *LabelCreateRequest_Properties) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6927,7 +8535,7 @@ func (a LabelCreateRequest_Properties) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -6964,7 +8572,7 @@ func (a *LabelUpdate_Properties) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -6980,7 +8588,7 @@ func (a LabelUpdate_Properties) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -7017,7 +8625,7 @@ func (a *MapVariableProperties_Values) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -7033,7 +8641,7 @@ func (a MapVariableProperties_Values) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -7070,7 +8678,7 @@ func (a *Query_Params) UnmarshalJSON(b []byte) error { var fieldVal interface{} err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -7086,7 +8694,7 @@ func (a Query_Params) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -7123,7 +8731,7 @@ func (a *Secrets) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -7139,7 +8747,7 @@ func (a Secrets) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -7176,7 +8784,7 @@ func (a *TemplateApply_EnvRefs) UnmarshalJSON(b []byte) error { var fieldVal interface{} err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -7192,7 +8800,7 @@ func (a TemplateApply_EnvRefs) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) @@ -7229,7 +8837,7 @@ func (a *TemplateApply_Secrets) UnmarshalJSON(b []byte) error { var fieldVal string err := json.Unmarshal(fieldBuf, &fieldVal) if err != nil { - return errors.Wrap(err, fmt.Sprintf("error unmarshaling field %s", fieldName)) + return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err) } a.AdditionalProperties[fieldName] = fieldVal } @@ -7245,7 +8853,7 @@ func (a TemplateApply_Secrets) MarshalJSON() ([]byte, error) { for fieldName, field := range a.AdditionalProperties { object[fieldName], err = json.Marshal(field) if err != nil { - return nil, errors.Wrap(err, fmt.Sprintf("error marshaling '%s'", fieldName)) + return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err) } } return json.Marshal(object) diff --git a/examples_test.go b/examples_test.go index a885d04f..5b67fe25 100644 --- a/examples_test.go +++ b/examples_test.go @@ -41,7 +41,7 @@ func ExampleClient_customServerAPICall() { defer client.Close() // Get generated client for server API calls - apiClient := domain.NewClientWithResponses(client.HTTPService()) + apiClient := client.APIClient() ctx := context.Background() // Get a bucket we would like to query using InfluxQL @@ -65,22 +65,15 @@ func ExampleClient_customServerAPICall() { RetentionPolicy: "autogen", } - params := &domain.PostDBRPParams{} + params := &domain.PostDBRPAllParams{ + Body: domain.PostDBRPJSONRequestBody(dbrp), + } // Call server API - resp, err := apiClient.PostDBRPWithResponse(ctx, params, domain.PostDBRPJSONRequestBody(dbrp)) + newDbrp, err := apiClient.PostDBRP(ctx, params) if err != nil { panic(err) } // Check generated response errors - if resp.JSONDefault != nil { - panic(resp.JSONDefault.Message) - } - // Check generated response errors - if resp.JSON400 != nil { - panic(resp.JSON400.Message) - } - // Use API call result - newDbrp := resp.JSON201 fmt.Printf("Created DBRP: %#v\n", newDbrp) } diff --git a/go.mod b/go.mod index 75e34b37..bffa169b 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.8.0 // test dependency golang.org/x/net v0.0.0-20210119194325-5f4716e94777 - gopkg.in/yaml.v3 v3.0.1 + gopkg.in/yaml.v3 v3.0.1 // indirect ) require (