auth

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

README

Go API client for auth

Use the Auth API to manage tokens for secure access to IONOS Cloud APIs (Auth API, Cloud API, Reseller API, Activity Log API, and others).

Overview

The IONOS Cloud SDK for GO provides you with access to the IONOS Cloud API. The client library supports both simple and complex requests. It is designed for developers who are building applications in GO . The SDK for GO wraps the IONOS Cloud API. All API operations are performed over SSL and authenticated using your IONOS Cloud portal credentials. The API can be accessed within an instance running in IONOS Cloud or directly over the Internet from any application that can send an HTTPS request and receive an HTTPS response.

Installing

Use go get to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.
go get github.com/ionos-cloud/sdk-go-bundle/products/auth.git

To update the SDK use go get -u to retrieve the latest version of the SDK.

go get -u github.com/ionos-cloud/sdk-go-bundle/products/auth.git
Go Modules

If you are using Go modules, your go get will default to the latest tagged release version of the SDK. To get a specific release version of the SDK use @ in your go get command.

To get the latest SDK repository, use @latest.

go get github.com/ionos-cloud/sdk-go-bundle/products/auth@latest

Environment Variables

Environment Variable Description
IONOS_USERNAME Specify the username used to login, to authenticate against the IONOS Cloud API
IONOS_PASSWORD Specify the password used to login, to authenticate against the IONOS Cloud API
IONOS_TOKEN Specify the token used to login, if a token is being used instead of username and password
IONOS_API_URL Specify the API URL. It will overwrite the API endpoint default value api.ionos.com. Note: the host URL does not contain the /cloudapi/v6 path, so it should not be included in the IONOS_API_URL environment variable
IONOS_LOG_LEVEL Specify the Log Level used to log messages. Possible values: Off, Debug, Trace
IONOS_PINNED_CERT Specify the SHA-256 public fingerprint here, enables certificate pinning

⚠️ Note: To overwrite the api endpoint - api.ionos.com, the environment variable $IONOS_API_URL can be set, and used with NewConfigurationFromEnv() function.

Examples

Examples for creating resources using the Go SDK can be found here

Authentication

Basic Authentication
  • Type: HTTP basic authentication

Example

import (
	"context"
	"fmt"
	"github.com/ionos-cloud/sdk-go-bundle/shared"
	auth "github.com/ionos-cloud/sdk-go-bundle/products/auth"
	"log"
)

func basicAuthExample() error {
	cfg := shared.NewConfiguration("username_here", "pwd_here", "", "")
	cfg.LogLevel = Trace
	apiClient := auth.NewAPIClient(cfg)
	return nil
}
Token Authentication

There are 2 ways to generate your token:

Generate token using sdk for auth:
    import (
        "context"
        "fmt"
        "github.com/ionos-cloud/sdk-go-bundle/products/auth"
        "github.com/ionos-cloud/sdk-go-bundle/shared"
        auth "github.com/ionos-cloud/sdk-go-bundle/products/auth"
        "log"
    )

    func TokenAuthExample() error {
        //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_USERNAME and IONOS_PASSWORD as env variables
        authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv())
        jwt, _, err := auth.TokensApi.TokensGenerate(context.Background()).Execute()
        if err != nil {
            return fmt.Errorf("error occurred while generating token (%w)", err)
        }
        if !jwt.HasToken() {
            return fmt.Errorf("could not generate token")
        }
        cfg := shared.NewConfiguration("", "", *jwt.GetToken(), "")
        cfg.LogLevel = Trace
        apiClient := auth.NewAPIClient(cfg)
        return nil
    }
Generate token using ionosctl:

Install ionosctl as explained here Run commands to login and generate your token.

    ionosctl login
    ionosctl token generate
    export IONOS_TOKEN="insert_here_token_saved_from_generate_command"

Save the generated token and use it to authenticate:

    import (
        "context"
        "fmt"
        "github.com/ionos-cloud/sdk-go-bundle/products/auth"
         auth "github.com/ionos-cloud/sdk-go-bundle/products/auth"
        "log"
    )

    func TokenAuthExample() error {
        //note: to use NewConfigurationFromEnv(), you need to previously set IONOS_TOKEN as env variables
        authClient := auth.NewAPIClient(authApi.NewConfigurationFromEnv())
        cfg.LogLevel = Trace
        apiClient := auth.NewAPIClient(cfg)
        return nil
    }

