Skip to content

Latest commit

 

History

History
66 lines (50 loc) · 2.73 KB

README.md

File metadata and controls

66 lines (50 loc) · 2.73 KB

Tokens

(Tokens)

Overview

Available Operations

CreateToken

Create ingestion token

Example Usage

package main

import(
	"os"
	swosdkgo "github.com/solarwinds/swo-sdk-go"
	"github.com/solarwinds/swo-sdk-go/models/components"
	"context"
	"log"
)

func main() {
    s := swosdkgo.New(
        swosdkgo.WithSecurity(os.Getenv("SWO_API_TOKEN")),
    )

    ctx := context.Background()
    res, err := s.Tokens.CreateToken(ctx, components.CreateTokenRequest{
        Name: "<value>",
        Tags: components.Tags{
            Server: "<value>",
            TagWithoutValue: "<value>",
        },
        Type: components.TypeIngestion,
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.CreateTokenRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.CreateTokenResponse, error

Errors

Error Type Status Code Content Type
apierrors.APIError 4XX, 5XX */*