Skip to content

Commit

Permalink
Regenerate client from commit 3eee7a12 of spec repo
Browse files Browse the repository at this point in the history
  • Loading branch information
ci.datadog-api-spec committed Jun 14, 2022
1 parent f495b6d commit 4291ce1
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 35 deletions.
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.2",
"regenerated": "2022-06-13 19:23:48.258264",
"spec_repo_commit": "04543c8c"
"regenerated": "2022-06-14 08:51:40.982555",
"spec_repo_commit": "3eee7a12"
},
"v2": {
"apigentools_version": "1.6.2",
"regenerated": "2022-06-13 19:23:48.270824",
"spec_repo_commit": "04543c8c"
"regenerated": "2022-06-14 08:51:40.997660",
"spec_repo_commit": "3eee7a12"
}
}
}
53 changes: 53 additions & 0 deletions .generator/schemas/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7795,6 +7795,13 @@ components:
format: int64
type: integer
type: object
OrgDowngradedResponse:
description: Status of downgrade
properties:
message:
description: Information pertaining to the downgraded child organization.
type: string
type: object
Organization:
description: Create, edit, and manage organizations.
properties:
Expand Down Expand Up @@ -7822,6 +7829,11 @@ components:
$ref: '#/components/schemas/OrganizationSettings'
subscription:
$ref: '#/components/schemas/OrganizationSubscription'
trial:
description: Only available for MSP customers. Allows child organizations
to be created on a trial plan.
example: false
type: boolean
type: object
OrganizationBilling:
deprecated: true
Expand Down Expand Up @@ -23307,6 +23319,47 @@ paths:
x-menu-order: 4
x-undo:
type: idempotent
/api/v1/org/{public_id}/downgrade:
post:
description: Only available for MSP customers. Removes a child organization
from the hierarchy of the master organization and places the child organization
on a 30-day trial.
operationId: DowngradeOrg
parameters:
- description: The `public_id` of the organization you are operating within.
in: path
name: public_id
required: true
schema:
example: abc123
type: string
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/OrgDowngradedResponse'
description: OK
'400':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Bad Request
'403':
content:
application/json:
schema:
$ref: '#/components/schemas/APIErrorResponse'
description: Forbidden
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
summary: Spin-off Child Organization
tags:
- Organizations
x-menu-order: 6
x-undo:
type: unsafe
/api/v1/org/{public_id}/idp_metadata:
post:
description: 'There are a couple of options for updating the Identity Provider
Expand Down
149 changes: 149 additions & 0 deletions api/v1/datadog/api_organizations.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,155 @@ func (a *OrganizationsApiService) createChildOrgExecute(r apiCreateChildOrgReque
return localVarReturnValue, localVarHTTPResponse, nil
}

type apiDowngradeOrgRequest struct {
ctx _context.Context
ApiService *OrganizationsApiService
publicId string
}

func (a *OrganizationsApiService) buildDowngradeOrgRequest(ctx _context.Context, publicId string) (apiDowngradeOrgRequest, error) {
req := apiDowngradeOrgRequest{
ApiService: a,
ctx: ctx,
publicId: publicId,
}
return req, nil
}

// DowngradeOrg Spin-off Child Organization.
// Only available for MSP customers. Removes a child organization from the hierarchy of the master organization and places the child organization on a 30-day trial.
func (a *OrganizationsApiService) DowngradeOrg(ctx _context.Context, publicId string) (OrgDowngradedResponse, *_nethttp.Response, error) {
req, err := a.buildDowngradeOrgRequest(ctx, publicId)
if err != nil {
var localVarReturnValue OrgDowngradedResponse
return localVarReturnValue, nil, err
}

return req.ApiService.downgradeOrgExecute(req)
}

// downgradeOrgExecute executes the request.
func (a *OrganizationsApiService) downgradeOrgExecute(r apiDowngradeOrgRequest) (OrgDowngradedResponse, *_nethttp.Response, error) {
var (
localVarHTTPMethod = _nethttp.MethodPost
localVarPostBody interface{}
localVarReturnValue OrgDowngradedResponse
)

localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "OrganizationsApiService.DowngradeOrg")
if err != nil {
return localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}
}

localVarPath := localBasePath + "/api/v1/org/{public_id}/downgrade"
localVarPath = strings.Replace(localVarPath, "{"+"public_id"+"}", _neturl.PathEscape(parameterToString(r.publicId, "")), -1)

localVarHeaderParams := make(map[string]string)
localVarQueryParams := _neturl.Values{}
localVarFormParams := _neturl.Values{}