Certificate pinning:

You can enable certificate pinning if you want to bypass the normal certificate checking procedure, by doing the following:

Set env variable IONOS_PINNED_CERT=<insert_sha256_public_fingerprint_here>

You can get the sha256 fingerprint most easily from the browser by inspecting the certificate.

Depth

Many of the List or Get operations will accept an optional depth argument. Setting this to a value between 0 and 5 affects the amount of data that is returned. The details returned vary depending on the resource being queried, but it generally follows this pattern. By default, the SDK sets the depth argument to the maximum value.

Depth Description
0 Only direct properties are included. Children are not included.
1 Direct properties and children's references are returned.
2 Direct properties and children's properties are returned.
3 Direct properties, children's properties, and descendants' references are returned.
4 Direct properties, children's properties, and descendants' properties are returned.
5 Returns all available properties.
Changing the base URL

Base URL for the HTTP operation can be changed by using the following function:

requestProperties.SetURL("https://api.ionos.com/cloudapi/v6")

Debugging

You can inject any logger that implements Printf as a logger instead of using the default sdk logger. There are log levels that you can set: Off, Debug and Trace. Off - does not show any logs Debug - regular logs, no sensitive information Trace - we recommend you only set this field for debugging purposes. Disable it in your production environments because it can log sensitive data. It logs the full request and response without encryption, even for an HTTPS call. Verbose request and response logging can also significantly impact your application's performance.

package main

    import (
        auth "github.com/ionos-cloud/sdk-go-bundle/products/auth"
        "github.com/ionos-cloud/sdk-go-bundle/shared"
        "github.com/sirupsen/logrus"
    )

func main() {
    // create your configuration. replace username, password, token and url with correct values, or use NewConfigurationFromEnv()
    // if you have set your env variables as explained above
    cfg := shared.NewConfiguration("username", "password", "token", "hostUrl")
    // enable request and response logging. this is the most verbose loglevel
    shared.SdkLogLevel = Trace
    // inject your own logger that implements Printf
    shared.SdkLogger = logrus.New()
    // create you api client with the configuration
    apiClient := auth.NewAPIClient(cfg)
}

Documentation for API Endpoints

All URIs are relative to https://api.ionos.com/auth/v1

API Endpoints table
Class Method HTTP request Description
TokensApi TokensDeleteByCriteria Delete /tokens Delete tokens by criteria
TokensApi TokensDeleteById Delete /tokens/{tokenId} Delete tokens
TokensApi TokensFindById Get /tokens/{tokenId} Get tokens by Key ID
TokensApi TokensGenerate Get /tokens/generate Create new tokens
TokensApi TokensGet Get /tokens List all tokens

Documentation For Models

All URIs are relative to https://api.ionos.com/auth/v1

API models list

[Back to API list] [Back to Model list]

Documentation

Index

Constants

View Source
const (
	RequestStatusQueued  = "QUEUED"
	RequestStatusRunning = "RUNNING"
	RequestStatusFailed  = "FAILED"
	RequestStatusDone    = "DONE"

	Version = "products/auth/v0.1.0"
)

Variables

This section is empty.

Functions

func AddPinnedCert

func AddPinnedCert(transport *http.Transport, pkFingerprint string)

AddPinnedCert - enables pinning of the sha256 public fingerprint to the http client's transport

func CacheExpires

func CacheExpires(r *http.Response) time.Time

CacheExpires helper function to determine remaining time before repeating a request.

Types

type APIClient

type APIClient struct {
	TokensApi *TokensApiService
	// contains filtered or unexported fields
}

APIClient manages communication with the Auth API API v1.0 In most cases there should be only one, shared, APIClient.

func NewAPIClient

func NewAPIClient(cfg *shared.Configuration) *APIClient

NewAPIClient creates a new API client. Requires a userAgent string describing your application. optionally a custom http.Client to allow for advanced features such as caching.

func (*APIClient) GetConfig

func (c *APIClient) GetConfig() *shared.Configuration

Allow modification of underlying config for alternate implementations and testing Caution: modifying the configuration while live can cause data races and potentially unwanted behavior

