Skip to content

Latest commit

 

History

History
376 lines (244 loc) · 10 KB

OrganizationsApi.md

File metadata and controls

376 lines (244 loc) · 10 KB

OrganizationsApi

All URIs are relative to https://api.datadoghq.com

Method HTTP request Description
CreateChildOrg Post /api/v1/org Create a child organization
GetOrg Get /api/v1/org/{public_id} Get organization information
ListOrgs Get /api/v1/org List your managed organizations
UpdateOrg Put /api/v1/org/{public_id} Update your organization
UploadIdPForOrg Post /api/v1/org/{public_id}/idp_metadata Upload IdP metadata

CreateChildOrg

OrganizationCreateResponse CreateChildOrg(ctx, body)

Create a child organization.

This endpoint requires the multi-organization account feature and must be enabled by contacting support.

Once a new child organization is created, you can interact with it by using the org.public_id, pi_key.key, and application_key.hash provided in the response.

Example

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog ""
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    body := *datadog.NewOrganizationCreateBody("New child org") // OrganizationCreateBody | Organization object that needs to be created

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.OrganizationsApi.CreateChildOrg(ctx, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.CreateChildOrg`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateChildOrg`: OrganizationCreateResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from OrganizationsApi.CreateChildOrg:\n%s\n", responseContent)
}

Required Parameters

Name Type Description Notes
ctx context.Context Context for authentication, logging, cancellation, deadlines, tracing, etc.
body OrganizationCreateBody Organization object that needs to be created

Optional Parameters

This endpoint does not have optional parameters.

Return type

OrganizationCreateResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetOrg

OrganizationResponse GetOrg(ctx, publicId)

Get organization information.

Example

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog ""
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    publicId := "abc123" // string | The `public_id` of the organization you are operating within.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.OrganizationsApi.GetOrg(ctx, publicId)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.GetOrg`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetOrg`: OrganizationResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from OrganizationsApi.GetOrg:\n%s\n", responseContent)
}

Required Parameters

Name Type Description Notes
ctx context.Context Context for authentication, logging, cancellation, deadlines, tracing, etc.
publicId string The `public_id` of the organization you are operating within.

Optional Parameters

This endpoint does not have optional parameters.

Return type

OrganizationResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListOrgs

OrganizationListResponse ListOrgs(ctx)

List your managed organizations.

Example

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog ""
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())


    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.OrganizationsApi.ListOrgs(ctx)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.ListOrgs`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `ListOrgs`: OrganizationListResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from OrganizationsApi.ListOrgs:\n%s\n", responseContent)
}

Required Parameters

This endpoint does not need any parameter.

Optional Parameters

This endpoint does not have optional parameters.

Return type

OrganizationListResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateOrg

OrganizationResponse UpdateOrg(ctx, publicId, body)

Update your organization.

Example

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog ""
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    publicId := "abc123" // string | The `public_id` of the organization you are operating within.
    body := *datadog.NewOrganization() // Organization | 

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.OrganizationsApi.UpdateOrg(ctx, publicId, body)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.UpdateOrg`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UpdateOrg`: OrganizationResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from OrganizationsApi.UpdateOrg:\n%s\n", responseContent)
}

Required Parameters

Name Type Description Notes
ctx context.Context Context for authentication, logging, cancellation, deadlines, tracing, etc.
publicId string The `public_id` of the organization you are operating within.
body Organization

Optional Parameters

This endpoint does not have optional parameters.

Return type

OrganizationResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UploadIdPForOrg

IdpResponse UploadIdPForOrg(ctx, publicId, idpFile)

There are a couple of options for updating the Identity Provider (IdP) metadata from your SAML IdP.

  • Multipart Form-Data: Post the IdP metadata file using a form post.

  • XML Body: Post the IdP metadata file as the body of the request.

Example

package main

import (
    "context"
    "encoding/json"
    "fmt"
    "os"
    datadog ""
)

func main() {
    ctx := datadog.NewDefaultContext(context.Background())

    publicId := "abc123" // string | The `public_id` of the organization you are operating with
    idpFile := os.NewFile(1234, "some_file") // *os.File | The path to the XML metadata file you wish to upload.

    configuration := datadog.NewConfiguration()

    apiClient := datadog.NewAPIClient(configuration)
    resp, r, err := apiClient.OrganizationsApi.UploadIdPForOrg(ctx, publicId, idpFile)
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `OrganizationsApi.UploadIdPForOrg`: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `UploadIdPForOrg`: IdpResponse
    responseContent, _ := json.MarshalIndent(resp, "", "  ")
    fmt.Fprintf(os.Stdout, "Response from OrganizationsApi.UploadIdPForOrg:\n%s\n", responseContent)
}

Required Parameters

Name Type Description Notes
ctx context.Context Context for authentication, logging, cancellation, deadlines, tracing, etc.
publicId string The `public_id` of the organization you are operating with
idpFile *os.File The path to the XML metadata file you wish to upload.

Optional Parameters

This endpoint does not have optional parameters.

Return type

IdpResponse

Authorization

apiKeyAuth, appKeyAuth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]