Skip to content

Latest commit

 

History

History
206 lines (128 loc) · 5.45 KB

File metadata and controls

206 lines (128 loc) · 5.45 KB

\ServiceTokenApi

All URIs are relative to http://localhost

Method HTTP request Description
CreateNewServiceToken Post /security/tokens Create new service token
DeleteServiceToken Delete /security/tokens/{serviceTokenId} Delete service token
GetServiceTokens Get /security/tokens Get service tokens

CreateNewServiceToken

ServiceTokenCreatedResponse CreateNewServiceToken(ctx).NewServiceTokenRequest(newServiceTokenRequest).Execute()

Create new service token

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    newServiceTokenRequest := *openapiclient.NewNewServiceTokenRequest("Name_example", []string{"Roles_example"}) // NewServiceTokenRequest | 

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceTokenApi.CreateNewServiceToken(context.Background()).NewServiceTokenRequest(newServiceTokenRequest).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceTokenApi.CreateNewServiceToken``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `CreateNewServiceToken`: ServiceTokenCreatedResponse
    fmt.Fprintf(os.Stdout, "Response from `ServiceTokenApi.CreateNewServiceToken`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCreateNewServiceTokenRequest struct via the builder pattern

Name Type Description Notes
newServiceTokenRequest NewServiceTokenRequest

Return type

ServiceTokenCreatedResponse

Authorization

ApiToken, ServiceBearer, ServiceToken

HTTP request headers

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

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

DeleteServiceToken

DeleteServiceToken(ctx, serviceTokenId).Execute()

Delete service token

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {
    serviceTokenId := int64(789) // int64 | The identifier of a service token

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceTokenApi.DeleteServiceToken(context.Background(), serviceTokenId).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceTokenApi.DeleteServiceToken``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
serviceTokenId int64 The identifier of a service token

Other Parameters

Other parameters are passed through a pointer to a apiDeleteServiceTokenRequest struct via the builder pattern

Name Type Description Notes

Return type

(empty response body)

Authorization

ApiToken, ServiceBearer, ServiceToken

HTTP request headers

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

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

GetServiceTokens

[]ServiceToken GetServiceTokens(ctx).Execute()

Get service tokens

Example

package main

import (
    "context"
    "fmt"
    "os"
    openapiclient "./openapi"
)

func main() {

    configuration := openapiclient.NewConfiguration()
    apiClient := openapiclient.NewAPIClient(configuration)
    resp, r, err := apiClient.ServiceTokenApi.GetServiceTokens(context.Background()).Execute()
    if err != nil {
        fmt.Fprintf(os.Stderr, "Error when calling `ServiceTokenApi.GetServiceTokens``: %v\n", err)
        fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    }
    // response from `GetServiceTokens`: []ServiceToken
    fmt.Fprintf(os.Stdout, "Response from `ServiceTokenApi.GetServiceTokens`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetServiceTokensRequest struct via the builder pattern

Return type

[]ServiceToken

Authorization

ApiToken, ServiceBearer, ServiceToken

HTTP request headers

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

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