type ApiTokensDeleteByCriteriaRequest

type ApiTokensDeleteByCriteriaRequest struct {
	ApiService *TokensApiService
	// contains filtered or unexported fields
}

func (ApiTokensDeleteByCriteriaRequest) Criteria

func (ApiTokensDeleteByCriteriaRequest) Execute

func (ApiTokensDeleteByCriteriaRequest) XContractNumber

func (r ApiTokensDeleteByCriteriaRequest) XContractNumber(xContractNumber int32) ApiTokensDeleteByCriteriaRequest

type ApiTokensDeleteByIdRequest

type ApiTokensDeleteByIdRequest struct {
	ApiService *TokensApiService
	// contains filtered or unexported fields
}

func (ApiTokensDeleteByIdRequest) Execute

func (ApiTokensDeleteByIdRequest) XContractNumber

func (r ApiTokensDeleteByIdRequest) XContractNumber(xContractNumber int32) ApiTokensDeleteByIdRequest

type ApiTokensFindByIdRequest

type ApiTokensFindByIdRequest struct {
	ApiService *TokensApiService
	// contains filtered or unexported fields
}

func (ApiTokensFindByIdRequest) Execute

func (ApiTokensFindByIdRequest) XContractNumber

func (r ApiTokensFindByIdRequest) XContractNumber(xContractNumber int32) ApiTokensFindByIdRequest

type ApiTokensGenerateRequest

type ApiTokensGenerateRequest struct {
	ApiService *TokensApiService
	// contains filtered or unexported fields
}

func (ApiTokensGenerateRequest) Execute

func (ApiTokensGenerateRequest) XContractNumber

func (r ApiTokensGenerateRequest) XContractNumber(xContractNumber int32) ApiTokensGenerateRequest

type ApiTokensGetRequest

type ApiTokensGetRequest struct {
	ApiService *TokensApiService
	// contains filtered or unexported fields
}

func (ApiTokensGetRequest) Execute

func (ApiTokensGetRequest) XContractNumber

func (r ApiTokensGetRequest) XContractNumber(xContractNumber int32) ApiTokensGetRequest

type DeleteResponse

type DeleteResponse struct {
	Success *bool `json:"success,omitempty"`
}

DeleteResponse struct for DeleteResponse

func NewDeleteResponse

func NewDeleteResponse() *DeleteResponse

NewDeleteResponse instantiates a new DeleteResponse 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 NewDeleteResponseWithDefaults

func NewDeleteResponseWithDefaults() *DeleteResponse

NewDeleteResponseWithDefaults instantiates a new DeleteResponse 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 (*DeleteResponse) GetSuccess

func (o *DeleteResponse) GetSuccess() *bool

GetSuccess returns the Success field value If the value is explicit nil, the zero value for bool will be returned

func (*DeleteResponse) GetSuccessOk

func (o *DeleteResponse) GetSuccessOk() (*bool, bool)

GetSuccessOk returns a tuple with the Success field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*DeleteResponse) HasSuccess

func (o *DeleteResponse) HasSuccess() bool

HasSuccess returns a boolean if a field has been set.

func (DeleteResponse) MarshalJSON

func (o DeleteResponse) MarshalJSON() ([]byte, error)

func (*DeleteResponse) SetSuccess

func (o *DeleteResponse) SetSuccess(v bool)

SetSuccess sets field value

type Error

type Error struct {
	// HTTP Response Code
	HttpStatus *int32           `json:"httpStatus,omitempty"`
	Messages   *[]ErrorMessages `json:"messages,omitempty"`
}

Error struct for Error

func NewError

func NewError() *Error

NewError instantiates a new Error 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 NewErrorWithDefaults

func NewErrorWithDefaults() *Error

NewErrorWithDefaults instantiates a new Error 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 (*Error) GetHttpStatus

func (o *Error) GetHttpStatus() *int32

GetHttpStatus returns the HttpStatus field value If the value is explicit nil, the zero value for int32 will be returned

func (*Error) GetHttpStatusOk

func (o *Error) GetHttpStatusOk() (*int32, bool)

GetHttpStatusOk returns a tuple with the HttpStatus field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Error) GetMessages

func (o *Error) GetMessages() *[]ErrorMessages

