feat: allow setting membership type in influx org members add (#402)

* add owners endpoints to cli.yml

* run make openapi and mock

* add owner listing, adding and removing

* fix: update tests to remove getUser indirection
This commit is contained in:
Andrew Lee
2022-06-28 16:06:58 -06:00
committed by GitHub
parent 56a8276a4a
commit e5707cd63c
9 changed files with 1396 additions and 106 deletions

View File

@ -67,6 +67,27 @@ type OrganizationsApi interface {
*/
DeleteOrgsIDMembersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDMembersIDRequest) (*_nethttp.Response, error)
/*
* DeleteOrgsIDOwnersID Remove an owner from an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param userID The ID of the owner to remove.
* @param orgID The organization ID.
* @return ApiDeleteOrgsIDOwnersIDRequest
*/
DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest
/*
* DeleteOrgsIDOwnersIDExecute executes the request
*/
DeleteOrgsIDOwnersIDExecute(r ApiDeleteOrgsIDOwnersIDRequest) error
/*
* DeleteOrgsIDOwnersIDExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not
* available on the returned HTTP response as it will have already been read and closed; access to the response body
* content should be achieved through the returned response model if applicable.
*/
DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDOwnersIDRequest) (*_nethttp.Response, error)
/*
* GetOrgs List all organizations
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@ -132,6 +153,28 @@ type OrganizationsApi interface {
*/
GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOrgsIDMembersRequest) (ResourceMembers, *_nethttp.Response, error)
/*
* GetOrgsIDOwners List all owners of an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orgID The organization ID.
* @return ApiGetOrgsIDOwnersRequest
*/
GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest
/*
* GetOrgsIDOwnersExecute executes the request
* @return ResourceOwners
*/
GetOrgsIDOwnersExecute(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, error)
/*
* GetOrgsIDOwnersExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not
* available on the returned HTTP response as it will have already been read and closed; access to the response body
* content should be achieved through the returned response model if applicable.
* @return ResourceOwners
*/
GetOrgsIDOwnersExecuteWithHttpInfo(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, *_nethttp.Response, error)
/*
* PatchOrgsID Update an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
@ -196,6 +239,28 @@ type OrganizationsApi interface {
* @return ResourceMember
*/
PostOrgsIDMembersExecuteWithHttpInfo(r ApiPostOrgsIDMembersRequest) (ResourceMember, *_nethttp.Response, error)
/*
* PostOrgsIDOwners Add an owner to an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orgID The organization ID.
* @return ApiPostOrgsIDOwnersRequest
*/
PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest
/*
* PostOrgsIDOwnersExecute executes the request
* @return ResourceOwner
*/
PostOrgsIDOwnersExecute(r ApiPostOrgsIDOwnersRequest) (ResourceOwner, error)
/*
* PostOrgsIDOwnersExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not
* available on the returned HTTP response as it will have already been read and closed; access to the response body
* content should be achieved through the returned response model if applicable.
* @return ResourceOwner
*/
PostOrgsIDOwnersExecuteWithHttpInfo(r ApiPostOrgsIDOwnersRequest) (ResourceOwner, *_nethttp.Response, error)
}
// OrganizationsApiService OrganizationsApi service
@ -508,6 +573,160 @@ func (a *OrganizationsApiService) DeleteOrgsIDMembersIDExecuteWithHttpInfo(r Api
return localVarHTTPResponse, nil
}
type ApiDeleteOrgsIDOwnersIDRequest struct {
ctx _context.Context
ApiService OrganizationsApi
userID string
orgID string
zapTraceSpan *string
}
func (r ApiDeleteOrgsIDOwnersIDRequest) UserID(userID string) ApiDeleteOrgsIDOwnersIDRequest {
r.userID = userID
return r
}
func (r ApiDeleteOrgsIDOwnersIDRequest) GetUserID() string {
return r.userID
}
func (r ApiDeleteOrgsIDOwnersIDRequest) OrgID(orgID string) ApiDeleteOrgsIDOwnersIDRequest {
r.orgID = orgID
return r
}
func (r ApiDeleteOrgsIDOwnersIDRequest) GetOrgID() string {
return r.orgID
}
func (r ApiDeleteOrgsIDOwnersIDRequest) ZapTraceSpan(zapTraceSpan string) ApiDeleteOrgsIDOwnersIDRequest {
r.zapTraceSpan = &zapTraceSpan
return r
}
func (r ApiDeleteOrgsIDOwnersIDRequest) GetZapTraceSpan() *string {
return r.zapTraceSpan
}
func (r ApiDeleteOrgsIDOwnersIDRequest) Execute() error {
return r.ApiService.DeleteOrgsIDOwnersIDExecute(r)
}
func (r ApiDeleteOrgsIDOwnersIDRequest) ExecuteWithHttpInfo() (*_nethttp.Response, error) {
return r.ApiService.DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r)
}
/*
* DeleteOrgsIDOwnersID Remove an owner from an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param userID The ID of the owner to remove.
* @param orgID The organization ID.
* @return ApiDeleteOrgsIDOwnersIDRequest
*/
func (a *OrganizationsApiService) DeleteOrgsIDOwnersID(ctx _context.Context, userID string, orgID string) ApiDeleteOrgsIDOwnersIDRequest {
return ApiDeleteOrgsIDOwnersIDRequest{
ApiService: a,
ctx: ctx,
userID: userID,
orgID: orgID,
}
}
/*
* Execute executes the request
*/
func (a *OrganizationsApiService) DeleteOrgsIDOwnersIDExecute(r ApiDeleteOrgsIDOwnersIDRequest) error {
_, err := a.DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r)
return err
}
/*
* ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the
* returned HTTP response as it will have already been read and closed; access to the response body content should be
* achieved through the returned response model if applicable.
*/
func (a *OrganizationsApiService) DeleteOrgsIDOwnersIDExecuteWithHttpInfo(r ApiDeleteOrgsIDOwnersIDRequest) (*_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodDelete
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.DeleteOrgsIDOwnersID")
if err != nil {
return nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v2/orgs/{orgID}/owners/{userID}"
localVarPath = strings.Replace(localVarPath, "{"+"userID"+"}", _neturl.PathEscape(parameterToString(r.userID, "")), -1)
localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.zapTraceSpan != nil {
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarHTTPResponse, err
}
newErr := GenericOpenAPIError{
buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"),
}
if localVarHTTPResponse.StatusCode >= 300 {
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
newErr.error = err.Error()
return localVarHTTPResponse, newErr
}
newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
return localVarHTTPResponse, newErr
}
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v
return localVarHTTPResponse, newErr
}
return localVarHTTPResponse, nil
}
type ApiGetOrgsRequest struct {
ctx _context.Context
ApiService OrganizationsApi
@ -1071,6 +1290,181 @@ func (a *OrganizationsApiService) GetOrgsIDMembersExecuteWithHttpInfo(r ApiGetOr
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiGetOrgsIDOwnersRequest struct {
ctx _context.Context
ApiService OrganizationsApi
orgID string
zapTraceSpan *string
}
func (r ApiGetOrgsIDOwnersRequest) OrgID(orgID string) ApiGetOrgsIDOwnersRequest {
r.orgID = orgID
return r
}
func (r ApiGetOrgsIDOwnersRequest) GetOrgID() string {
return r.orgID
}
func (r ApiGetOrgsIDOwnersRequest) ZapTraceSpan(zapTraceSpan string) ApiGetOrgsIDOwnersRequest {
r.zapTraceSpan = &zapTraceSpan
return r
}
func (r ApiGetOrgsIDOwnersRequest) GetZapTraceSpan() *string {
return r.zapTraceSpan
}
func (r ApiGetOrgsIDOwnersRequest) Execute() (ResourceOwners, error) {
return r.ApiService.GetOrgsIDOwnersExecute(r)
}
func (r ApiGetOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwners, *_nethttp.Response, error) {
return r.ApiService.GetOrgsIDOwnersExecuteWithHttpInfo(r)
}
/*
* GetOrgsIDOwners List all owners of an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orgID The organization ID.
* @return ApiGetOrgsIDOwnersRequest
*/
func (a *OrganizationsApiService) GetOrgsIDOwners(ctx _context.Context, orgID string) ApiGetOrgsIDOwnersRequest {
return ApiGetOrgsIDOwnersRequest{
ApiService: a,
ctx: ctx,
orgID: orgID,
}
}
/*
* Execute executes the request
* @return ResourceOwners
*/
func (a *OrganizationsApiService) GetOrgsIDOwnersExecute(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, error) {
returnVal, _, err := a.GetOrgsIDOwnersExecuteWithHttpInfo(r)
return returnVal, err
}
/*
* ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the
* returned HTTP response as it will have already been read and closed; access to the response body content should be
* achieved through the returned response model if applicable.
* @return ResourceOwners
*/
func (a *OrganizationsApiService) GetOrgsIDOwnersExecuteWithHttpInfo(r ApiGetOrgsIDOwnersRequest) (ResourceOwners, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodGet
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ResourceOwners
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.GetOrgsIDOwners")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v2/orgs/{orgID}/owners"
localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.zapTraceSpan != nil {
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
}
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
newErr := GenericOpenAPIError{
buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"),
}
if localVarHTTPResponse.StatusCode >= 300 {
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status
if localVarHTTPResponse.StatusCode == 404 {
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
return localVarReturnValue, localVarHTTPResponse, newErr
}
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr
}
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
return localVarReturnValue, localVarHTTPResponse, newErr
}
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr
}
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.body = localVarBody
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiPatchOrgsIDRequest struct {
ctx _context.Context
ApiService OrganizationsApi
@ -1592,3 +1986,181 @@ func (a *OrganizationsApiService) PostOrgsIDMembersExecuteWithHttpInfo(r ApiPost
return localVarReturnValue, localVarHTTPResponse, nil
}
type ApiPostOrgsIDOwnersRequest struct {
ctx _context.Context
ApiService OrganizationsApi
orgID string
addResourceMemberRequestBody *AddResourceMemberRequestBody
zapTraceSpan *string
}
func (r ApiPostOrgsIDOwnersRequest) OrgID(orgID string) ApiPostOrgsIDOwnersRequest {
r.orgID = orgID
return r
}
func (r ApiPostOrgsIDOwnersRequest) GetOrgID() string {
return r.orgID
}
func (r ApiPostOrgsIDOwnersRequest) AddResourceMemberRequestBody(addResourceMemberRequestBody AddResourceMemberRequestBody) ApiPostOrgsIDOwnersRequest {
r.addResourceMemberRequestBody = &addResourceMemberRequestBody
return r
}
func (r ApiPostOrgsIDOwnersRequest) GetAddResourceMemberRequestBody() *AddResourceMemberRequestBody {
return r.addResourceMemberRequestBody
}
func (r ApiPostOrgsIDOwnersRequest) ZapTraceSpan(zapTraceSpan string) ApiPostOrgsIDOwnersRequest {
r.zapTraceSpan = &zapTraceSpan
return r
}
func (r ApiPostOrgsIDOwnersRequest) GetZapTraceSpan() *string {
return r.zapTraceSpan
}
func (r ApiPostOrgsIDOwnersRequest) Execute() (ResourceOwner, error) {
return r.ApiService.PostOrgsIDOwnersExecute(r)
}
func (r ApiPostOrgsIDOwnersRequest) ExecuteWithHttpInfo() (ResourceOwner, *_nethttp.Response, error) {
return r.ApiService.PostOrgsIDOwnersExecuteWithHttpInfo(r)
}
/*
* PostOrgsIDOwners Add an owner to an organization
* @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
* @param orgID The organization ID.
* @return ApiPostOrgsIDOwnersRequest
*/
func (a *OrganizationsApiService) PostOrgsIDOwners(ctx _context.Context, orgID string) ApiPostOrgsIDOwnersRequest {
return ApiPostOrgsIDOwnersRequest{
ApiService: a,
ctx: ctx,
orgID: orgID,
}
}
/*
* Execute executes the request
* @return ResourceOwner
*/
func (a *OrganizationsApiService) PostOrgsIDOwnersExecute(r ApiPostOrgsIDOwnersRequest) (ResourceOwner, error) {
returnVal, _, err := a.PostOrgsIDOwnersExecuteWithHttpInfo(r)
return returnVal, err
}
/*
* ExecuteWithHttpInfo executes the request with HTTP response info returned. The response body is not available on the
* returned HTTP response as it will have already been read and closed; access to the response body content should be
* achieved through the returned response model if applicable.
* @return ResourceOwner
*/
func (a *OrganizationsApiService) PostOrgsIDOwnersExecuteWithHttpInfo(r ApiPostOrgsIDOwnersRequest) (ResourceOwner, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarFormFileName string
localVarFileName string
localVarFileBytes []byte
localVarReturnValue ResourceOwner
)
localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.PostOrgsIDOwners")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}
localVarPath := localBasePath + "/api/v2/orgs/{orgID}/owners"
localVarPath = strings.Replace(localVarPath, "{"+"orgID"+"}", _neturl.PathEscape(parameterToString(r.orgID, "")), -1)
localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}
if r.addResourceMemberRequestBody == nil {
return localVarReturnValue, nil, reportError("addResourceMemberRequestBody is required and must be specified")
}
// to determine the Content-Type header
localVarHTTPContentTypes := []string{"application/json"}
// set Content-Type header
localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes)
if localVarHTTPContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHTTPContentType
}
// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}
// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.zapTraceSpan != nil {
localVarHeaderParams["Zap-Trace-Span"] = parameterToString(*r.zapTraceSpan, "")
}
// body params
localVarPostBody = r.addResourceMemberRequestBody
req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)
if err != nil {
return localVarReturnValue, nil, err
}
localVarHTTPResponse, err := a.client.callAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}
newErr := GenericOpenAPIError{
buildHeader: localVarHTTPResponse.Header.Get("X-Influxdb-Build"),
}
if localVarHTTPResponse.StatusCode >= 300 {
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.body = localVarBody
newErr.error = localVarHTTPResponse.Status
var v Error
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = _fmt.Sprintf("%s: %s", newErr.Error(), err.Error())
return localVarReturnValue, localVarHTTPResponse, newErr
}
v.SetMessage(_fmt.Sprintf("%s: %s", newErr.Error(), v.GetMessage()))
newErr.model = &v
return localVarReturnValue, localVarHTTPResponse, newErr
}
body, err := GunzipIfNeeded(localVarHTTPResponse)
if err != nil {
body.Close()
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
localVarBody, err := _io.ReadAll(body)
body.Close()
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.body = localVarBody
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
return localVarReturnValue, localVarHTTPResponse, nil
}