// to determine the Accept header
localVarHTTPHeaderAccepts := []string{"application/json"}

// set Accept header
localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts)
if localVarHTTPHeaderAccept != "" {
localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["apiKeyAuth"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["DD-API-KEY"] = key
}
}
}
if r.ctx != nil {
// API Key Authentication
if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok {
if apiKey, ok := auth["appKeyAuth"]; ok {
var key string
if apiKey.Prefix != "" {
key = apiKey.Prefix + " " + apiKey.Key
} else {
key = apiKey.Key
}
localVarHeaderParams["DD-APPLICATION-KEY"] = key
}
}
}
req, err := a.client.PrepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil)
if err != nil {
return localVarReturnValue, nil, err
}

localVarHTTPResponse, err := a.client.CallAPI(req)
if err != nil || localVarHTTPResponse == nil {
return localVarReturnValue, localVarHTTPResponse, err
}

localVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)
localVarHTTPResponse.Body.Close()
localVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))
if err != nil {
return localVarReturnValue, localVarHTTPResponse, err
}

if localVarHTTPResponse.StatusCode >= 300 {
newErr := GenericOpenAPIError{
body: localVarBody,
error: localVarHTTPResponse.Status,
}
if localVarHTTPResponse.StatusCode == 400 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 403 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
return localVarReturnValue, localVarHTTPResponse, newErr
}
if localVarHTTPResponse.StatusCode == 429 {
var v APIErrorResponse
err = a.client.decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr.error = err.Error()
return localVarReturnValue, localVarHTTPResponse, newErr
}
newErr.model = v
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

err = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type"))
if err != nil {
newErr := GenericOpenAPIError{
body: localVarBody,
error: err.Error(),
}
return localVarReturnValue, localVarHTTPResponse, newErr
}

return localVarReturnValue, localVarHTTPResponse, nil
}

type apiGetOrgRequest struct {
ctx _context.Context
ApiService *OrganizationsApiService
Expand Down
102 changes: 102 additions & 0 deletions api/v1/datadog/model_org_downgraded_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

package datadog

import (
"encoding/json"
)

// OrgDowngradedResponse Status of downgrade
type OrgDowngradedResponse struct {
// Information pertaining to the downgraded child organization.
Message *string `json:"message,omitempty"`
// UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct
UnparsedObject map[string]interface{} `json:-`
AdditionalProperties map[string]interface{}
}

// NewOrgDowngradedResponse instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponse() *OrgDowngradedResponse {
this := OrgDowngradedResponse{}
return &this
}

// NewOrgDowngradedResponseWithDefaults instantiates a new OrgDowngradedResponse 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 NewOrgDowngradedResponseWithDefaults() *OrgDowngradedResponse {
this := OrgDowngradedResponse{}
return &this
}

// GetMessage returns the Message field value if set, zero value otherwise.
func (o *OrgDowngradedResponse) GetMessage() string {
if o == nil || o.Message == nil {
var ret string
return ret
}
return *o.Message
}

// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *OrgDowngradedResponse) GetMessageOk() (*string, bool) {
if o == nil || o.Message == nil {
return nil, false
}
return o.Message, true
}

// HasMessage returns a boolean if a field has been set.
func (o *OrgDowngradedResponse) HasMessage() bool {
if o != nil && o.Message != nil {
return true
}

return false
}

// SetMessage gets a reference to the given string and assigns it to the Message field.
func (o *OrgDowngradedResponse) SetMessage(v string) {
o.Message = &v
}

// MarshalJSON serializes the struct using spec logic.
func (o OrgDowngradedResponse) MarshalJSON() ([]byte, error) {
toSerialize := map[string]interface{}{}
if o.UnparsedObject != nil {
return json.Marshal(o.UnparsedObject)
}
if o.Message != nil {
toSerialize["message"] = o.Message
}

for key, value := range o.AdditionalProperties {
toSerialize[key] = value
}
return json.Marshal(toSerialize)
}

// UnmarshalJSON deserializes the given payload.
func (o *OrgDowngradedResponse) UnmarshalJSON(bytes []byte) (err error) {
raw := map[string]interface{}{}
all := struct {
Message *string `json:"message,omitempty"`
}{}
err = json.Unmarshal(bytes, &all)
if err != nil {
err = json.Unmarshal(bytes, &raw)
if err != nil {
return err
}
o.UnparsedObject = raw
return nil
}
o.Message = all.Message
return nil
}
Loading

0 comments on commit 4291ce1

Please sign in to comment.