GetMessages returns the Messages field value If the value is explicit nil, the zero value for []ErrorMessages will be returned

func (*Error) GetMessagesOk

func (o *Error) GetMessagesOk() (*[]ErrorMessages, bool)

GetMessagesOk returns a tuple with the Messages field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Error) HasHttpStatus

func (o *Error) HasHttpStatus() bool

HasHttpStatus returns a boolean if a field has been set.

func (*Error) HasMessages

func (o *Error) HasMessages() bool

HasMessages returns a boolean if a field has been set.

func (Error) MarshalJSON

func (o Error) MarshalJSON() ([]byte, error)

func (*Error) SetHttpStatus

func (o *Error) SetHttpStatus(v int32)

SetHttpStatus sets field value

func (*Error) SetMessages

func (o *Error) SetMessages(v []ErrorMessages)

SetMessages sets field value

type ErrorMessages

type ErrorMessages struct {
	// Numeric error code of error message.
	ErrorCode *string `json:"errorCode,omitempty"`
	// Error message.
	Message *string `json:"message,omitempty"`
}

ErrorMessages struct for ErrorMessages

func NewErrorMessages

func NewErrorMessages() *ErrorMessages

NewErrorMessages instantiates a new ErrorMessages 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 NewErrorMessagesWithDefaults

func NewErrorMessagesWithDefaults() *ErrorMessages

NewErrorMessagesWithDefaults instantiates a new ErrorMessages 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 (*ErrorMessages) GetErrorCode

func (o *ErrorMessages) GetErrorCode() *string

GetErrorCode returns the ErrorCode field value If the value is explicit nil, the zero value for string will be returned

func (*ErrorMessages) GetErrorCodeOk

func (o *ErrorMessages) GetErrorCodeOk() (*string, bool)

GetErrorCodeOk returns a tuple with the ErrorCode field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*ErrorMessages) GetMessage

func (o *ErrorMessages) GetMessage() *string

GetMessage returns the Message field value If the value is explicit nil, the zero value for string will be returned

func (*ErrorMessages) GetMessageOk

func (o *ErrorMessages) GetMessageOk() (*string, bool)

GetMessageOk returns a tuple with the Message field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*ErrorMessages) HasErrorCode

func (o *ErrorMessages) HasErrorCode() bool

HasErrorCode returns a boolean if a field has been set.

func (*ErrorMessages) HasMessage

func (o *ErrorMessages) HasMessage() bool

HasMessage returns a boolean if a field has been set.

func (ErrorMessages) MarshalJSON

func (o ErrorMessages) MarshalJSON() ([]byte, error)

func (*ErrorMessages) SetErrorCode

func (o *ErrorMessages) SetErrorCode(v string)

SetErrorCode sets field value

func (*ErrorMessages) SetMessage

func (o *ErrorMessages) SetMessage(v string)

SetMessage sets field value

type IonosTime

type IonosTime struct {
	time.Time
}

func (*IonosTime) UnmarshalJSON

func (t *IonosTime) UnmarshalJSON(data []byte) error

type Jwt

type Jwt struct {
	// JSON Web Token (JWT) Base64url strings separated by dots
	Token *string `json:"token,omitempty"`
}

Jwt struct for Jwt

func NewJwt

func NewJwt() *Jwt

NewJwt instantiates a new Jwt 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 NewJwtWithDefaults

func NewJwtWithDefaults() *Jwt

NewJwtWithDefaults instantiates a new Jwt 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 (*Jwt) GetToken

func (o *Jwt) GetToken() *string

GetToken returns the Token field value If the value is explicit nil, the zero value for string will be returned

func (*Jwt) GetTokenOk

func (o *Jwt) GetTokenOk() (*string, bool)

GetTokenOk returns a tuple with the Token field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Jwt) HasToken

func (o *Jwt) HasToken() bool

HasToken returns a boolean if a field has been set.

func (Jwt) MarshalJSON

func (o Jwt) MarshalJSON() ([]byte, error)

func (*Jwt) SetToken

func (o *Jwt) SetToken(v string)

SetToken sets field value

type NullableDeleteResponse

type NullableDeleteResponse struct {
	// contains filtered or unexported fields
}

func NewNullableDeleteResponse