View File

@ -35,6 +35,10 @@ paths:
$ref: "./openapi/src/common/paths/orgs_orgID_members.yml"
/api/v2/orgs/{orgID}/members/{userID}:
$ref: "./openapi/src/common/paths/orgs_orgID_members_userID.yml"
/api/v2/orgs/{orgID}/owners:
$ref: "./openapi/src/common/paths/orgs_orgID_owners.yml"
/api/v2/orgs/{orgID}/owners/{userID}:
$ref: "./openapi/src/common/paths/orgs_orgID_owners_userID.yml"
/api/v2/orgs/{orgID}/secrets:
$ref: "./openapi/src/common/paths/orgs_orgID_secrets.yml"
/api/v2/orgs/{orgID}/secrets/{delete}:
@ -203,6 +207,10 @@ components:
$ref: "./openapi/src/common/schemas/ResourceMembers.yml"
ResourceMember:
$ref: "./openapi/src/common/schemas/ResourceMember.yml"
ResourceOwners:
$ref: "./openapi/src/common/schemas/ResourceOwners.yml"
ResourceOwner:
$ref: "./openapi/src/common/schemas/ResourceOwner.yml"
AddResourceMemberRequestBody:
$ref: "./openapi/src/common/schemas/AddResourceMemberRequestBody.yml"
WritePrecision:

