feat: generating code

This commit is contained in:
Marcel S. Henselin 2026-01-21 09:07:29 +01:00
parent c329d58970
commit 51663cd8d0
1221 changed files with 271709 additions and 2444 deletions

View file

@ -0,0 +1 @@
6.6.0

2048
pkg/logsbeta/api_default.go Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,712 @@
/*
STACKIT Logs API
Testing DefaultApiService
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
package logsbeta
import (
"context"
"encoding/json"
"net/http"
"net/http/httptest"
"net/url"
"strings"
"testing"
"github.com/google/uuid"
"github.com/stackitcloud/stackit-sdk-go/core/config"
)
func Test_logsbeta_DefaultApiService(t *testing.T) {
t.Run("Test DefaultApiService CreateAccessToken", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AccessToken{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
createAccessTokenPayload := CreateAccessTokenPayload{}
resp, reqErr := apiClient.CreateAccessToken(context.Background(), projectId, regionId, instanceId).CreateAccessTokenPayload(createAccessTokenPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService CreateLogsInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := LogsInstance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
createLogsInstancePayload := CreateLogsInstancePayload{}
resp, reqErr := apiClient.CreateLogsInstance(context.Background(), projectId, regionId).CreateLogsInstancePayload(createLogsInstancePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService DeleteAccessToken", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
tIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
tId := tIdValue
reqErr := apiClient.DeleteAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService DeleteAllAccessTokens", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AccessTokenList{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
resp, reqErr := apiClient.DeleteAllAccessTokens(context.Background(), projectId, regionId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService DeleteAllExpiredAccessTokens", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/expired"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AccessTokenList{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
resp, reqErr := apiClient.DeleteAllExpiredAccessTokens(context.Background(), projectId, regionId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService DeleteLogsInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
reqErr := apiClient.DeleteLogsInstance(context.Background(), projectId, regionId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService GetAccessToken", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
tIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AccessToken{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
tId := tIdValue
resp, reqErr := apiClient.GetAccessToken(context.Background(), projectId, regionId, instanceId, tId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService GetLogsInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := LogsInstance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
resp, reqErr := apiClient.GetLogsInstance(context.Background(), projectId, regionId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListAccessTokens", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := AccessTokenList{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
resp, reqErr := apiClient.ListAccessTokens(context.Background(), projectId, regionId, instanceId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService ListLogsInstances", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := LogsInstancesList{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
resp, reqErr := apiClient.ListLogsInstances(context.Background(), projectId, regionId).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
t.Run("Test DefaultApiService UpdateAccessToken", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}/access-tokens/{tId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
tIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"tId"+"}", url.PathEscape(ParameterValueToString(tIdValue, "tId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
tId := tIdValue
updateAccessTokenPayload := UpdateAccessTokenPayload{}
reqErr := apiClient.UpdateAccessToken(context.Background(), projectId, regionId, instanceId, tId).UpdateAccessTokenPayload(updateAccessTokenPayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
})
t.Run("Test DefaultApiService UpdateLogsInstance", func(t *testing.T) {
_apiUrlPath := "/v1beta/projects/{projectId}/regions/{regionId}/instances/{instanceId}"
projectIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
regionIdValue := "regionId-value"
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"regionId"+"}", url.PathEscape(ParameterValueToString(regionIdValue, "regionId")), -1)
instanceIdValue := uuid.NewString()
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"instanceId"+"}", url.PathEscape(ParameterValueToString(instanceIdValue, "instanceId")), -1)
testDefaultApiServeMux := http.NewServeMux()
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
data := LogsInstance{}
w.Header().Add("Content-Type", "application/json")
json.NewEncoder(w).Encode(data)
})
testServer := httptest.NewServer(testDefaultApiServeMux)
defer testServer.Close()
configuration := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "OpenAPI-Generator/1.0.0/go",
Debug: false,
Region: "test_region",
Servers: config.ServerConfigurations{
{
URL: testServer.URL,
Description: "Localhost for logsbeta_DefaultApi",
Variables: map[string]config.ServerVariable{
"region": {
DefaultValue: "test_region.",
EnumValues: []string{
"test_region.",
},
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
apiClient, err := NewAPIClient(config.WithCustomConfiguration(configuration), config.WithoutAuthentication())
if err != nil {
t.Fatalf("creating API client: %v", err)
}
projectId := projectIdValue
regionId := regionIdValue
instanceId := instanceIdValue
updateLogsInstancePayload := UpdateLogsInstancePayload{}
resp, reqErr := apiClient.UpdateLogsInstance(context.Background(), projectId, regionId, instanceId).UpdateLogsInstancePayload(updateLogsInstancePayload).Execute()
if reqErr != nil {
t.Fatalf("error in call: %v", reqErr)
}
if IsNil(resp) {
t.Fatalf("response not present")
}
})
}

631
pkg/logsbeta/client.go Normal file
View file

@ -0,0 +1,631 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"bytes"
"context"
"encoding/json"
"encoding/xml"
"fmt"
"io"
"log"
"mime/multipart"
"net/http"
"net/http/httputil"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"unicode/utf8"
"github.com/stackitcloud/stackit-sdk-go/core/auth"
"github.com/stackitcloud/stackit-sdk-go/core/config"
)
var (
jsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:vnd\.[^;]+\+)?json)`)
xmlCheck = regexp.MustCompile(`(?i:(?:application|text)/xml)`)
queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`)
queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]")
)
// APIClient manages communication with the STACKIT Logs API API v1beta.0.3
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *config.Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
defaultApi *DefaultApiService
}
type service struct {
client DefaultApi
}
// NewAPIClient creates a new API client.
// Optionally receives configuration options
func NewAPIClient(opts ...config.ConfigurationOption) (*APIClient, error) {
cfg := NewConfiguration()
for _, option := range opts {
err := option(cfg)
if err != nil {
return nil, fmt.Errorf("configuring the client: %w", err)
}
}
err := config.ConfigureRegion(cfg)
if err != nil {
return nil, fmt.Errorf("configuring region: %w", err)
}
if cfg.HTTPClient == nil {
cfg.HTTPClient = &http.Client{}
}
authRoundTripper, err := auth.SetupAuth(cfg)
if err != nil {
return nil, fmt.Errorf("setting up authentication: %w", err)
}
roundTripper := authRoundTripper
if cfg.Middleware != nil {
roundTripper = config.ChainMiddleware(roundTripper, cfg.Middleware...)
}
cfg.HTTPClient.Transport = roundTripper
c := &APIClient{}
c.cfg = cfg
c.common.client = c
c.defaultApi = (*DefaultApiService)(&c.common)
return c, nil
}
func atoi(in string) (int, error) {
return strconv.Atoi(in)
}
// selectHeaderContentType select a content type from the available list.
func selectHeaderContentType(contentTypes []string) string {
if len(contentTypes) == 0 {
return ""
}
if contains(contentTypes, "application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
// selectHeaderAccept join all accept types and return
func selectHeaderAccept(accepts []string) string {
if len(accepts) == 0 {
return ""
}
if contains(accepts, "application/json") {
return "application/json"
}
return strings.Join(accepts, ",")
}
// contains is a case insensitive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.EqualFold(a, needle) {
return true
}
}
return false
}
// Verify optional parameters are of the correct type.
func typeCheckParameter(obj interface{}, expected string, name string) error {
// Make sure there is an object.
if obj == nil {
return nil
}
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
func ParameterValueToString(obj interface{}, key string) string {
if reflect.TypeOf(obj).Kind() != reflect.Ptr {
return fmt.Sprintf("%v", obj)
}
var param, ok = obj.(MappedNullable)
if !ok {
return ""
}
dataMap, err := param.ToMap()
if err != nil {
return ""
}
return fmt.Sprintf("%v", dataMap[key])
}
// parameterAddToHeaderOrQuery adds the provided object to the request header or url query
// supporting deep object syntax
func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, collectionType string) {
var v = reflect.ValueOf(obj)
var value = ""
if v == reflect.ValueOf(nil) {
value = "null"
} else {
switch v.Kind() {
case reflect.Invalid:
value = "invalid"
case reflect.Struct:
if t, ok := obj.(MappedNullable); ok {
dataMap, err := t.ToMap()
if err != nil {
return
}
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, collectionType)
return
}
if t, ok := obj.(time.Time); ok {
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339), collectionType)
return
}
value = v.Type().String() + " value"
case reflect.Slice:
var indValue = reflect.ValueOf(obj)
if indValue == reflect.ValueOf(nil) {
return
}
var lenIndValue = indValue.Len()
for i := 0; i < lenIndValue; i++ {
var arrayValue = indValue.Index(i)
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, arrayValue.Interface(), collectionType)
}
return
case reflect.Map:
var indValue = reflect.ValueOf(obj)
if indValue == reflect.ValueOf(nil) {
return
}
iter := indValue.MapRange()
for iter.Next() {
k, v := iter.Key(), iter.Value()
parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), collectionType)
}
return
case reflect.Interface:
fallthrough
case reflect.Ptr:
parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), collectionType)
return
case reflect.Int, reflect.Int8, reflect.Int16,
reflect.Int32, reflect.Int64:
value = strconv.FormatInt(v.Int(), 10)
case reflect.Uint, reflect.Uint8, reflect.Uint16,
reflect.Uint32, reflect.Uint64, reflect.Uintptr:
value = strconv.FormatUint(v.Uint(), 10)
case reflect.Float32, reflect.Float64:
value = strconv.FormatFloat(v.Float(), 'g', -1, 32)
case reflect.Bool:
value = strconv.FormatBool(v.Bool())
case reflect.String:
value = v.String()
default:
value = v.Type().String() + " value"
}
}
switch valuesMap := headerOrQueryParams.(type) {
case url.Values:
if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" {
valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value)
} else {
valuesMap.Add(keyPrefix, value)
}
break
case map[string]string:
valuesMap[keyPrefix] = value
break
}
}
// helper for converting interface{} parameters to json strings
func parameterToJson(obj interface{}) (string, error) {
jsonBuf, err := json.Marshal(obj)
if err != nil {
return "", err
}
return string(jsonBuf), err
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
if c.cfg.Debug {
dump, err := httputil.DumpRequestOut(request, true)
if err != nil {
return nil, err
}
log.Printf("\n%s\n", string(dump))
}
resp, err := c.cfg.HTTPClient.Do(request)
if err != nil {
return resp, err
}
if c.cfg.Debug {
dump, err := httputil.DumpResponse(resp, true)
if err != nil {
return resp, err
}
log.Printf("\n%s\n", string(dump))
}
return resp, err
}
// Allow modification of underlying config for alternate implementations and testing
// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior
func (c *APIClient) GetConfig() *config.Configuration {
return c.cfg
}
type formFile struct {
fileBytes []byte
fileName string
formFileName string
}
// prepareRequest build the request
func (c *APIClient) prepareRequest(
ctx context.Context,
path string, method string,
postBody interface{},
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
formFiles []formFile) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
// Detect postBody type and post.
if !IsNil(postBody) {
contentType := headerParams["Content-Type"]
if contentType == "" {
contentType = detectContentType(postBody)
headerParams["Content-Type"] = contentType
}
body, err = setBody(postBody, contentType)
if err != nil {
return nil, err
}
}
// add form parameters and file if available.
if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) {
if body != nil {
return nil, fmt.Errorf("cannot specify postBody and multipart form at the same time.")
}
body = &bytes.Buffer{}
w := multipart.NewWriter(body)
for k, v := range formParams {
for _, iv := range v {
if strings.HasPrefix(k, "@") { // file
err = addFile(w, k[1:], iv)
if err != nil {
return nil, err
}
} else { // form value
w.WriteField(k, iv)
}
}
}
for _, formFile := range formFiles {
if len(formFile.fileBytes) > 0 && formFile.fileName != "" {
w.Boundary()
part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName))
if err != nil {
return nil, err
}
_, err = part.Write(formFile.fileBytes)
if err != nil {
return nil, err
}
}
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
w.Close()
}
if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 {
if body != nil {
return nil, fmt.Errorf("cannot specify postBody and x-www-form-urlencoded form at the same time.")
}
body = &bytes.Buffer{}
body.WriteString(formParams.Encode())
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
}
// Setup path and query parameters
url, err := url.Parse(path)
if err != nil {
return nil, err
}
// Override request host, if applicable
if c.cfg.Host != "" {
url.Host = c.cfg.Host
}
// Override request scheme, if applicable
if c.cfg.Scheme != "" {
url.Scheme = c.cfg.Scheme
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
query.Add(k, iv)
}
}
// Encode the parameters.
url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string {
pieces := strings.Split(s, "=")
pieces[0] = queryDescape.Replace(pieces[0])
return strings.Join(pieces, "=")
})
// Generate a new request
if body != nil {
localVarRequest, err = http.NewRequest(method, url.String(), body)
} else {
localVarRequest, err = http.NewRequest(method, url.String(), nil)
}
if err != nil {
return nil, err
}
// add header parameters, if any
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers[h] = []string{v}
}
localVarRequest.Header = headers
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
if ctx != nil {
// add context to the request
localVarRequest = localVarRequest.WithContext(ctx)
// Walk through any authentication.
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) {
if len(b) == 0 {
return nil
}
if s, ok := v.(*string); ok {
*s = string(b)
return nil
}
if f, ok := v.(*os.File); ok {
f, err = os.CreateTemp("", "HttpClientFile")
if err != nil {
return
}
_, err = f.Write(b)
if err != nil {
return
}
_, err = f.Seek(0, io.SeekStart)
return
}
if f, ok := v.(**os.File); ok {
*f, err = os.CreateTemp("", "HttpClientFile")
if err != nil {
return
}
_, err = (*f).Write(b)
if err != nil {
return
}
_, err = (*f).Seek(0, io.SeekStart)
return
}
if xmlCheck.MatchString(contentType) {
if err = xml.Unmarshal(b, v); err != nil {
return err
}
return nil
}
if jsonCheck.MatchString(contentType) {
if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas
if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined
if err = unmarshalObj.UnmarshalJSON(b); err != nil {
return err
}
} else {
return fmt.Errorf("unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined")
}
} else if err = json.Unmarshal(b, v); err != nil { // simple model
return err
}
return nil
}
return fmt.Errorf("undefined response type")
}
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(filepath.Clean(path))
if err != nil {
return err
}
err = file.Close()
if err != nil {
return err
}
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
return err
}
_, err = io.Copy(part, file)
return err
}
// A wrapper for strict JSON decoding
func newStrictDecoder(data []byte) *json.Decoder {
dec := json.NewDecoder(bytes.NewBuffer(data))
dec.DisallowUnknownFields()
return dec
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
bodyBuf = &bytes.Buffer{}
}
if reader, ok := body.(io.Reader); ok {
_, err = bodyBuf.ReadFrom(reader)
} else if fp, ok := body.(*os.File); ok {
_, err = bodyBuf.ReadFrom(fp)
} else if b, ok := body.([]byte); ok {
_, err = bodyBuf.Write(b)
} else if s, ok := body.(string); ok {
_, err = bodyBuf.WriteString(s)
} else if s, ok := body.(*string); ok {
_, err = bodyBuf.WriteString(*s)
} else if jsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
err = xml.NewEncoder(bodyBuf).Encode(body)
}
if err != nil {
return nil, err
}
if bodyBuf.Len() == 0 {
err = fmt.Errorf("invalid body type %s", contentType)
return nil, err
}
return bodyBuf, nil
}
// detectContentType method is used to figure out `Request.Body` content type for request header
func detectContentType(body interface{}) string {
contentType := "text/plain; charset=utf-8"
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"
default:
if b, ok := body.([]byte); ok {
contentType = http.DetectContentType(b)
} else if kind == reflect.Slice {
contentType = "application/json; charset=utf-8"
}
}
return contentType
}
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
type cacheControl map[string]string
func parseCacheControl(headers http.Header) cacheControl {
cc := cacheControl{}
ccHeader := headers.Get("Cache-Control")
for _, part := range strings.Split(ccHeader, ",") {
part = strings.Trim(part, " ")
if part == "" {
continue
}
if strings.ContainsRune(part, '=') {
keyval := strings.Split(part, "=")
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
} else {
cc[part] = ""
}
}
return cc
}
// CacheExpires helper function to determine remaining time before repeating a request.
func CacheExpires(r *http.Response) time.Time {
// Figure out when the cache expires.
var expires time.Time
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
if err != nil {
return time.Now()
}
respCacheControl := parseCacheControl(r.Header)
if maxAge, ok := respCacheControl["max-age"]; ok {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
} else {
expires = now.Add(lifetime)
}
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
expires, err = time.Parse(time.RFC1123, expiresHeader)
if err != nil {
expires = now
}
}
}
return expires
}
func strlen(s string) int {
return utf8.RuneCountInString(s)
}

View file

@ -0,0 +1,38 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"github.com/stackitcloud/stackit-sdk-go/core/config"
)
// NewConfiguration returns a new Configuration object
func NewConfiguration() *config.Configuration {
cfg := &config.Configuration{
DefaultHeader: make(map[string]string),
UserAgent: "stackit-sdk-go/logsbeta",
Debug: false,
Servers: config.ServerConfigurations{
{
URL: "https://logs.api.stackit.cloud",
Description: "No description provided",
Variables: map[string]config.ServerVariable{
"region": {
Description: "No description provided",
DefaultValue: "global",
},
},
},
},
OperationServers: map[string]config.ServerConfigurations{},
}
return cfg
}

View file

@ -0,0 +1,600 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
"fmt"
"time"
)
// checks if the AccessToken type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AccessToken{}
/*
types and functions for accessToken
*/
// isNotNullableString
type AccessTokenGetAccessTokenAttributeType = *string
func getAccessTokenGetAccessTokenAttributeTypeOk(arg AccessTokenGetAccessTokenAttributeType) (ret AccessTokenGetAccessTokenRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetAccessTokenAttributeType(arg *AccessTokenGetAccessTokenAttributeType, val AccessTokenGetAccessTokenRetType) {
*arg = &val
}
type AccessTokenGetAccessTokenArgType = string
type AccessTokenGetAccessTokenRetType = string
/*
types and functions for creator
*/
// isNotNullableString
type AccessTokenGetCreatorAttributeType = *string
func getAccessTokenGetCreatorAttributeTypeOk(arg AccessTokenGetCreatorAttributeType) (ret AccessTokenGetCreatorRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetCreatorAttributeType(arg *AccessTokenGetCreatorAttributeType, val AccessTokenGetCreatorRetType) {
*arg = &val
}
type AccessTokenGetCreatorArgType = string
type AccessTokenGetCreatorRetType = string
/*
types and functions for description
*/
// isNotNullableString
type AccessTokenGetDescriptionAttributeType = *string
func getAccessTokenGetDescriptionAttributeTypeOk(arg AccessTokenGetDescriptionAttributeType) (ret AccessTokenGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetDescriptionAttributeType(arg *AccessTokenGetDescriptionAttributeType, val AccessTokenGetDescriptionRetType) {
*arg = &val
}
type AccessTokenGetDescriptionArgType = string
type AccessTokenGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type AccessTokenGetDisplayNameAttributeType = *string
func getAccessTokenGetDisplayNameAttributeTypeOk(arg AccessTokenGetDisplayNameAttributeType) (ret AccessTokenGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetDisplayNameAttributeType(arg *AccessTokenGetDisplayNameAttributeType, val AccessTokenGetDisplayNameRetType) {
*arg = &val
}
type AccessTokenGetDisplayNameArgType = string
type AccessTokenGetDisplayNameRetType = string
/*
types and functions for expires
*/
// isBoolean
type AccessTokengetExpiresAttributeType = *bool
type AccessTokengetExpiresArgType = bool
type AccessTokengetExpiresRetType = bool
func getAccessTokengetExpiresAttributeTypeOk(arg AccessTokengetExpiresAttributeType) (ret AccessTokengetExpiresRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokengetExpiresAttributeType(arg *AccessTokengetExpiresAttributeType, val AccessTokengetExpiresRetType) {
*arg = &val
}
/*
types and functions for id
*/
// isNotNullableString
type AccessTokenGetIdAttributeType = *string
func getAccessTokenGetIdAttributeTypeOk(arg AccessTokenGetIdAttributeType) (ret AccessTokenGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetIdAttributeType(arg *AccessTokenGetIdAttributeType, val AccessTokenGetIdRetType) {
*arg = &val
}
type AccessTokenGetIdArgType = string
type AccessTokenGetIdRetType = string
/*
types and functions for permissions
*/
// isArray
type AccessTokenGetPermissionsAttributeType = *[]string
type AccessTokenGetPermissionsArgType = []string
type AccessTokenGetPermissionsRetType = []string
func getAccessTokenGetPermissionsAttributeTypeOk(arg AccessTokenGetPermissionsAttributeType) (ret AccessTokenGetPermissionsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetPermissionsAttributeType(arg *AccessTokenGetPermissionsAttributeType, val AccessTokenGetPermissionsRetType) {
*arg = &val
}
/*
types and functions for status
*/
// isEnum
// AccessTokenStatus the model 'AccessToken'
// value type for enums
type AccessTokenStatus string
// List of Status
const (
ACCESSTOKENSTATUS_ACTIVE AccessTokenStatus = "active"
ACCESSTOKENSTATUS_EXPIRED AccessTokenStatus = "expired"
)
// All allowed values of AccessToken enum
var AllowedAccessTokenStatusEnumValues = []AccessTokenStatus{
"active",
"expired",
}
func (v *AccessTokenStatus) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson AccessTokenStatus
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := AccessTokenStatus(value)
for _, existing := range AllowedAccessTokenStatusEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid AccessToken", value)
}
// NewAccessTokenStatusFromValue returns a pointer to a valid AccessTokenStatus
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewAccessTokenStatusFromValue(v AccessTokenStatus) (*AccessTokenStatus, error) {
ev := AccessTokenStatus(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for AccessTokenStatus: valid values are %v", v, AllowedAccessTokenStatusEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v AccessTokenStatus) IsValid() bool {
for _, existing := range AllowedAccessTokenStatusEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to StatusStatus value
func (v AccessTokenStatus) Ptr() *AccessTokenStatus {
return &v
}
type NullableAccessTokenStatus struct {
value *AccessTokenStatus
isSet bool
}
func (v NullableAccessTokenStatus) Get() *AccessTokenStatus {
return v.value
}
func (v *NullableAccessTokenStatus) Set(val *AccessTokenStatus) {
v.value = val
v.isSet = true
}
func (v NullableAccessTokenStatus) IsSet() bool {
return v.isSet
}
func (v *NullableAccessTokenStatus) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccessTokenStatus(val *AccessTokenStatus) *NullableAccessTokenStatus {
return &NullableAccessTokenStatus{value: val, isSet: true}
}
func (v NullableAccessTokenStatus) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccessTokenStatus) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type AccessTokenGetStatusAttributeType = *AccessTokenStatus
type AccessTokenGetStatusArgType = AccessTokenStatus
type AccessTokenGetStatusRetType = AccessTokenStatus
func getAccessTokenGetStatusAttributeTypeOk(arg AccessTokenGetStatusAttributeType) (ret AccessTokenGetStatusRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetStatusAttributeType(arg *AccessTokenGetStatusAttributeType, val AccessTokenGetStatusRetType) {
*arg = &val
}
/*
types and functions for validUntil
*/
// isDateTime
type AccessTokenGetValidUntilAttributeType = *time.Time
type AccessTokenGetValidUntilArgType = time.Time
type AccessTokenGetValidUntilRetType = time.Time
func getAccessTokenGetValidUntilAttributeTypeOk(arg AccessTokenGetValidUntilAttributeType) (ret AccessTokenGetValidUntilRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenGetValidUntilAttributeType(arg *AccessTokenGetValidUntilAttributeType, val AccessTokenGetValidUntilRetType) {
*arg = &val
}
// AccessToken struct for AccessToken
type AccessToken struct {
// A generated access token. Only available on creation.
AccessToken AccessTokenGetAccessTokenAttributeType `json:"accessToken,omitempty"`
// The user who created the access token.
// REQUIRED
Creator AccessTokenGetCreatorAttributeType `json:"creator" required:"true"`
// The description of the access token.
Description AccessTokenGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name of the access token.
// REQUIRED
DisplayName AccessTokenGetDisplayNameAttributeType `json:"displayName" required:"true"`
// Indicates if the access token can expire.
// REQUIRED
Expires AccessTokengetExpiresAttributeType `json:"expires" required:"true"`
// An auto generated unique id which identifies the access token.
// REQUIRED
Id AccessTokenGetIdAttributeType `json:"id" required:"true"`
// The access permissions granted to the access token.
// REQUIRED
Permissions AccessTokenGetPermissionsAttributeType `json:"permissions" required:"true"`
// REQUIRED
Status AccessTokenGetStatusAttributeType `json:"status" required:"true"`
// The date and time util an access token is valid to (inclusively).
ValidUntil AccessTokenGetValidUntilAttributeType `json:"validUntil,omitempty"`
}
type _AccessToken AccessToken
// NewAccessToken instantiates a new AccessToken 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 NewAccessToken(creator AccessTokenGetCreatorArgType, displayName AccessTokenGetDisplayNameArgType, expires AccessTokengetExpiresArgType, id AccessTokenGetIdArgType, permissions AccessTokenGetPermissionsArgType, status AccessTokenGetStatusArgType) *AccessToken {
this := AccessToken{}
setAccessTokenGetCreatorAttributeType(&this.Creator, creator)
setAccessTokenGetDisplayNameAttributeType(&this.DisplayName, displayName)
setAccessTokengetExpiresAttributeType(&this.Expires, expires)
setAccessTokenGetIdAttributeType(&this.Id, id)
setAccessTokenGetPermissionsAttributeType(&this.Permissions, permissions)
setAccessTokenGetStatusAttributeType(&this.Status, status)
return &this
}
// NewAccessTokenWithDefaults instantiates a new AccessToken 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 NewAccessTokenWithDefaults() *AccessToken {
this := AccessToken{}
return &this
}
// GetAccessToken returns the AccessToken field value if set, zero value otherwise.
func (o *AccessToken) GetAccessToken() (res AccessTokenGetAccessTokenRetType) {
res, _ = o.GetAccessTokenOk()
return
}
// GetAccessTokenOk returns a tuple with the AccessToken field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccessToken) GetAccessTokenOk() (ret AccessTokenGetAccessTokenRetType, ok bool) {
return getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken)
}
// HasAccessToken returns a boolean if a field has been set.
func (o *AccessToken) HasAccessToken() bool {
_, ok := o.GetAccessTokenOk()
return ok
}
// SetAccessToken gets a reference to the given string and assigns it to the AccessToken field.
func (o *AccessToken) SetAccessToken(v AccessTokenGetAccessTokenRetType) {
setAccessTokenGetAccessTokenAttributeType(&o.AccessToken, v)
}
// GetCreator returns the Creator field value
func (o *AccessToken) GetCreator() (ret AccessTokenGetCreatorRetType) {
ret, _ = o.GetCreatorOk()
return ret
}
// GetCreatorOk returns a tuple with the Creator field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetCreatorOk() (ret AccessTokenGetCreatorRetType, ok bool) {
return getAccessTokenGetCreatorAttributeTypeOk(o.Creator)
}
// SetCreator sets field value
func (o *AccessToken) SetCreator(v AccessTokenGetCreatorRetType) {
setAccessTokenGetCreatorAttributeType(&o.Creator, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *AccessToken) GetDescription() (res AccessTokenGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccessToken) GetDescriptionOk() (ret AccessTokenGetDescriptionRetType, ok bool) {
return getAccessTokenGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *AccessToken) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *AccessToken) SetDescription(v AccessTokenGetDescriptionRetType) {
setAccessTokenGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *AccessToken) GetDisplayName() (ret AccessTokenGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetDisplayNameOk() (ret AccessTokenGetDisplayNameRetType, ok bool) {
return getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *AccessToken) SetDisplayName(v AccessTokenGetDisplayNameRetType) {
setAccessTokenGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetExpires returns the Expires field value
func (o *AccessToken) GetExpires() (ret AccessTokengetExpiresRetType) {
ret, _ = o.GetExpiresOk()
return ret
}
// GetExpiresOk returns a tuple with the Expires field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetExpiresOk() (ret AccessTokengetExpiresRetType, ok bool) {
return getAccessTokengetExpiresAttributeTypeOk(o.Expires)
}
// SetExpires sets field value
func (o *AccessToken) SetExpires(v AccessTokengetExpiresRetType) {
setAccessTokengetExpiresAttributeType(&o.Expires, v)
}
// GetId returns the Id field value
func (o *AccessToken) GetId() (ret AccessTokenGetIdRetType) {
ret, _ = o.GetIdOk()
return ret
}
// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetIdOk() (ret AccessTokenGetIdRetType, ok bool) {
return getAccessTokenGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *AccessToken) SetId(v AccessTokenGetIdRetType) {
setAccessTokenGetIdAttributeType(&o.Id, v)
}
// GetPermissions returns the Permissions field value
func (o *AccessToken) GetPermissions() (ret AccessTokenGetPermissionsRetType) {
ret, _ = o.GetPermissionsOk()
return ret
}
// GetPermissionsOk returns a tuple with the Permissions field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetPermissionsOk() (ret AccessTokenGetPermissionsRetType, ok bool) {
return getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions)
}
// SetPermissions sets field value
func (o *AccessToken) SetPermissions(v AccessTokenGetPermissionsRetType) {
setAccessTokenGetPermissionsAttributeType(&o.Permissions, v)
}
// GetStatus returns the Status field value
func (o *AccessToken) GetStatus() (ret AccessTokenGetStatusRetType) {
ret, _ = o.GetStatusOk()
return ret
}
// GetStatusOk returns a tuple with the Status field value
// and a boolean to check if the value has been set.
func (o *AccessToken) GetStatusOk() (ret AccessTokenGetStatusRetType, ok bool) {
return getAccessTokenGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *AccessToken) SetStatus(v AccessTokenGetStatusRetType) {
setAccessTokenGetStatusAttributeType(&o.Status, v)
}
// GetValidUntil returns the ValidUntil field value if set, zero value otherwise.
func (o *AccessToken) GetValidUntil() (res AccessTokenGetValidUntilRetType) {
res, _ = o.GetValidUntilOk()
return
}
// GetValidUntilOk returns a tuple with the ValidUntil field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *AccessToken) GetValidUntilOk() (ret AccessTokenGetValidUntilRetType, ok bool) {
return getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil)
}
// HasValidUntil returns a boolean if a field has been set.
func (o *AccessToken) HasValidUntil() bool {
_, ok := o.GetValidUntilOk()
return ok
}
// SetValidUntil gets a reference to the given time.Time and assigns it to the ValidUntil field.
func (o *AccessToken) SetValidUntil(v AccessTokenGetValidUntilRetType) {
setAccessTokenGetValidUntilAttributeType(&o.ValidUntil, v)
}
func (o AccessToken) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAccessTokenGetAccessTokenAttributeTypeOk(o.AccessToken); ok {
toSerialize["AccessToken"] = val
}
if val, ok := getAccessTokenGetCreatorAttributeTypeOk(o.Creator); ok {
toSerialize["Creator"] = val
}
if val, ok := getAccessTokenGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getAccessTokenGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getAccessTokengetExpiresAttributeTypeOk(o.Expires); ok {
toSerialize["Expires"] = val
}
if val, ok := getAccessTokenGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getAccessTokenGetPermissionsAttributeTypeOk(o.Permissions); ok {
toSerialize["Permissions"] = val
}
if val, ok := getAccessTokenGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = val
}
if val, ok := getAccessTokenGetValidUntilAttributeTypeOk(o.ValidUntil); ok {
toSerialize["ValidUntil"] = val
}
return toSerialize, nil
}
type NullableAccessToken struct {
value *AccessToken
isSet bool
}
func (v NullableAccessToken) Get() *AccessToken {
return v.value
}
func (v *NullableAccessToken) Set(val *AccessToken) {
v.value = val
v.isSet = true
}
func (v NullableAccessToken) IsSet() bool {
return v.isSet
}
func (v *NullableAccessToken) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccessToken(val *AccessToken) *NullableAccessToken {
return &NullableAccessToken{value: val, isSet: true}
}
func (v NullableAccessToken) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccessToken) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the AccessTokenList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &AccessTokenList{}
/*
types and functions for tokens
*/
// isArray
type AccessTokenListGetTokensAttributeType = *[]AccessToken
type AccessTokenListGetTokensArgType = []AccessToken
type AccessTokenListGetTokensRetType = []AccessToken
func getAccessTokenListGetTokensAttributeTypeOk(arg AccessTokenListGetTokensAttributeType) (ret AccessTokenListGetTokensRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setAccessTokenListGetTokensAttributeType(arg *AccessTokenListGetTokensAttributeType, val AccessTokenListGetTokensRetType) {
*arg = &val
}
// AccessTokenList struct for AccessTokenList
type AccessTokenList struct {
// REQUIRED
Tokens AccessTokenListGetTokensAttributeType `json:"tokens" required:"true"`
}
type _AccessTokenList AccessTokenList
// NewAccessTokenList instantiates a new AccessTokenList 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 NewAccessTokenList(tokens AccessTokenListGetTokensArgType) *AccessTokenList {
this := AccessTokenList{}
setAccessTokenListGetTokensAttributeType(&this.Tokens, tokens)
return &this
}
// NewAccessTokenListWithDefaults instantiates a new AccessTokenList 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 NewAccessTokenListWithDefaults() *AccessTokenList {
this := AccessTokenList{}
return &this
}
// GetTokens returns the Tokens field value
func (o *AccessTokenList) GetTokens() (ret AccessTokenListGetTokensRetType) {
ret, _ = o.GetTokensOk()
return ret
}
// GetTokensOk returns a tuple with the Tokens field value
// and a boolean to check if the value has been set.
func (o *AccessTokenList) GetTokensOk() (ret AccessTokenListGetTokensRetType, ok bool) {
return getAccessTokenListGetTokensAttributeTypeOk(o.Tokens)
}
// SetTokens sets field value
func (o *AccessTokenList) SetTokens(v AccessTokenListGetTokensRetType) {
setAccessTokenListGetTokensAttributeType(&o.Tokens, v)
}
func (o AccessTokenList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getAccessTokenListGetTokensAttributeTypeOk(o.Tokens); ok {
toSerialize["Tokens"] = val
}
return toSerialize, nil
}
type NullableAccessTokenList struct {
value *AccessTokenList
isSet bool
}
func (v NullableAccessTokenList) Get() *AccessTokenList {
return v.value
}
func (v *NullableAccessTokenList) Set(val *AccessTokenList) {
v.value = val
v.isSet = true
}
func (v NullableAccessTokenList) IsSet() bool {
return v.isSet
}
func (v *NullableAccessTokenList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableAccessTokenList(val *AccessTokenList) *NullableAccessTokenList {
return &NullableAccessTokenList{value: val, isSet: true}
}
func (v NullableAccessTokenList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableAccessTokenList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

View file

@ -0,0 +1,58 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"testing"
)
// isEnum
func TestAccessTokenStatus_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"active"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"expired"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := AccessTokenStatus("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

View file

@ -0,0 +1,269 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the CreateAccessTokenPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateAccessTokenPayload{}
/*
types and functions for description
*/
// isNotNullableString
type CreateAccessTokenPayloadGetDescriptionAttributeType = *string
func getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg CreateAccessTokenPayloadGetDescriptionAttributeType) (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAccessTokenPayloadGetDescriptionAttributeType(arg *CreateAccessTokenPayloadGetDescriptionAttributeType, val CreateAccessTokenPayloadGetDescriptionRetType) {
*arg = &val
}
type CreateAccessTokenPayloadGetDescriptionArgType = string
type CreateAccessTokenPayloadGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type CreateAccessTokenPayloadGetDisplayNameAttributeType = *string
func getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg CreateAccessTokenPayloadGetDisplayNameAttributeType) (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAccessTokenPayloadGetDisplayNameAttributeType(arg *CreateAccessTokenPayloadGetDisplayNameAttributeType, val CreateAccessTokenPayloadGetDisplayNameRetType) {
*arg = &val
}
type CreateAccessTokenPayloadGetDisplayNameArgType = string
type CreateAccessTokenPayloadGetDisplayNameRetType = string
/*
types and functions for lifetime
*/
// isInteger
type CreateAccessTokenPayloadGetLifetimeAttributeType = *int64
type CreateAccessTokenPayloadGetLifetimeArgType = int64
type CreateAccessTokenPayloadGetLifetimeRetType = int64
func getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(arg CreateAccessTokenPayloadGetLifetimeAttributeType) (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAccessTokenPayloadGetLifetimeAttributeType(arg *CreateAccessTokenPayloadGetLifetimeAttributeType, val CreateAccessTokenPayloadGetLifetimeRetType) {
*arg = &val
}
/*
types and functions for permissions
*/
// isArray
type CreateAccessTokenPayloadGetPermissionsAttributeType = *[]string
type CreateAccessTokenPayloadGetPermissionsArgType = []string
type CreateAccessTokenPayloadGetPermissionsRetType = []string
func getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(arg CreateAccessTokenPayloadGetPermissionsAttributeType) (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateAccessTokenPayloadGetPermissionsAttributeType(arg *CreateAccessTokenPayloadGetPermissionsAttributeType, val CreateAccessTokenPayloadGetPermissionsRetType) {
*arg = &val
}
// CreateAccessTokenPayload struct for CreateAccessTokenPayload
type CreateAccessTokenPayload struct {
// The description of the access token.
Description CreateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name of the access token.
// REQUIRED
DisplayName CreateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName" required:"true"`
// A lifetime period for an access token in days. If unset the token will not expire.
// Can be cast to int32 without loss of precision.
Lifetime CreateAccessTokenPayloadGetLifetimeAttributeType `json:"lifetime,omitempty"`
// The access permissions granted to the access token.
// REQUIRED
Permissions CreateAccessTokenPayloadGetPermissionsAttributeType `json:"permissions" required:"true"`
}
type _CreateAccessTokenPayload CreateAccessTokenPayload
// NewCreateAccessTokenPayload instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayload(displayName CreateAccessTokenPayloadGetDisplayNameArgType, permissions CreateAccessTokenPayloadGetPermissionsArgType) *CreateAccessTokenPayload {
this := CreateAccessTokenPayload{}
setCreateAccessTokenPayloadGetDisplayNameAttributeType(&this.DisplayName, displayName)
setCreateAccessTokenPayloadGetPermissionsAttributeType(&this.Permissions, permissions)
return &this
}
// NewCreateAccessTokenPayloadWithDefaults instantiates a new CreateAccessTokenPayload 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 NewCreateAccessTokenPayloadWithDefaults() *CreateAccessTokenPayload {
this := CreateAccessTokenPayload{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *CreateAccessTokenPayload) GetDescription() (res CreateAccessTokenPayloadGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateAccessTokenPayload) GetDescriptionOk() (ret CreateAccessTokenPayloadGetDescriptionRetType, ok bool) {
return getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *CreateAccessTokenPayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *CreateAccessTokenPayload) SetDescription(v CreateAccessTokenPayloadGetDescriptionRetType) {
setCreateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *CreateAccessTokenPayload) GetDisplayName() (ret CreateAccessTokenPayloadGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *CreateAccessTokenPayload) GetDisplayNameOk() (ret CreateAccessTokenPayloadGetDisplayNameRetType, ok bool) {
return getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *CreateAccessTokenPayload) SetDisplayName(v CreateAccessTokenPayloadGetDisplayNameRetType) {
setCreateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetLifetime returns the Lifetime field value if set, zero value otherwise.
func (o *CreateAccessTokenPayload) GetLifetime() (res CreateAccessTokenPayloadGetLifetimeRetType) {
res, _ = o.GetLifetimeOk()
return
}
// GetLifetimeOk returns a tuple with the Lifetime field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateAccessTokenPayload) GetLifetimeOk() (ret CreateAccessTokenPayloadGetLifetimeRetType, ok bool) {
return getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime)
}
// HasLifetime returns a boolean if a field has been set.
func (o *CreateAccessTokenPayload) HasLifetime() bool {
_, ok := o.GetLifetimeOk()
return ok
}
// SetLifetime gets a reference to the given int64 and assigns it to the Lifetime field.
func (o *CreateAccessTokenPayload) SetLifetime(v CreateAccessTokenPayloadGetLifetimeRetType) {
setCreateAccessTokenPayloadGetLifetimeAttributeType(&o.Lifetime, v)
}
// GetPermissions returns the Permissions field value
func (o *CreateAccessTokenPayload) GetPermissions() (ret CreateAccessTokenPayloadGetPermissionsRetType) {
ret, _ = o.GetPermissionsOk()
return ret
}
// GetPermissionsOk returns a tuple with the Permissions field value
// and a boolean to check if the value has been set.
func (o *CreateAccessTokenPayload) GetPermissionsOk() (ret CreateAccessTokenPayloadGetPermissionsRetType, ok bool) {
return getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions)
}
// SetPermissions sets field value
func (o *CreateAccessTokenPayload) SetPermissions(v CreateAccessTokenPayloadGetPermissionsRetType) {
setCreateAccessTokenPayloadGetPermissionsAttributeType(&o.Permissions, v)
}
func (o CreateAccessTokenPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getCreateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getCreateAccessTokenPayloadGetLifetimeAttributeTypeOk(o.Lifetime); ok {
toSerialize["Lifetime"] = val
}
if val, ok := getCreateAccessTokenPayloadGetPermissionsAttributeTypeOk(o.Permissions); ok {
toSerialize["Permissions"] = val
}
return toSerialize, nil
}
type NullableCreateAccessTokenPayload struct {
value *CreateAccessTokenPayload
isSet bool
}
func (v NullableCreateAccessTokenPayload) Get() *CreateAccessTokenPayload {
return v.value
}
func (v *NullableCreateAccessTokenPayload) Set(val *CreateAccessTokenPayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateAccessTokenPayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateAccessTokenPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateAccessTokenPayload(val *CreateAccessTokenPayload) *NullableCreateAccessTokenPayload {
return &NullableCreateAccessTokenPayload{value: val, isSet: true}
}
func (v NullableCreateAccessTokenPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateAccessTokenPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

View file

@ -0,0 +1,269 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the CreateLogsInstancePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateLogsInstancePayload{}
/*
types and functions for acl
*/
// isArray
type CreateLogsInstancePayloadGetAclAttributeType = *[]string
type CreateLogsInstancePayloadGetAclArgType = []string
type CreateLogsInstancePayloadGetAclRetType = []string
func getCreateLogsInstancePayloadGetAclAttributeTypeOk(arg CreateLogsInstancePayloadGetAclAttributeType) (ret CreateLogsInstancePayloadGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateLogsInstancePayloadGetAclAttributeType(arg *CreateLogsInstancePayloadGetAclAttributeType, val CreateLogsInstancePayloadGetAclRetType) {
*arg = &val
}
/*
types and functions for description
*/
// isNotNullableString
type CreateLogsInstancePayloadGetDescriptionAttributeType = *string
func getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg CreateLogsInstancePayloadGetDescriptionAttributeType) (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateLogsInstancePayloadGetDescriptionAttributeType(arg *CreateLogsInstancePayloadGetDescriptionAttributeType, val CreateLogsInstancePayloadGetDescriptionRetType) {
*arg = &val
}
type CreateLogsInstancePayloadGetDescriptionArgType = string
type CreateLogsInstancePayloadGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type CreateLogsInstancePayloadGetDisplayNameAttributeType = *string
func getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateLogsInstancePayloadGetDisplayNameAttributeType) (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateLogsInstancePayloadGetDisplayNameAttributeType(arg *CreateLogsInstancePayloadGetDisplayNameAttributeType, val CreateLogsInstancePayloadGetDisplayNameRetType) {
*arg = &val
}
type CreateLogsInstancePayloadGetDisplayNameArgType = string
type CreateLogsInstancePayloadGetDisplayNameRetType = string
/*
types and functions for retentionDays
*/
// isInteger
type CreateLogsInstancePayloadGetRetentionDaysAttributeType = *int64
type CreateLogsInstancePayloadGetRetentionDaysArgType = int64
type CreateLogsInstancePayloadGetRetentionDaysRetType = int64
func getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg CreateLogsInstancePayloadGetRetentionDaysAttributeType) (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setCreateLogsInstancePayloadGetRetentionDaysAttributeType(arg *CreateLogsInstancePayloadGetRetentionDaysAttributeType, val CreateLogsInstancePayloadGetRetentionDaysRetType) {
*arg = &val
}
// CreateLogsInstancePayload struct for CreateLogsInstancePayload
type CreateLogsInstancePayload struct {
// The access control list for the Logs instance.
Acl CreateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"`
// The description of the access token.
Description CreateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name to distinguish multiple Logs instances.
// REQUIRED
DisplayName CreateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"`
// The log retention time in days.
// Can be cast to int32 without loss of precision.
// REQUIRED
RetentionDays CreateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays" required:"true"`
}
type _CreateLogsInstancePayload CreateLogsInstancePayload
// NewCreateLogsInstancePayload instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayload(displayName CreateLogsInstancePayloadGetDisplayNameArgType, retentionDays CreateLogsInstancePayloadGetRetentionDaysArgType) *CreateLogsInstancePayload {
this := CreateLogsInstancePayload{}
setCreateLogsInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName)
setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays)
return &this
}
// NewCreateLogsInstancePayloadWithDefaults instantiates a new CreateLogsInstancePayload 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 NewCreateLogsInstancePayloadWithDefaults() *CreateLogsInstancePayload {
this := CreateLogsInstancePayload{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise.
func (o *CreateLogsInstancePayload) GetAcl() (res CreateLogsInstancePayloadGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateLogsInstancePayload) GetAclOk() (ret CreateLogsInstancePayloadGetAclRetType, ok bool) {
return getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *CreateLogsInstancePayload) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *CreateLogsInstancePayload) SetAcl(v CreateLogsInstancePayloadGetAclRetType) {
setCreateLogsInstancePayloadGetAclAttributeType(&o.Acl, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *CreateLogsInstancePayload) GetDescription() (res CreateLogsInstancePayloadGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CreateLogsInstancePayload) GetDescriptionOk() (ret CreateLogsInstancePayloadGetDescriptionRetType, ok bool) {
return getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *CreateLogsInstancePayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *CreateLogsInstancePayload) SetDescription(v CreateLogsInstancePayloadGetDescriptionRetType) {
setCreateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *CreateLogsInstancePayload) GetDisplayName() (ret CreateLogsInstancePayloadGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *CreateLogsInstancePayload) GetDisplayNameOk() (ret CreateLogsInstancePayloadGetDisplayNameRetType, ok bool) {
return getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *CreateLogsInstancePayload) SetDisplayName(v CreateLogsInstancePayloadGetDisplayNameRetType) {
setCreateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetRetentionDays returns the RetentionDays field value
func (o *CreateLogsInstancePayload) GetRetentionDays() (ret CreateLogsInstancePayloadGetRetentionDaysRetType) {
ret, _ = o.GetRetentionDaysOk()
return ret
}
// GetRetentionDaysOk returns a tuple with the RetentionDays field value
// and a boolean to check if the value has been set.
func (o *CreateLogsInstancePayload) GetRetentionDaysOk() (ret CreateLogsInstancePayloadGetRetentionDaysRetType, ok bool) {
return getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays)
}
// SetRetentionDays sets field value
func (o *CreateLogsInstancePayload) SetRetentionDays(v CreateLogsInstancePayloadGetRetentionDaysRetType) {
setCreateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v)
}
func (o CreateLogsInstancePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getCreateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getCreateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getCreateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getCreateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok {
toSerialize["RetentionDays"] = val
}
return toSerialize, nil
}
type NullableCreateLogsInstancePayload struct {
value *CreateLogsInstancePayload
isSet bool
}
func (v NullableCreateLogsInstancePayload) Get() *CreateLogsInstancePayload {
return v.value
}
func (v *NullableCreateLogsInstancePayload) Set(val *CreateLogsInstancePayload) {
v.value = val
v.isSet = true
}
func (v NullableCreateLogsInstancePayload) IsSet() bool {
return v.isSet
}
func (v *NullableCreateLogsInstancePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableCreateLogsInstancePayload(val *CreateLogsInstancePayload) *NullableCreateLogsInstancePayload {
return &NullableCreateLogsInstancePayload{value: val, isSet: true}
}
func (v NullableCreateLogsInstancePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableCreateLogsInstancePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

View file

@ -0,0 +1,755 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
"fmt"
"time"
)
// checks if the LogsInstance type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LogsInstance{}
/*
types and functions for acl
*/
// isArray
type LogsInstanceGetAclAttributeType = *[]string
type LogsInstanceGetAclArgType = []string
type LogsInstanceGetAclRetType = []string
func getLogsInstanceGetAclAttributeTypeOk(arg LogsInstanceGetAclAttributeType) (ret LogsInstanceGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetAclAttributeType(arg *LogsInstanceGetAclAttributeType, val LogsInstanceGetAclRetType) {
*arg = &val
}
/*
types and functions for created
*/
// isDateTime
type LogsInstanceGetCreatedAttributeType = *time.Time
type LogsInstanceGetCreatedArgType = time.Time
type LogsInstanceGetCreatedRetType = time.Time
func getLogsInstanceGetCreatedAttributeTypeOk(arg LogsInstanceGetCreatedAttributeType) (ret LogsInstanceGetCreatedRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetCreatedAttributeType(arg *LogsInstanceGetCreatedAttributeType, val LogsInstanceGetCreatedRetType) {
*arg = &val
}
/*
types and functions for datasourceUrl
*/
// isNotNullableString
type LogsInstanceGetDatasourceUrlAttributeType = *string
func getLogsInstanceGetDatasourceUrlAttributeTypeOk(arg LogsInstanceGetDatasourceUrlAttributeType) (ret LogsInstanceGetDatasourceUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetDatasourceUrlAttributeType(arg *LogsInstanceGetDatasourceUrlAttributeType, val LogsInstanceGetDatasourceUrlRetType) {
*arg = &val
}
type LogsInstanceGetDatasourceUrlArgType = string
type LogsInstanceGetDatasourceUrlRetType = string
/*
types and functions for description
*/
// isNotNullableString
type LogsInstanceGetDescriptionAttributeType = *string
func getLogsInstanceGetDescriptionAttributeTypeOk(arg LogsInstanceGetDescriptionAttributeType) (ret LogsInstanceGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetDescriptionAttributeType(arg *LogsInstanceGetDescriptionAttributeType, val LogsInstanceGetDescriptionRetType) {
*arg = &val
}
type LogsInstanceGetDescriptionArgType = string
type LogsInstanceGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type LogsInstanceGetDisplayNameAttributeType = *string
func getLogsInstanceGetDisplayNameAttributeTypeOk(arg LogsInstanceGetDisplayNameAttributeType) (ret LogsInstanceGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetDisplayNameAttributeType(arg *LogsInstanceGetDisplayNameAttributeType, val LogsInstanceGetDisplayNameRetType) {
*arg = &val
}
type LogsInstanceGetDisplayNameArgType = string
type LogsInstanceGetDisplayNameRetType = string
/*
types and functions for id
*/
// isNotNullableString
type LogsInstanceGetIdAttributeType = *string
func getLogsInstanceGetIdAttributeTypeOk(arg LogsInstanceGetIdAttributeType) (ret LogsInstanceGetIdRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetIdAttributeType(arg *LogsInstanceGetIdAttributeType, val LogsInstanceGetIdRetType) {
*arg = &val
}
type LogsInstanceGetIdArgType = string
type LogsInstanceGetIdRetType = string
/*
types and functions for ingestOtlpUrl
*/
// isNotNullableString
type LogsInstanceGetIngestOtlpUrlAttributeType = *string
func getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(arg LogsInstanceGetIngestOtlpUrlAttributeType) (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetIngestOtlpUrlAttributeType(arg *LogsInstanceGetIngestOtlpUrlAttributeType, val LogsInstanceGetIngestOtlpUrlRetType) {
*arg = &val
}
type LogsInstanceGetIngestOtlpUrlArgType = string
type LogsInstanceGetIngestOtlpUrlRetType = string
/*
types and functions for ingestUrl
*/
// isNotNullableString
type LogsInstanceGetIngestUrlAttributeType = *string
func getLogsInstanceGetIngestUrlAttributeTypeOk(arg LogsInstanceGetIngestUrlAttributeType) (ret LogsInstanceGetIngestUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetIngestUrlAttributeType(arg *LogsInstanceGetIngestUrlAttributeType, val LogsInstanceGetIngestUrlRetType) {
*arg = &val
}
type LogsInstanceGetIngestUrlArgType = string
type LogsInstanceGetIngestUrlRetType = string
/*
types and functions for queryRangeUrl
*/
// isNotNullableString
type LogsInstanceGetQueryRangeUrlAttributeType = *string
func getLogsInstanceGetQueryRangeUrlAttributeTypeOk(arg LogsInstanceGetQueryRangeUrlAttributeType) (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetQueryRangeUrlAttributeType(arg *LogsInstanceGetQueryRangeUrlAttributeType, val LogsInstanceGetQueryRangeUrlRetType) {
*arg = &val
}
type LogsInstanceGetQueryRangeUrlArgType = string
type LogsInstanceGetQueryRangeUrlRetType = string
/*
types and functions for queryUrl
*/
// isNotNullableString
type LogsInstanceGetQueryUrlAttributeType = *string
func getLogsInstanceGetQueryUrlAttributeTypeOk(arg LogsInstanceGetQueryUrlAttributeType) (ret LogsInstanceGetQueryUrlRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetQueryUrlAttributeType(arg *LogsInstanceGetQueryUrlAttributeType, val LogsInstanceGetQueryUrlRetType) {
*arg = &val
}
type LogsInstanceGetQueryUrlArgType = string
type LogsInstanceGetQueryUrlRetType = string
/*
types and functions for retentionDays
*/
// isInteger
type LogsInstanceGetRetentionDaysAttributeType = *int64
type LogsInstanceGetRetentionDaysArgType = int64
type LogsInstanceGetRetentionDaysRetType = int64
func getLogsInstanceGetRetentionDaysAttributeTypeOk(arg LogsInstanceGetRetentionDaysAttributeType) (ret LogsInstanceGetRetentionDaysRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetRetentionDaysAttributeType(arg *LogsInstanceGetRetentionDaysAttributeType, val LogsInstanceGetRetentionDaysRetType) {
*arg = &val
}
/*
types and functions for status
*/
// isEnum
// LogsInstanceStatus The current status of the Logs instance.
// value type for enums
type LogsInstanceStatus string
// List of Status
const (
LOGSINSTANCESTATUS_ACTIVE LogsInstanceStatus = "active"
LOGSINSTANCESTATUS_DELETING LogsInstanceStatus = "deleting"
LOGSINSTANCESTATUS_RECONCILING LogsInstanceStatus = "reconciling"
)
// All allowed values of LogsInstance enum
var AllowedLogsInstanceStatusEnumValues = []LogsInstanceStatus{
"active",
"deleting",
"reconciling",
}
func (v *LogsInstanceStatus) UnmarshalJSON(src []byte) error {
// use a type alias to prevent infinite recursion during unmarshal,
// see https://biscuit.ninja/posts/go-avoid-an-infitine-loop-with-custom-json-unmarshallers
type TmpJson LogsInstanceStatus
var value TmpJson
err := json.Unmarshal(src, &value)
if err != nil {
return err
}
// Allow unmarshalling zero value for testing purposes
var zeroValue TmpJson
if value == zeroValue {
return nil
}
enumTypeValue := LogsInstanceStatus(value)
for _, existing := range AllowedLogsInstanceStatusEnumValues {
if existing == enumTypeValue {
*v = enumTypeValue
return nil
}
}
return fmt.Errorf("%+v is not a valid LogsInstance", value)
}
// NewLogsInstanceStatusFromValue returns a pointer to a valid LogsInstanceStatus
// for the value passed as argument, or an error if the value passed is not allowed by the enum
func NewLogsInstanceStatusFromValue(v LogsInstanceStatus) (*LogsInstanceStatus, error) {
ev := LogsInstanceStatus(v)
if ev.IsValid() {
return &ev, nil
} else {
return nil, fmt.Errorf("invalid value '%v' for LogsInstanceStatus: valid values are %v", v, AllowedLogsInstanceStatusEnumValues)
}
}
// IsValid return true if the value is valid for the enum, false otherwise
func (v LogsInstanceStatus) IsValid() bool {
for _, existing := range AllowedLogsInstanceStatusEnumValues {
if existing == v {
return true
}
}
return false
}
// Ptr returns reference to StatusStatus value
func (v LogsInstanceStatus) Ptr() *LogsInstanceStatus {
return &v
}
type NullableLogsInstanceStatus struct {
value *LogsInstanceStatus
isSet bool
}
func (v NullableLogsInstanceStatus) Get() *LogsInstanceStatus {
return v.value
}
func (v *NullableLogsInstanceStatus) Set(val *LogsInstanceStatus) {
v.value = val
v.isSet = true
}
func (v NullableLogsInstanceStatus) IsSet() bool {
return v.isSet
}
func (v *NullableLogsInstanceStatus) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLogsInstanceStatus(val *LogsInstanceStatus) *NullableLogsInstanceStatus {
return &NullableLogsInstanceStatus{value: val, isSet: true}
}
func (v NullableLogsInstanceStatus) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLogsInstanceStatus) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type LogsInstanceGetStatusAttributeType = *LogsInstanceStatus
type LogsInstanceGetStatusArgType = LogsInstanceStatus
type LogsInstanceGetStatusRetType = LogsInstanceStatus
func getLogsInstanceGetStatusAttributeTypeOk(arg LogsInstanceGetStatusAttributeType) (ret LogsInstanceGetStatusRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstanceGetStatusAttributeType(arg *LogsInstanceGetStatusAttributeType, val LogsInstanceGetStatusRetType) {
*arg = &val
}
// LogsInstance struct for LogsInstance
type LogsInstance struct {
// The access control list for the Logs instance.
Acl LogsInstanceGetAclAttributeType `json:"acl,omitempty"`
// The date and time the creation of the Logs instance was triggered.
// REQUIRED
Created LogsInstanceGetCreatedAttributeType `json:"created" required:"true"`
// The Logs instance's datasource URL, can be used in Grafana as a datasource URL
DatasourceUrl LogsInstanceGetDatasourceUrlAttributeType `json:"datasourceUrl,omitempty"`
// The description of the Logs instance.
Description LogsInstanceGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name of the Logs instance.
// REQUIRED
DisplayName LogsInstanceGetDisplayNameAttributeType `json:"displayName" required:"true"`
// A auto generated unique id which identifies the Logs instance.
// REQUIRED
Id LogsInstanceGetIdAttributeType `json:"id" required:"true"`
// The Logs instance's ingest logs via OTLP URL
IngestOtlpUrl LogsInstanceGetIngestOtlpUrlAttributeType `json:"ingestOtlpUrl,omitempty"`
// The Logs instance's ingest logs URL
IngestUrl LogsInstanceGetIngestUrlAttributeType `json:"ingestUrl,omitempty"`
// The Logs instance's query range URL
QueryRangeUrl LogsInstanceGetQueryRangeUrlAttributeType `json:"queryRangeUrl,omitempty"`
// The Logs instance's query URL
QueryUrl LogsInstanceGetQueryUrlAttributeType `json:"queryUrl,omitempty"`
// The log retention time in days.
// Can be cast to int32 without loss of precision.
// REQUIRED
RetentionDays LogsInstanceGetRetentionDaysAttributeType `json:"retentionDays" required:"true"`
// The current status of the Logs instance.
// REQUIRED
Status LogsInstanceGetStatusAttributeType `json:"status" required:"true"`
}
type _LogsInstance LogsInstance
// NewLogsInstance instantiates a new LogsInstance 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 NewLogsInstance(created LogsInstanceGetCreatedArgType, displayName LogsInstanceGetDisplayNameArgType, id LogsInstanceGetIdArgType, retentionDays LogsInstanceGetRetentionDaysArgType, status LogsInstanceGetStatusArgType) *LogsInstance {
this := LogsInstance{}
setLogsInstanceGetCreatedAttributeType(&this.Created, created)
setLogsInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName)
setLogsInstanceGetIdAttributeType(&this.Id, id)
setLogsInstanceGetRetentionDaysAttributeType(&this.RetentionDays, retentionDays)
setLogsInstanceGetStatusAttributeType(&this.Status, status)
return &this
}
// NewLogsInstanceWithDefaults instantiates a new LogsInstance 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 NewLogsInstanceWithDefaults() *LogsInstance {
this := LogsInstance{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise.
func (o *LogsInstance) GetAcl() (res LogsInstanceGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetAclOk() (ret LogsInstanceGetAclRetType, ok bool) {
return getLogsInstanceGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *LogsInstance) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *LogsInstance) SetAcl(v LogsInstanceGetAclRetType) {
setLogsInstanceGetAclAttributeType(&o.Acl, v)
}
// GetCreated returns the Created field value
func (o *LogsInstance) GetCreated() (ret LogsInstanceGetCreatedRetType) {
ret, _ = o.GetCreatedOk()
return ret
}
// GetCreatedOk returns a tuple with the Created field value
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetCreatedOk() (ret LogsInstanceGetCreatedRetType, ok bool) {
return getLogsInstanceGetCreatedAttributeTypeOk(o.Created)
}
// SetCreated sets field value
func (o *LogsInstance) SetCreated(v LogsInstanceGetCreatedRetType) {
setLogsInstanceGetCreatedAttributeType(&o.Created, v)
}
// GetDatasourceUrl returns the DatasourceUrl field value if set, zero value otherwise.
func (o *LogsInstance) GetDatasourceUrl() (res LogsInstanceGetDatasourceUrlRetType) {
res, _ = o.GetDatasourceUrlOk()
return
}
// GetDatasourceUrlOk returns a tuple with the DatasourceUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetDatasourceUrlOk() (ret LogsInstanceGetDatasourceUrlRetType, ok bool) {
return getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl)
}
// HasDatasourceUrl returns a boolean if a field has been set.
func (o *LogsInstance) HasDatasourceUrl() bool {
_, ok := o.GetDatasourceUrlOk()
return ok
}
// SetDatasourceUrl gets a reference to the given string and assigns it to the DatasourceUrl field.
func (o *LogsInstance) SetDatasourceUrl(v LogsInstanceGetDatasourceUrlRetType) {
setLogsInstanceGetDatasourceUrlAttributeType(&o.DatasourceUrl, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *LogsInstance) GetDescription() (res LogsInstanceGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetDescriptionOk() (ret LogsInstanceGetDescriptionRetType, ok bool) {
return getLogsInstanceGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *LogsInstance) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *LogsInstance) SetDescription(v LogsInstanceGetDescriptionRetType) {
setLogsInstanceGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value
func (o *LogsInstance) GetDisplayName() (ret LogsInstanceGetDisplayNameRetType) {
ret, _ = o.GetDisplayNameOk()
return ret
}
// GetDisplayNameOk returns a tuple with the DisplayName field value
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetDisplayNameOk() (ret LogsInstanceGetDisplayNameRetType, ok bool) {
return getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// SetDisplayName sets field value
func (o *LogsInstance) SetDisplayName(v LogsInstanceGetDisplayNameRetType) {
setLogsInstanceGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetId returns the Id field value
func (o *LogsInstance) GetId() (ret LogsInstanceGetIdRetType) {
ret, _ = o.GetIdOk()
return ret
}
// GetIdOk returns a tuple with the Id field value
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetIdOk() (ret LogsInstanceGetIdRetType, ok bool) {
return getLogsInstanceGetIdAttributeTypeOk(o.Id)
}
// SetId sets field value
func (o *LogsInstance) SetId(v LogsInstanceGetIdRetType) {
setLogsInstanceGetIdAttributeType(&o.Id, v)
}
// GetIngestOtlpUrl returns the IngestOtlpUrl field value if set, zero value otherwise.
func (o *LogsInstance) GetIngestOtlpUrl() (res LogsInstanceGetIngestOtlpUrlRetType) {
res, _ = o.GetIngestOtlpUrlOk()
return
}
// GetIngestOtlpUrlOk returns a tuple with the IngestOtlpUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetIngestOtlpUrlOk() (ret LogsInstanceGetIngestOtlpUrlRetType, ok bool) {
return getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl)
}
// HasIngestOtlpUrl returns a boolean if a field has been set.
func (o *LogsInstance) HasIngestOtlpUrl() bool {
_, ok := o.GetIngestOtlpUrlOk()
return ok
}
// SetIngestOtlpUrl gets a reference to the given string and assigns it to the IngestOtlpUrl field.
func (o *LogsInstance) SetIngestOtlpUrl(v LogsInstanceGetIngestOtlpUrlRetType) {
setLogsInstanceGetIngestOtlpUrlAttributeType(&o.IngestOtlpUrl, v)
}
// GetIngestUrl returns the IngestUrl field value if set, zero value otherwise.
func (o *LogsInstance) GetIngestUrl() (res LogsInstanceGetIngestUrlRetType) {
res, _ = o.GetIngestUrlOk()
return
}
// GetIngestUrlOk returns a tuple with the IngestUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetIngestUrlOk() (ret LogsInstanceGetIngestUrlRetType, ok bool) {
return getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl)
}
// HasIngestUrl returns a boolean if a field has been set.
func (o *LogsInstance) HasIngestUrl() bool {
_, ok := o.GetIngestUrlOk()
return ok
}
// SetIngestUrl gets a reference to the given string and assigns it to the IngestUrl field.
func (o *LogsInstance) SetIngestUrl(v LogsInstanceGetIngestUrlRetType) {
setLogsInstanceGetIngestUrlAttributeType(&o.IngestUrl, v)
}
// GetQueryRangeUrl returns the QueryRangeUrl field value if set, zero value otherwise.
func (o *LogsInstance) GetQueryRangeUrl() (res LogsInstanceGetQueryRangeUrlRetType) {
res, _ = o.GetQueryRangeUrlOk()
return
}
// GetQueryRangeUrlOk returns a tuple with the QueryRangeUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetQueryRangeUrlOk() (ret LogsInstanceGetQueryRangeUrlRetType, ok bool) {
return getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl)
}
// HasQueryRangeUrl returns a boolean if a field has been set.
func (o *LogsInstance) HasQueryRangeUrl() bool {
_, ok := o.GetQueryRangeUrlOk()
return ok
}
// SetQueryRangeUrl gets a reference to the given string and assigns it to the QueryRangeUrl field.
func (o *LogsInstance) SetQueryRangeUrl(v LogsInstanceGetQueryRangeUrlRetType) {
setLogsInstanceGetQueryRangeUrlAttributeType(&o.QueryRangeUrl, v)
}
// GetQueryUrl returns the QueryUrl field value if set, zero value otherwise.
func (o *LogsInstance) GetQueryUrl() (res LogsInstanceGetQueryUrlRetType) {
res, _ = o.GetQueryUrlOk()
return
}
// GetQueryUrlOk returns a tuple with the QueryUrl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetQueryUrlOk() (ret LogsInstanceGetQueryUrlRetType, ok bool) {
return getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl)
}
// HasQueryUrl returns a boolean if a field has been set.
func (o *LogsInstance) HasQueryUrl() bool {
_, ok := o.GetQueryUrlOk()
return ok
}
// SetQueryUrl gets a reference to the given string and assigns it to the QueryUrl field.
func (o *LogsInstance) SetQueryUrl(v LogsInstanceGetQueryUrlRetType) {
setLogsInstanceGetQueryUrlAttributeType(&o.QueryUrl, v)
}
// GetRetentionDays returns the RetentionDays field value
func (o *LogsInstance) GetRetentionDays() (ret LogsInstanceGetRetentionDaysRetType) {
ret, _ = o.GetRetentionDaysOk()
return ret
}
// GetRetentionDaysOk returns a tuple with the RetentionDays field value
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetRetentionDaysOk() (ret LogsInstanceGetRetentionDaysRetType, ok bool) {
return getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays)
}
// SetRetentionDays sets field value
func (o *LogsInstance) SetRetentionDays(v LogsInstanceGetRetentionDaysRetType) {
setLogsInstanceGetRetentionDaysAttributeType(&o.RetentionDays, v)
}
// GetStatus returns the Status field value
func (o *LogsInstance) GetStatus() (ret LogsInstanceGetStatusRetType) {
ret, _ = o.GetStatusOk()
return ret
}
// GetStatusOk returns a tuple with the Status field value
// and a boolean to check if the value has been set.
func (o *LogsInstance) GetStatusOk() (ret LogsInstanceGetStatusRetType, ok bool) {
return getLogsInstanceGetStatusAttributeTypeOk(o.Status)
}
// SetStatus sets field value
func (o *LogsInstance) SetStatus(v LogsInstanceGetStatusRetType) {
setLogsInstanceGetStatusAttributeType(&o.Status, v)
}
func (o LogsInstance) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getLogsInstanceGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getLogsInstanceGetCreatedAttributeTypeOk(o.Created); ok {
toSerialize["Created"] = val
}
if val, ok := getLogsInstanceGetDatasourceUrlAttributeTypeOk(o.DatasourceUrl); ok {
toSerialize["DatasourceUrl"] = val
}
if val, ok := getLogsInstanceGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getLogsInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getLogsInstanceGetIdAttributeTypeOk(o.Id); ok {
toSerialize["Id"] = val
}
if val, ok := getLogsInstanceGetIngestOtlpUrlAttributeTypeOk(o.IngestOtlpUrl); ok {
toSerialize["IngestOtlpUrl"] = val
}
if val, ok := getLogsInstanceGetIngestUrlAttributeTypeOk(o.IngestUrl); ok {
toSerialize["IngestUrl"] = val
}
if val, ok := getLogsInstanceGetQueryRangeUrlAttributeTypeOk(o.QueryRangeUrl); ok {
toSerialize["QueryRangeUrl"] = val
}
if val, ok := getLogsInstanceGetQueryUrlAttributeTypeOk(o.QueryUrl); ok {
toSerialize["QueryUrl"] = val
}
if val, ok := getLogsInstanceGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok {
toSerialize["RetentionDays"] = val
}
if val, ok := getLogsInstanceGetStatusAttributeTypeOk(o.Status); ok {
toSerialize["Status"] = val
}
return toSerialize, nil
}
type NullableLogsInstance struct {
value *LogsInstance
isSet bool
}
func (v NullableLogsInstance) Get() *LogsInstance {
return v.value
}
func (v *NullableLogsInstance) Set(val *LogsInstance) {
v.value = val
v.isSet = true
}
func (v NullableLogsInstance) IsSet() bool {
return v.isSet
}
func (v *NullableLogsInstance) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLogsInstance(val *LogsInstance) *NullableLogsInstance {
return &NullableLogsInstance{value: val, isSet: true}
}
func (v NullableLogsInstance) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLogsInstance) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,65 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"testing"
)
// isEnum
func TestLogsInstanceStatus_UnmarshalJSON(t *testing.T) {
type args struct {
src []byte
}
tests := []struct {
name string
args args
wantErr bool
}{
{
name: `success - possible enum value no. 1`,
args: args{
src: []byte(`"active"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 2`,
args: args{
src: []byte(`"deleting"`),
},
wantErr: false,
},
{
name: `success - possible enum value no. 3`,
args: args{
src: []byte(`"reconciling"`),
},
wantErr: false,
},
{
name: "fail",
args: args{
src: []byte("\"FOOBAR\""),
},
wantErr: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := LogsInstanceStatus("")
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
}
})
}
}

View file

@ -0,0 +1,125 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the LogsInstancesList type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &LogsInstancesList{}
/*
types and functions for instances
*/
// isArray
type LogsInstancesListGetInstancesAttributeType = *[]LogsInstance
type LogsInstancesListGetInstancesArgType = []LogsInstance
type LogsInstancesListGetInstancesRetType = []LogsInstance
func getLogsInstancesListGetInstancesAttributeTypeOk(arg LogsInstancesListGetInstancesAttributeType) (ret LogsInstancesListGetInstancesRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setLogsInstancesListGetInstancesAttributeType(arg *LogsInstancesListGetInstancesAttributeType, val LogsInstancesListGetInstancesRetType) {
*arg = &val
}
// LogsInstancesList struct for LogsInstancesList
type LogsInstancesList struct {
// REQUIRED
Instances LogsInstancesListGetInstancesAttributeType `json:"instances" required:"true"`
}
type _LogsInstancesList LogsInstancesList
// NewLogsInstancesList instantiates a new LogsInstancesList 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 NewLogsInstancesList(instances LogsInstancesListGetInstancesArgType) *LogsInstancesList {
this := LogsInstancesList{}
setLogsInstancesListGetInstancesAttributeType(&this.Instances, instances)
return &this
}
// NewLogsInstancesListWithDefaults instantiates a new LogsInstancesList 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 NewLogsInstancesListWithDefaults() *LogsInstancesList {
this := LogsInstancesList{}
return &this
}
// GetInstances returns the Instances field value
func (o *LogsInstancesList) GetInstances() (ret LogsInstancesListGetInstancesRetType) {
ret, _ = o.GetInstancesOk()
return ret
}
// GetInstancesOk returns a tuple with the Instances field value
// and a boolean to check if the value has been set.
func (o *LogsInstancesList) GetInstancesOk() (ret LogsInstancesListGetInstancesRetType, ok bool) {
return getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances)
}
// SetInstances sets field value
func (o *LogsInstancesList) SetInstances(v LogsInstancesListGetInstancesRetType) {
setLogsInstancesListGetInstancesAttributeType(&o.Instances, v)
}
func (o LogsInstancesList) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getLogsInstancesListGetInstancesAttributeTypeOk(o.Instances); ok {
toSerialize["Instances"] = val
}
return toSerialize, nil
}
type NullableLogsInstancesList struct {
value *LogsInstancesList
isSet bool
}
func (v NullableLogsInstancesList) Get() *LogsInstancesList {
return v.value
}
func (v *NullableLogsInstancesList) Set(val *LogsInstancesList) {
v.value = val
v.isSet = true
}
func (v NullableLogsInstancesList) IsSet() bool {
return v.isSet
}
func (v *NullableLogsInstancesList) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLogsInstancesList(val *LogsInstancesList) *NullableLogsInstancesList {
return &NullableLogsInstancesList{value: val, isSet: true}
}
func (v NullableLogsInstancesList) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLogsInstancesList) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