func NewNullableDeleteResponse(val *DeleteResponse) *NullableDeleteResponse

func (NullableDeleteResponse) Get

func (NullableDeleteResponse) IsSet

func (v NullableDeleteResponse) IsSet() bool

func (NullableDeleteResponse) MarshalJSON

func (v NullableDeleteResponse) MarshalJSON() ([]byte, error)

func (*NullableDeleteResponse) Set

func (*NullableDeleteResponse) UnmarshalJSON

func (v *NullableDeleteResponse) UnmarshalJSON(src []byte) error

func (*NullableDeleteResponse) Unset

func (v *NullableDeleteResponse) Unset()

type NullableError

type NullableError struct {
	// contains filtered or unexported fields
}

func NewNullableError

func NewNullableError(val *Error) *NullableError

func (NullableError) Get

func (v NullableError) Get() *Error

func (NullableError) IsSet

func (v NullableError) IsSet() bool

func (NullableError) MarshalJSON

func (v NullableError) MarshalJSON() ([]byte, error)

func (*NullableError) Set

func (v *NullableError) Set(val *Error)

func (*NullableError) UnmarshalJSON

func (v *NullableError) UnmarshalJSON(src []byte) error

func (*NullableError) Unset

func (v *NullableError) Unset()

type NullableErrorMessages

type NullableErrorMessages struct {
	// contains filtered or unexported fields
}

func NewNullableErrorMessages

func NewNullableErrorMessages(val *ErrorMessages) *NullableErrorMessages

func (NullableErrorMessages) Get

func (NullableErrorMessages) IsSet

func (v NullableErrorMessages) IsSet() bool

func (NullableErrorMessages) MarshalJSON

func (v NullableErrorMessages) MarshalJSON() ([]byte, error)

func (*NullableErrorMessages) Set

func (v *NullableErrorMessages) Set(val *ErrorMessages)

func (*NullableErrorMessages) UnmarshalJSON

func (v *NullableErrorMessages) UnmarshalJSON(src []byte) error

func (*NullableErrorMessages) Unset

func (v *NullableErrorMessages) Unset()

type NullableJwt

type NullableJwt struct {
	// contains filtered or unexported fields
}

func NewNullableJwt

func NewNullableJwt(val *Jwt) *NullableJwt

func (NullableJwt) Get

func (v NullableJwt) Get() *Jwt

func (NullableJwt) IsSet

func (v NullableJwt) IsSet() bool

func (NullableJwt) MarshalJSON

func (v NullableJwt) MarshalJSON() ([]byte, error)

func (*NullableJwt) Set

func (v *NullableJwt) Set(val *Jwt)

func (*NullableJwt) UnmarshalJSON

func (v *NullableJwt) UnmarshalJSON(src []byte) error

func (*NullableJwt) Unset

func (v *NullableJwt) Unset()

type NullableToken

type NullableToken struct {
	// contains filtered or unexported fields
}

func NewNullableToken

func NewNullableToken(val *Token) *NullableToken

func (NullableToken) Get

func (v NullableToken) Get() *Token

func (NullableToken) IsSet

func (v NullableToken) IsSet() bool

func (NullableToken) MarshalJSON

func (v NullableToken) MarshalJSON() ([]byte, error)

func (*NullableToken) Set

func (v *NullableToken) Set(val *Token)

func (*NullableToken) UnmarshalJSON

func (v *NullableToken) UnmarshalJSON(src []byte) error

func (*NullableToken) Unset

func (v *NullableToken) Unset()

type NullableTokens

type NullableTokens struct {
	// contains filtered or unexported fields
}

func NewNullableTokens

func NewNullableTokens(val *Tokens) *NullableTokens

func (NullableTokens) Get

func (v NullableTokens) Get() *Tokens

func (NullableTokens) IsSet

func (v NullableTokens) IsSet() bool

func (NullableTokens) MarshalJSON

func (v NullableTokens) MarshalJSON() ([]byte, error)

func (*NullableTokens) Set

func (v *NullableTokens) Set(val *Tokens)

func (*NullableTokens) UnmarshalJSON

func (v *NullableTokens) UnmarshalJSON(src []byte) error

func (*NullableTokens) Unset

func (v *NullableTokens) Unset()

type TLSDial