View File

@ -0,0 +1,295 @@
/*
* Subset of Influx API covered by Influx CLI
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
)
// ResourceOwner struct for ResourceOwner
type ResourceOwner struct {
Id *string `json:"id,omitempty" yaml:"id,omitempty"`
OauthID *string `json:"oauthID,omitempty" yaml:"oauthID,omitempty"`
Name string `json:"name" yaml:"name"`
// If inactive the user is inactive.
Status *string `json:"status,omitempty" yaml:"status,omitempty"`
Links *UserResponseLinks `json:"links,omitempty" yaml:"links,omitempty"`
Role *string `json:"role,omitempty" yaml:"role,omitempty"`
}
// NewResourceOwner instantiates a new ResourceOwner object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewResourceOwner(name string) *ResourceOwner {
this := ResourceOwner{}
this.Name = name
var status string = "active"
this.Status = &status
var role string = "owner"
this.Role = &role
return &this
}
// NewResourceOwnerWithDefaults instantiates a new ResourceOwner object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewResourceOwnerWithDefaults() *ResourceOwner {
this := ResourceOwner{}
var status string = "active"
this.Status = &status
var role string = "owner"
this.Role = &role
return &this
}
// GetId returns the Id field value if set, zero value otherwise.
func (o *ResourceOwner) GetId() string {
if o == nil || o.Id == nil {
var ret string
return ret
}
return *o.Id
}
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetIdOk() (*string, bool) {
if o == nil || o.Id == nil {
return nil, false
}
return o.Id, true
}
// HasId returns a boolean if a field has been set.
func (o *ResourceOwner) HasId() bool {
if o != nil && o.Id != nil {
return true
}
return false
}
// SetId gets a reference to the given string and assigns it to the Id field.
func (o *ResourceOwner) SetId(v string) {
o.Id = &v
}
// GetOauthID returns the OauthID field value if set, zero value otherwise.
func (o *ResourceOwner) GetOauthID() string {
if o == nil || o.OauthID == nil {
var ret string
return ret
}
return *o.OauthID
}
// GetOauthIDOk returns a tuple with the OauthID field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetOauthIDOk() (*string, bool) {
if o == nil || o.OauthID == nil {
return nil, false
}
return o.OauthID, true
}
// HasOauthID returns a boolean if a field has been set.
func (o *ResourceOwner) HasOauthID() bool {
if o != nil && o.OauthID != nil {
return true
}
return false
}
// SetOauthID gets a reference to the given string and assigns it to the OauthID field.
func (o *ResourceOwner) SetOauthID(v string) {
o.OauthID = &v
}
// GetName returns the Name field value
func (o *ResourceOwner) GetName() string {
if o == nil {
var ret string
return ret
}
return o.Name
}
// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetNameOk() (*string, bool) {
if o == nil {
return nil, false
}
return &o.Name, true
}
// SetName sets field value
func (o *ResourceOwner) SetName(v string) {
o.Name = v
}
// GetStatus returns the Status field value if set, zero value otherwise.
func (o *ResourceOwner) GetStatus() string {
if o == nil || o.Status == nil {
var ret string
return ret
}
return *o.Status
}
// GetStatusOk returns a tuple with the Status field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetStatusOk() (*string, bool) {
if o == nil || o.Status == nil {
return nil, false
}
return o.Status, true
}
// HasStatus returns a boolean if a field has been set.
func (o *ResourceOwner) HasStatus() bool {
if o != nil && o.Status != nil {
return true
}
return false
}
// SetStatus gets a reference to the given string and assigns it to the Status field.
func (o *ResourceOwner) SetStatus(v string) {
o.Status = &v
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *ResourceOwner) GetLinks() UserResponseLinks {
if o == nil || o.Links == nil {
var ret UserResponseLinks
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetLinksOk() (*UserResponseLinks, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *ResourceOwner) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given UserResponseLinks and assigns it to the Links field.
func (o *ResourceOwner) SetLinks(v UserResponseLinks) {
o.Links = &v
}
// GetRole returns the Role field value if set, zero value otherwise.
func (o *ResourceOwner) GetRole() string {
if o == nil || o.Role == nil {
var ret string
return ret
}
return *o.Role
}
// GetRoleOk returns a tuple with the Role field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwner) GetRoleOk() (*string, bool) {
if o == nil || o.Role == nil {
return nil, false
}
return o.Role, true
}
// HasRole returns a boolean if a field has been set.
func (o *ResourceOwner) HasRole() bool {
if o != nil && o.Role != nil {
return true
}
return false
}
// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *ResourceOwner) SetRole(v string) {
o.Role = &v
}
func (o ResourceOwner) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Id != nil {
toSerialize["id"] = o.Id
}
if o.OauthID != nil {
toSerialize["oauthID"] = o.OauthID
}
if true {
toSerialize["name"] = o.Name
}
if o.Status != nil {
toSerialize["status"] = o.Status
}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.Role != nil {
toSerialize["role"] = o.Role
}
return json.Marshal(toSerialize)
}
type NullableResourceOwner struct {
value *ResourceOwner
isSet bool
}
func (v NullableResourceOwner) Get() *ResourceOwner {
return v.value
}
func (v *NullableResourceOwner) Set(val *ResourceOwner) {
v.value = val
v.isSet = true
}
func (v NullableResourceOwner) IsSet() bool {
return v.isSet
}
func (v *NullableResourceOwner) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableResourceOwner(val *ResourceOwner) *NullableResourceOwner {
return &NullableResourceOwner{value: val, isSet: true}
}
func (v NullableResourceOwner) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableResourceOwner) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,117 @@
/*
* Subset of Influx API covered by Influx CLI
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
)
// ResourceOwnerAllOf struct for ResourceOwnerAllOf
type ResourceOwnerAllOf struct {
Role *string `json:"role,omitempty" yaml:"role,omitempty"`
}
// NewResourceOwnerAllOf instantiates a new ResourceOwnerAllOf object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewResourceOwnerAllOf() *ResourceOwnerAllOf {
this := ResourceOwnerAllOf{}
var role string = "owner"
this.Role = &role
return &this
}
// NewResourceOwnerAllOfWithDefaults instantiates a new ResourceOwnerAllOf object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewResourceOwnerAllOfWithDefaults() *ResourceOwnerAllOf {
this := ResourceOwnerAllOf{}
var role string = "owner"
this.Role = &role
return &this
}
// GetRole returns the Role field value if set, zero value otherwise.
func (o *ResourceOwnerAllOf) GetRole() string {
if o == nil || o.Role == nil {
var ret string
return ret
}
return *o.Role
}
// GetRoleOk returns a tuple with the Role field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwnerAllOf) GetRoleOk() (*string, bool) {
if o == nil || o.Role == nil {
return nil, false
}
return o.Role, true
}
// HasRole returns a boolean if a field has been set.
func (o *ResourceOwnerAllOf) HasRole() bool {
if o != nil && o.Role != nil {
return true
}
return false
}
// SetRole gets a reference to the given string and assigns it to the Role field.
func (o *ResourceOwnerAllOf) SetRole(v string) {
o.Role = &v
}
func (o ResourceOwnerAllOf) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Role != nil {
toSerialize["role"] = o.Role
}
return json.Marshal(toSerialize)
}
type NullableResourceOwnerAllOf struct {
value *ResourceOwnerAllOf
isSet bool
}
func (v NullableResourceOwnerAllOf) Get() *ResourceOwnerAllOf {
return v.value
}
func (v *NullableResourceOwnerAllOf) Set(val *ResourceOwnerAllOf) {
v.value = val
v.isSet = true
}
func (v NullableResourceOwnerAllOf) IsSet() bool {
return v.isSet
}
func (v *NullableResourceOwnerAllOf) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableResourceOwnerAllOf(val *ResourceOwnerAllOf) *NullableResourceOwnerAllOf {
return &NullableResourceOwnerAllOf{value: val, isSet: true}
}
func (v NullableResourceOwnerAllOf) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableResourceOwnerAllOf) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View File

@ -0,0 +1,149 @@
/*
* Subset of Influx API covered by Influx CLI
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* API version: 2.0.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package api
import (
"encoding/json"
)
// ResourceOwners struct for ResourceOwners
type ResourceOwners struct {
Links *UsersLinks `json:"links,omitempty" yaml:"links,omitempty"`
Users *[]ResourceOwner `json:"users,omitempty" yaml:"users,omitempty"`
}
// NewResourceOwners instantiates a new ResourceOwners object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewResourceOwners() *ResourceOwners {
this := ResourceOwners{}
return &this
}
// NewResourceOwnersWithDefaults instantiates a new ResourceOwners object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewResourceOwnersWithDefaults() *ResourceOwners {
this := ResourceOwners{}
return &this
}
// GetLinks returns the Links field value if set, zero value otherwise.
func (o *ResourceOwners) GetLinks() UsersLinks {
if o == nil || o.Links == nil {
var ret UsersLinks
return ret
}
return *o.Links
}
// GetLinksOk returns a tuple with the Links field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwners) GetLinksOk() (*UsersLinks, bool) {
if o == nil || o.Links == nil {
return nil, false
}
return o.Links, true
}
// HasLinks returns a boolean if a field has been set.
func (o *ResourceOwners) HasLinks() bool {
if o != nil && o.Links != nil {
return true
}
return false
}
// SetLinks gets a reference to the given UsersLinks and assigns it to the Links field.
func (o *ResourceOwners) SetLinks(v UsersLinks) {
o.Links = &v
}
// GetUsers returns the Users field value if set, zero value otherwise.
func (o *ResourceOwners) GetUsers() []ResourceOwner {
if o == nil || o.Users == nil {
var ret []ResourceOwner
return ret
}
return *o.Users
}
// GetUsersOk returns a tuple with the Users field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ResourceOwners) GetUsersOk() (*[]ResourceOwner, bool) {
if o == nil || o.Users == nil {
return nil, false
}
return o.Users, true
}
// HasUsers returns a boolean if a field has been set.
func (o *ResourceOwners) HasUsers() bool {
if o != nil && o.Users != nil {
return true
}
return false
}
// SetUsers gets a reference to the given []ResourceOwner and assigns it to the Users field.
func (o *ResourceOwners) SetUsers(v []ResourceOwner) {
o.Users = &v
}
func (o ResourceOwners) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.Links != nil {
toSerialize["links"] = o.Links
}
if o.Users != nil {
toSerialize["users"] = o.Users
}
return json.Marshal(toSerialize)
}
type NullableResourceOwners struct {
value *ResourceOwners
isSet bool
}
func (v NullableResourceOwners) Get() *ResourceOwners {
return v.value
}
func (v *NullableResourceOwners) Set(val *ResourceOwners) {
v.value = val
v.isSet = true
}
func (v NullableResourceOwners) IsSet() bool {
return v.isSet
}
func (v *NullableResourceOwners) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableResourceOwners(val *ResourceOwners) *NullableResourceOwners {
return &NullableResourceOwners{value: val, isSet: true}
}
func (v NullableResourceOwners) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableResourceOwners) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}