View file

@ -0,0 +1,178 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the UpdateAccessTokenPayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateAccessTokenPayload{}
/*
types and functions for description
*/
// isNotNullableString
type UpdateAccessTokenPayloadGetDescriptionAttributeType = *string
func getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(arg UpdateAccessTokenPayloadGetDescriptionAttributeType) (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateAccessTokenPayloadGetDescriptionAttributeType(arg *UpdateAccessTokenPayloadGetDescriptionAttributeType, val UpdateAccessTokenPayloadGetDescriptionRetType) {
*arg = &val
}
type UpdateAccessTokenPayloadGetDescriptionArgType = string
type UpdateAccessTokenPayloadGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type UpdateAccessTokenPayloadGetDisplayNameAttributeType = *string
func getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(arg UpdateAccessTokenPayloadGetDisplayNameAttributeType) (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateAccessTokenPayloadGetDisplayNameAttributeType(arg *UpdateAccessTokenPayloadGetDisplayNameAttributeType, val UpdateAccessTokenPayloadGetDisplayNameRetType) {
*arg = &val
}
type UpdateAccessTokenPayloadGetDisplayNameArgType = string
type UpdateAccessTokenPayloadGetDisplayNameRetType = string
// UpdateAccessTokenPayload struct for UpdateAccessTokenPayload
type UpdateAccessTokenPayload struct {
// The description of the access token.
Description UpdateAccessTokenPayloadGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name of the access token.
DisplayName UpdateAccessTokenPayloadGetDisplayNameAttributeType `json:"displayName,omitempty"`
}
// NewUpdateAccessTokenPayload instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayload() *UpdateAccessTokenPayload {
this := UpdateAccessTokenPayload{}
return &this
}
// NewUpdateAccessTokenPayloadWithDefaults instantiates a new UpdateAccessTokenPayload 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 NewUpdateAccessTokenPayloadWithDefaults() *UpdateAccessTokenPayload {
this := UpdateAccessTokenPayload{}
return &this
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *UpdateAccessTokenPayload) GetDescription() (res UpdateAccessTokenPayloadGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateAccessTokenPayload) GetDescriptionOk() (ret UpdateAccessTokenPayloadGetDescriptionRetType, ok bool) {
return getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *UpdateAccessTokenPayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *UpdateAccessTokenPayload) SetDescription(v UpdateAccessTokenPayloadGetDescriptionRetType) {
setUpdateAccessTokenPayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value if set, zero value otherwise.
func (o *UpdateAccessTokenPayload) GetDisplayName() (res UpdateAccessTokenPayloadGetDisplayNameRetType) {
res, _ = o.GetDisplayNameOk()
return
}
// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateAccessTokenPayload) GetDisplayNameOk() (ret UpdateAccessTokenPayloadGetDisplayNameRetType, ok bool) {
return getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// HasDisplayName returns a boolean if a field has been set.
func (o *UpdateAccessTokenPayload) HasDisplayName() bool {
_, ok := o.GetDisplayNameOk()
return ok
}
// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field.
func (o *UpdateAccessTokenPayload) SetDisplayName(v UpdateAccessTokenPayloadGetDisplayNameRetType) {
setUpdateAccessTokenPayloadGetDisplayNameAttributeType(&o.DisplayName, v)
}
func (o UpdateAccessTokenPayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateAccessTokenPayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getUpdateAccessTokenPayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
return toSerialize, nil
}
type NullableUpdateAccessTokenPayload struct {
value *UpdateAccessTokenPayload
isSet bool
}
func (v NullableUpdateAccessTokenPayload) Get() *UpdateAccessTokenPayload {
return v.value
}
func (v *NullableUpdateAccessTokenPayload) Set(val *UpdateAccessTokenPayload) {
v.value = val
v.isSet = true
}
func (v NullableUpdateAccessTokenPayload) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateAccessTokenPayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateAccessTokenPayload(val *UpdateAccessTokenPayload) *NullableUpdateAccessTokenPayload {
return &NullableUpdateAccessTokenPayload{value: val, isSet: true}
}
func (v NullableUpdateAccessTokenPayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateAccessTokenPayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

View file

@ -0,0 +1,275 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
)
// checks if the UpdateLogsInstancePayload type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &UpdateLogsInstancePayload{}
/*
types and functions for acl
*/
// isArray
type UpdateLogsInstancePayloadGetAclAttributeType = *[]string
type UpdateLogsInstancePayloadGetAclArgType = []string
type UpdateLogsInstancePayloadGetAclRetType = []string
func getUpdateLogsInstancePayloadGetAclAttributeTypeOk(arg UpdateLogsInstancePayloadGetAclAttributeType) (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateLogsInstancePayloadGetAclAttributeType(arg *UpdateLogsInstancePayloadGetAclAttributeType, val UpdateLogsInstancePayloadGetAclRetType) {
*arg = &val
}
/*
types and functions for description
*/
// isNotNullableString
type UpdateLogsInstancePayloadGetDescriptionAttributeType = *string
func getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateLogsInstancePayloadGetDescriptionAttributeType) (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateLogsInstancePayloadGetDescriptionAttributeType(arg *UpdateLogsInstancePayloadGetDescriptionAttributeType, val UpdateLogsInstancePayloadGetDescriptionRetType) {
*arg = &val
}
type UpdateLogsInstancePayloadGetDescriptionArgType = string
type UpdateLogsInstancePayloadGetDescriptionRetType = string
/*
types and functions for displayName
*/
// isNotNullableString
type UpdateLogsInstancePayloadGetDisplayNameAttributeType = *string
func getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(arg UpdateLogsInstancePayloadGetDisplayNameAttributeType) (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateLogsInstancePayloadGetDisplayNameAttributeType(arg *UpdateLogsInstancePayloadGetDisplayNameAttributeType, val UpdateLogsInstancePayloadGetDisplayNameRetType) {
*arg = &val
}
type UpdateLogsInstancePayloadGetDisplayNameArgType = string
type UpdateLogsInstancePayloadGetDisplayNameRetType = string
/*
types and functions for retentionDays
*/
// isInteger
type UpdateLogsInstancePayloadGetRetentionDaysAttributeType = *int64
type UpdateLogsInstancePayloadGetRetentionDaysArgType = int64
type UpdateLogsInstancePayloadGetRetentionDaysRetType = int64
func getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(arg UpdateLogsInstancePayloadGetRetentionDaysAttributeType) (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) {
if arg == nil {
return ret, false
}
return *arg, true
}
func setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(arg *UpdateLogsInstancePayloadGetRetentionDaysAttributeType, val UpdateLogsInstancePayloadGetRetentionDaysRetType) {
*arg = &val
}
// UpdateLogsInstancePayload struct for UpdateLogsInstancePayload
type UpdateLogsInstancePayload struct {
// The access control list for the Logs instance.
Acl UpdateLogsInstancePayloadGetAclAttributeType `json:"acl,omitempty"`
// The description of the Logs instance.
Description UpdateLogsInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"`
// The displayed name to distinguish multiple Logs instances.
DisplayName UpdateLogsInstancePayloadGetDisplayNameAttributeType `json:"displayName,omitempty"`
// The log retention time in days.
// Can be cast to int32 without loss of precision.
RetentionDays UpdateLogsInstancePayloadGetRetentionDaysAttributeType `json:"retentionDays,omitempty"`
}
// NewUpdateLogsInstancePayload instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayload() *UpdateLogsInstancePayload {
this := UpdateLogsInstancePayload{}
return &this
}
// NewUpdateLogsInstancePayloadWithDefaults instantiates a new UpdateLogsInstancePayload 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 NewUpdateLogsInstancePayloadWithDefaults() *UpdateLogsInstancePayload {
this := UpdateLogsInstancePayload{}
return &this
}
// GetAcl returns the Acl field value if set, zero value otherwise.
func (o *UpdateLogsInstancePayload) GetAcl() (res UpdateLogsInstancePayloadGetAclRetType) {
res, _ = o.GetAclOk()
return
}
// GetAclOk returns a tuple with the Acl field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateLogsInstancePayload) GetAclOk() (ret UpdateLogsInstancePayloadGetAclRetType, ok bool) {
return getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl)
}
// HasAcl returns a boolean if a field has been set.
func (o *UpdateLogsInstancePayload) HasAcl() bool {
_, ok := o.GetAclOk()
return ok
}
// SetAcl gets a reference to the given []string and assigns it to the Acl field.
func (o *UpdateLogsInstancePayload) SetAcl(v UpdateLogsInstancePayloadGetAclRetType) {
setUpdateLogsInstancePayloadGetAclAttributeType(&o.Acl, v)
}
// GetDescription returns the Description field value if set, zero value otherwise.
func (o *UpdateLogsInstancePayload) GetDescription() (res UpdateLogsInstancePayloadGetDescriptionRetType) {
res, _ = o.GetDescriptionOk()
return
}
// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateLogsInstancePayload) GetDescriptionOk() (ret UpdateLogsInstancePayloadGetDescriptionRetType, ok bool) {
return getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description)
}
// HasDescription returns a boolean if a field has been set.
func (o *UpdateLogsInstancePayload) HasDescription() bool {
_, ok := o.GetDescriptionOk()
return ok
}
// SetDescription gets a reference to the given string and assigns it to the Description field.
func (o *UpdateLogsInstancePayload) SetDescription(v UpdateLogsInstancePayloadGetDescriptionRetType) {
setUpdateLogsInstancePayloadGetDescriptionAttributeType(&o.Description, v)
}
// GetDisplayName returns the DisplayName field value if set, zero value otherwise.
func (o *UpdateLogsInstancePayload) GetDisplayName() (res UpdateLogsInstancePayloadGetDisplayNameRetType) {
res, _ = o.GetDisplayNameOk()
return
}
// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateLogsInstancePayload) GetDisplayNameOk() (ret UpdateLogsInstancePayloadGetDisplayNameRetType, ok bool) {
return getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName)
}
// HasDisplayName returns a boolean if a field has been set.
func (o *UpdateLogsInstancePayload) HasDisplayName() bool {
_, ok := o.GetDisplayNameOk()
return ok
}
// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field.
func (o *UpdateLogsInstancePayload) SetDisplayName(v UpdateLogsInstancePayloadGetDisplayNameRetType) {
setUpdateLogsInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v)
}
// GetRetentionDays returns the RetentionDays field value if set, zero value otherwise.
func (o *UpdateLogsInstancePayload) GetRetentionDays() (res UpdateLogsInstancePayloadGetRetentionDaysRetType) {
res, _ = o.GetRetentionDaysOk()
return
}
// GetRetentionDaysOk returns a tuple with the RetentionDays field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UpdateLogsInstancePayload) GetRetentionDaysOk() (ret UpdateLogsInstancePayloadGetRetentionDaysRetType, ok bool) {
return getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays)
}
// HasRetentionDays returns a boolean if a field has been set.
func (o *UpdateLogsInstancePayload) HasRetentionDays() bool {
_, ok := o.GetRetentionDaysOk()
return ok
}
// SetRetentionDays gets a reference to the given int64 and assigns it to the RetentionDays field.
func (o *UpdateLogsInstancePayload) SetRetentionDays(v UpdateLogsInstancePayloadGetRetentionDaysRetType) {
setUpdateLogsInstancePayloadGetRetentionDaysAttributeType(&o.RetentionDays, v)
}
func (o UpdateLogsInstancePayload) ToMap() (map[string]interface{}, error) {
toSerialize := map[string]interface{}{}
if val, ok := getUpdateLogsInstancePayloadGetAclAttributeTypeOk(o.Acl); ok {
toSerialize["Acl"] = val
}
if val, ok := getUpdateLogsInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok {
toSerialize["Description"] = val
}
if val, ok := getUpdateLogsInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
toSerialize["DisplayName"] = val
}
if val, ok := getUpdateLogsInstancePayloadGetRetentionDaysAttributeTypeOk(o.RetentionDays); ok {
toSerialize["RetentionDays"] = val
}
return toSerialize, nil
}
type NullableUpdateLogsInstancePayload struct {
value *UpdateLogsInstancePayload
isSet bool
}
func (v NullableUpdateLogsInstancePayload) Get() *UpdateLogsInstancePayload {
return v.value
}
func (v *NullableUpdateLogsInstancePayload) Set(val *UpdateLogsInstancePayload) {
v.value = val
v.isSet = true
}
func (v NullableUpdateLogsInstancePayload) IsSet() bool {
return v.isSet
}
func (v *NullableUpdateLogsInstancePayload) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableUpdateLogsInstancePayload(val *UpdateLogsInstancePayload) *NullableUpdateLogsInstancePayload {
return &NullableUpdateLogsInstancePayload{value: val, isSet: true}
}
func (v NullableUpdateLogsInstancePayload) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableUpdateLogsInstancePayload) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}