type TLSDial func(ctx context.Context, network, addr string) (net.Conn, error)

TLSDial can be assigned to a http.Transport's DialTLS field.

type Token

type Token struct {
	// Identifier of the token.
	Id *string `json:"id"`
	// Hypertext REFerence for the specified token.
	Href *string `json:"href"`
	// The date the token was generated.
	CreatedDate *string `json:"createdDate"`
	// The date the token will expire.
	ExpirationDate *string `json:"expirationDate"`
}

Token struct for Token

func NewToken

func NewToken(id string, href string, createdDate string, expirationDate string) *Token

NewToken instantiates a new Token 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 NewTokenWithDefaults

func NewTokenWithDefaults() *Token

NewTokenWithDefaults instantiates a new Token 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 (*Token) GetCreatedDate

func (o *Token) GetCreatedDate() *string

GetCreatedDate returns the CreatedDate field value If the value is explicit nil, the zero value for string will be returned

func (*Token) GetCreatedDateOk

func (o *Token) GetCreatedDateOk() (*string, bool)

GetCreatedDateOk returns a tuple with the CreatedDate field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Token) GetExpirationDate

func (o *Token) GetExpirationDate() *string

GetExpirationDate returns the ExpirationDate field value If the value is explicit nil, the zero value for string will be returned

func (*Token) GetExpirationDateOk

func (o *Token) GetExpirationDateOk() (*string, bool)

GetExpirationDateOk returns a tuple with the ExpirationDate field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Token) GetHref

func (o *Token) GetHref() *string

GetHref returns the Href field value If the value is explicit nil, the zero value for string will be returned

func (*Token) GetHrefOk

func (o *Token) GetHrefOk() (*string, bool)

GetHrefOk returns a tuple with the Href field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Token) GetId

func (o *Token) GetId() *string

GetId returns the Id field value If the value is explicit nil, the zero value for string will be returned

func (*Token) GetIdOk

func (o *Token) GetIdOk() (*string, bool)

GetIdOk returns a tuple with the Id field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Token) HasCreatedDate

func (o *Token) HasCreatedDate() bool

HasCreatedDate returns a boolean if a field has been set.

func (*Token) HasExpirationDate

func (o *Token) HasExpirationDate() bool

HasExpirationDate returns a boolean if a field has been set.

func (*Token) HasHref

func (o *Token) HasHref() bool

HasHref returns a boolean if a field has been set.

func (*Token) HasId

func (o *Token) HasId() bool

HasId returns a boolean if a field has been set.

func (Token) MarshalJSON

func (o Token) MarshalJSON() ([]byte, error)

func (*Token) SetCreatedDate

func (o *Token) SetCreatedDate(v string)

SetCreatedDate sets field value

func (*Token) SetExpirationDate

func (o *Token) SetExpirationDate(v string)

SetExpirationDate sets field value

func (*Token) SetHref

func (o *Token) SetHref(v string)

SetHref sets field value

func (*Token) SetId

func (o *Token) SetId(v string)

SetId sets field value

type Tokens

type Tokens struct {
	// Array of items in that collection.
	Tokens *[]Token `json:"tokens,omitempty"`
}

Tokens struct for Tokens

func NewTokens

func NewTokens() *Tokens

NewTokens instantiates a new Tokens 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 NewTokensWithDefaults

func NewTokensWithDefaults() *Tokens

NewTokensWithDefaults instantiates a new Tokens 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 (*Tokens) GetTokens

func (o *Tokens) GetTokens() *[]Token

GetTokens returns the Tokens field value If the value is explicit nil, the zero value for []Token will be returned

func (*Tokens) GetTokensOk

func (o *Tokens) GetTokensOk() (*[]Token, bool)

GetTokensOk returns a tuple with the Tokens field value and a boolean to check if the value has been set. NOTE: If the value is an explicit nil, `nil, true` will be returned

func (*Tokens) HasTokens

func (o *Tokens) HasTokens() bool

HasTokens returns a boolean if a field has been set.

func (Tokens) MarshalJSON

func (o Tokens) MarshalJSON() ([]byte, error)

func (*Tokens) SetTokens

func (o *Tokens) SetTokens(v []Token)

SetTokens sets field value

type TokensApiService

type TokensApiService service