View file

@ -0,0 +1,11 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta

385
pkg/logsbeta/utils.go Normal file
View file

@ -0,0 +1,385 @@
/*
STACKIT Logs API
This API provides endpoints for managing STACKIT Logs.
API version: 1beta.0.3
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package logsbeta
import (
"encoding/json"
"math/rand"
"reflect"
"time"
)
// PtrBool is a helper routine that returns a pointer to given boolean value.
func PtrBool(v bool) *bool { return &v }
// PtrInt is a helper routine that returns a pointer to given integer value.
func PtrInt(v int) *int { return &v }
// PtrInt32 is a helper routine that returns a pointer to given integer value.
func PtrInt32(v int32) *int32 { return &v }
// PtrInt64 is a helper routine that returns a pointer to given integer value.
func PtrInt64(v int64) *int64 { return &v }
// PtrFloat32 is a helper routine that returns a pointer to given float value.
func PtrFloat32(v float32) *float32 { return &v }
// PtrFloat64 is a helper routine that returns a pointer to given float value.
func PtrFloat64(v float64) *float64 { return &v }
// PtrString is a helper routine that returns a pointer to given string value.
func PtrString(v string) *string { return &v }
// PtrTime is helper routine that returns a pointer to given Time value.
func PtrTime(v time.Time) *time.Time { return &v }
type NullableValue[T any] struct {
value *T
isSet bool
}
func (v NullableValue[T]) Get() *T {
return v.value
}
func (v *NullableValue[T]) Set(val *T) {
v.value = val
v.isSet = true
}
func (v NullableValue[T]) IsSet() bool {
return v.isSet
}
func (v *NullableValue[T]) Unset() {
v.value = nil
v.isSet = false
}
type NullableBool struct {
value *bool
isSet bool
}
func (v NullableBool) Get() *bool {
return v.value
}
func (v *NullableBool) Set(val *bool) {
v.value = val
v.isSet = true
}
func (v NullableBool) IsSet() bool {
return v.isSet
}
func (v *NullableBool) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableBool(val *bool) *NullableBool {
return &NullableBool{value: val, isSet: true}
}
func (v NullableBool) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableBool) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableInt struct {
value *int
isSet bool
}
func (v NullableInt) Get() *int {
return v.value
}
func (v *NullableInt) Set(val *int) {
v.value = val
v.isSet = true
}
func (v NullableInt) IsSet() bool {
return v.isSet
}
func (v *NullableInt) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInt(val *int) *NullableInt {
return &NullableInt{value: val, isSet: true}
}
func (v NullableInt) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInt) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableInt32 struct {
value *int32
isSet bool
}
func (v NullableInt32) Get() *int32 {
return v.value
}
func (v *NullableInt32) Set(val *int32) {
v.value = val
v.isSet = true
}
func (v NullableInt32) IsSet() bool {
return v.isSet
}
func (v *NullableInt32) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInt32(val *int32) *NullableInt32 {
return &NullableInt32{value: val, isSet: true}
}
func (v NullableInt32) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInt32) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableInt64 struct {
value *int64
isSet bool
}
func (v NullableInt64) Get() *int64 {
return v.value
}
func (v *NullableInt64) Set(val *int64) {
v.value = val
v.isSet = true
}
func (v NullableInt64) IsSet() bool {
return v.isSet
}
func (v *NullableInt64) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableInt64(val *int64) *NullableInt64 {
return &NullableInt64{value: val, isSet: true}
}
func (v NullableInt64) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableInt64) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableFloat32 struct {
value *float32
isSet bool
}
func (v NullableFloat32) Get() *float32 {
return v.value
}
func (v *NullableFloat32) Set(val *float32) {
v.value = val
v.isSet = true
}
func (v NullableFloat32) IsSet() bool {
return v.isSet
}
func (v *NullableFloat32) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFloat32(val *float32) *NullableFloat32 {
return &NullableFloat32{value: val, isSet: true}
}
func (v NullableFloat32) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFloat32) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableFloat64 struct {
value *float64
isSet bool
}
func (v NullableFloat64) Get() *float64 {
return v.value
}
func (v *NullableFloat64) Set(val *float64) {
v.value = val
v.isSet = true
}
func (v NullableFloat64) IsSet() bool {
return v.isSet
}
func (v *NullableFloat64) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableFloat64(val *float64) *NullableFloat64 {
return &NullableFloat64{value: val, isSet: true}
}
func (v NullableFloat64) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableFloat64) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableString struct {
value *string
isSet bool
}
func (v NullableString) Get() *string {
return v.value
}
func (v *NullableString) Set(val *string) {
v.value = val
v.isSet = true
}
func (v NullableString) IsSet() bool {
return v.isSet
}
func (v *NullableString) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableString(val *string) *NullableString {
return &NullableString{value: val, isSet: true}
}
func (v NullableString) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableString) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
type NullableTime struct {
value *time.Time
isSet bool
}
func (v NullableTime) Get() *time.Time {
return v.value
}
func (v *NullableTime) Set(val *time.Time) {
v.value = val
v.isSet = true
}
func (v NullableTime) IsSet() bool {
return v.isSet
}
func (v *NullableTime) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableTime(val *time.Time) *NullableTime {
return &NullableTime{value: val, isSet: true}
}
func (v NullableTime) MarshalJSON() ([]byte, error) {
return v.value.MarshalJSON()
}
func (v *NullableTime) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
// IsNil checks if an input is nil
func IsNil(i interface{}) bool {
if i == nil {
return true
}
if t, ok := i.(interface{ IsSet() bool }); ok {
return !t.IsSet()
}
switch reflect.TypeOf(i).Kind() {
case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice:
return reflect.ValueOf(i).IsNil()
case reflect.Array:
return reflect.ValueOf(i).IsZero()
}
return false
}
type MappedNullable interface {
ToMap() (map[string]interface{}, error)
}
const letterRunes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
// randString returns a random string with a specified length. It panics if n <= 0.
func randString(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterRunes[rand.Intn(len(letterRunes))]
}
return string(b)
}