TokensApiService TokensApi service

func (*TokensApiService) TokensDeleteByCriteria

func (a *TokensApiService) TokensDeleteByCriteria(ctx _context.Context) ApiTokensDeleteByCriteriaRequest

* TokensDeleteByCriteria Delete tokens by criteria * Delete one or multiple tokens by the required `criteria` parameter values: `ALL`, `EXPIRED` and `CURRENT`. With parameter values `ALL` and `EXPIRED`, 'Basic Authentication' or 'Token Authentication' tokens with valid credentials must be encapsulated in the header. With value `CURRENT`, only the 'Token Authentication' with valid credentials is required. Users with multiple contracts must also provide a valid contract number in the `X-Contract-Number` header. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiTokensDeleteByCriteriaRequest

func (*TokensApiService) TokensDeleteByCriteriaExecute

* Execute executes the request * @return DeleteResponse

func (*TokensApiService) TokensDeleteById

func (a *TokensApiService) TokensDeleteById(ctx _context.Context, tokenId string) ApiTokensDeleteByIdRequest

* TokensDeleteById Delete tokens * Delete a token by Key ID (`tokenId`). To access the endpoint, 'Basic Authentication' or 'Token Authentication' tokens with valid credentials must be encapsulated in the header. Users with multiple contracts must also provide a valid contract number in the `X-Contract-Number` header. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param tokenId The Key ID of the token (can be retrieved from the header section of the token). * @return ApiTokensDeleteByIdRequest

func (*TokensApiService) TokensDeleteByIdExecute

* Execute executes the request * @return DeleteResponse

func (*TokensApiService) TokensFindById

func (a *TokensApiService) TokensFindById(ctx _context.Context, tokenId string) ApiTokensFindByIdRequest

* TokensFindById Get tokens by Key ID * Retrieve the details for a token by the Key ID (`tokenId`). To access this endpoint, 'Basic Authentication' or 'Token Authentication' tokens with valid credentials must be encapsulated in the header. Users with multiple contracts must also provide a valid contract number in the `X-Contract-Number` header. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param tokenId The Key ID of the token (can be retrieved from the header section of the token). * @return ApiTokensFindByIdRequest

func (*TokensApiService) TokensFindByIdExecute

func (a *TokensApiService) TokensFindByIdExecute(r ApiTokensFindByIdRequest) (Token, *shared.APIResponse, error)

* Execute executes the request * @return Token

func (*TokensApiService) TokensGenerate

  • TokensGenerate Create new tokens
  • Users can generate new tokens ([JWT](https://jwt.io/) or [JSON Web Token](https://tools.ietf.org/html/rfc7519)). By default, new tokens are linked to the user’s contract. Users with multiple contracts must provide the contract number, for which the token is generated, in the `X-Contract-Number` header; otherwise, an error response is returned.

To access this endpoint, 'Basic Authentication' or 'Token Authentication' tokens with valid credentials must be encapsulated in the header, by users with one or with multiple contracts.

The response will contain a newly-generated token for accessing any IONOS Cloud APIs (Auth API, Cloud API, Reseller API, Activity Log API, and others). The token can be used to access the APIs without providing the contract number in the `X-Contract-Number` header, by users with one or with multiple contracts. However, a valid contract number must be provided in the `X-Contract-Number` header to access the Auth API. By default, generated access tokens will expire after one year (subject to change).

  • @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
  • @return ApiTokensGenerateRequest

func (*TokensApiService) TokensGenerateExecute

func (a *TokensApiService) TokensGenerateExecute(r ApiTokensGenerateRequest) (Jwt, *shared.APIResponse, error)

* Execute executes the request * @return Jwt

func (*TokensApiService) TokensGet

* TokensGet List all tokens * List the details of all tokens, generated by the user. To access this endpoint, 'Basic Authentication' or 'Token Authentication' tokens with valid credentials must be encapsulated in the header. Users with multiple contracts must also provide a valid contract number in the `X-Contract-Number` header. * @param ctx _context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @return ApiTokensGetRequest

func (*TokensApiService) TokensGetExecute

func (a *TokensApiService) TokensGetExecute(r ApiTokensGetRequest) (Tokens, *shared.APIResponse, error)

* Execute executes the request * @return Tokens

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL