feat: auto generated files and new structure (#4)
## Description
<!-- **Please link some issue here describing what you are trying to achieve.**
In case there is no issue present for your PR, please consider creating one.
At least please give us some description what you are trying to achieve and why your change is needed. -->
relates to #1234
## Checklist
- [ ] Issue was linked above
- [ ] Code format was applied: `make fmt`
- [ ] Examples were added / adjusted (see `examples/` directory)
- [x] Docs are up-to-date: `make generate-docs` (will be checked by CI)
- [ ] Unit tests got implemented or updated
- [ ] Acceptance tests got implemented or updated (see e.g. [here](f5f99d1709/stackit/internal/services/dns/dns_acc_test.go))
- [x] Unit tests are passing: `make test` (will be checked by CI)
- [x] No linter issues: `make lint` (will be checked by CI)
Reviewed-on: #4
Reviewed-by: Andre_Harms <andre.harms@stackit.cloud>
Co-authored-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
Co-committed-by: Marcel S. Henselin <marcel.henselin@stackit.cloud>
This commit is contained in:
parent
979220be66
commit
9f41c4da7f
1283 changed files with 273211 additions and 4614 deletions
1
pkg/edgebeta/.openapi-generator/VERSION
Normal file
1
pkg/edgebeta/.openapi-generator/VERSION
Normal file
|
|
@ -0,0 +1 @@
|
|||
6.6.0
|
||||
2530
pkg/edgebeta/api_default.go
Normal file
2530
pkg/edgebeta/api_default.go
Normal file
File diff suppressed because it is too large
Load diff
796
pkg/edgebeta/api_default_test.go
Normal file
796
pkg/edgebeta/api_default_test.go
Normal file
|
|
@ -0,0 +1,796 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
Testing DefaultApiService
|
||||
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech);
|
||||
|
||||
package edgebeta
|
||||
|
||||
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_edgebeta_DefaultApiService(t *testing.T) {
|
||||
|
||||
t.Run("Test DefaultApiService CreateInstance", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/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 := Instance{}
|
||||
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 edgebeta_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
|
||||
createInstancePayload := CreateInstancePayload{}
|
||||
|
||||
resp, reqErr := apiClient.CreateInstance(context.Background(), projectId, regionId).CreateInstancePayload(createInstancePayload).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService DeleteInstance", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/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 := randString(16)
|
||||
_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 edgebeta_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.DeleteInstance(context.Background(), projectId, regionId, instanceId).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService DeleteInstanceByName", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}"
|
||||
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)
|
||||
displayNameValue := randString(8)
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -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 edgebeta_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
|
||||
displayName := displayNameValue
|
||||
|
||||
reqErr := apiClient.DeleteInstanceByName(context.Background(), projectId, regionId, displayName).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetInstance", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/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 := randString(16)
|
||||
_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 := Instance{}
|
||||
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 edgebeta_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.GetInstance(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 GetInstanceByName", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}"
|
||||
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)
|
||||
displayNameValue := randString(8)
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := Instance{}
|
||||
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 edgebeta_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
|
||||
displayName := displayNameValue
|
||||
|
||||
resp, reqErr := apiClient.GetInstanceByName(context.Background(), projectId, regionId, displayName).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetKubeconfigByInstanceId", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/kubeconfig"
|
||||
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 := randString(16)
|
||||
_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 := Kubeconfig{}
|
||||
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 edgebeta_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.GetKubeconfigByInstanceId(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 GetKubeconfigByInstanceName", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/kubeconfig"
|
||||
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)
|
||||
displayNameValue := randString(8)
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := Kubeconfig{}
|
||||
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 edgebeta_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
|
||||
displayName := displayNameValue
|
||||
|
||||
resp, reqErr := apiClient.GetKubeconfigByInstanceName(context.Background(), projectId, regionId, displayName).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService GetTokenByInstanceId", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instances/{instanceId}/token"
|
||||
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 := randString(16)
|
||||
_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 := Token{}
|
||||
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 edgebeta_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.GetTokenByInstanceId(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 GetTokenByInstanceName", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}/token"
|
||||
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)
|
||||
displayNameValue := randString(8)
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := Token{}
|
||||
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 edgebeta_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
|
||||
displayName := displayNameValue
|
||||
|
||||
resp, reqErr := apiClient.GetTokenByInstanceName(context.Background(), projectId, regionId, displayName).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService ListInstances", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/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 := InstanceList{}
|
||||
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 edgebeta_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.ListInstances(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 ListPlansGlobal", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/plans"
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := PlanList{}
|
||||
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 edgebeta_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)
|
||||
}
|
||||
|
||||
resp, reqErr := apiClient.ListPlansGlobal(context.Background()).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService ListPlansProject", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/plans"
|
||||
projectIdValue := uuid.NewString()
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"projectId"+"}", url.PathEscape(ParameterValueToString(projectIdValue, "projectId")), -1)
|
||||
|
||||
testDefaultApiServeMux := http.NewServeMux()
|
||||
testDefaultApiServeMux.HandleFunc(_apiUrlPath, func(w http.ResponseWriter, req *http.Request) {
|
||||
data := PlanList{}
|
||||
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 edgebeta_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
|
||||
|
||||
resp, reqErr := apiClient.ListPlansProject(context.Background(), projectId).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
if IsNil(resp) {
|
||||
t.Fatalf("response not present")
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService UpdateInstance", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/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 := randString(16)
|
||||
_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 edgebeta_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
|
||||
updateInstancePayload := UpdateInstancePayload{}
|
||||
|
||||
reqErr := apiClient.UpdateInstance(context.Background(), projectId, regionId, instanceId).UpdateInstancePayload(updateInstancePayload).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("Test DefaultApiService UpdateInstanceByName", func(t *testing.T) {
|
||||
_apiUrlPath := "/v1beta1/projects/{projectId}/regions/{regionId}/instancesbyname/{displayName}"
|
||||
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)
|
||||
displayNameValue := randString(8)
|
||||
_apiUrlPath = strings.Replace(_apiUrlPath, "{"+"displayName"+"}", url.PathEscape(ParameterValueToString(displayNameValue, "displayName")), -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 edgebeta_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
|
||||
displayName := displayNameValue
|
||||
updateInstanceByNamePayload := UpdateInstanceByNamePayload{}
|
||||
|
||||
reqErr := apiClient.UpdateInstanceByName(context.Background(), projectId, regionId, displayName).UpdateInstanceByNamePayload(updateInstanceByNamePayload).Execute()
|
||||
|
||||
if reqErr != nil {
|
||||
t.Fatalf("error in call: %v", reqErr)
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
628
pkg/edgebeta/client.go
Normal file
628
pkg/edgebeta/client.go
Normal file
|
|
@ -0,0 +1,628 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
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 Edge Cloud API API v1beta1
|
||||
// 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
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
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)
|
||||
}
|
||||
38
pkg/edgebeta/configuration.go
Normal file
38
pkg/edgebeta/configuration.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
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/edgebeta",
|
||||
Debug: false,
|
||||
Servers: config.ServerConfigurations{
|
||||
{
|
||||
URL: "https://edge.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
|
||||
}
|
||||
176
pkg/edgebeta/model_bad_request.go
Normal file
176
pkg/edgebeta/model_bad_request.go
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the BadRequest type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &BadRequest{}
|
||||
|
||||
/*
|
||||
types and functions for code
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type BadRequestGetCodeAttributeType = *string
|
||||
|
||||
func getBadRequestGetCodeAttributeTypeOk(arg BadRequestGetCodeAttributeType) (ret BadRequestGetCodeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setBadRequestGetCodeAttributeType(arg *BadRequestGetCodeAttributeType, val BadRequestGetCodeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type BadRequestGetCodeArgType = string
|
||||
type BadRequestGetCodeRetType = string
|
||||
|
||||
/*
|
||||
types and functions for message
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type BadRequestGetMessageAttributeType = *string
|
||||
|
||||
func getBadRequestGetMessageAttributeTypeOk(arg BadRequestGetMessageAttributeType) (ret BadRequestGetMessageRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setBadRequestGetMessageAttributeType(arg *BadRequestGetMessageAttributeType, val BadRequestGetMessageRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type BadRequestGetMessageArgType = string
|
||||
type BadRequestGetMessageRetType = string
|
||||
|
||||
// BadRequest struct for BadRequest
|
||||
type BadRequest struct {
|
||||
Code BadRequestGetCodeAttributeType `json:"code,omitempty"`
|
||||
Message BadRequestGetMessageAttributeType `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// NewBadRequest instantiates a new BadRequest 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 NewBadRequest() *BadRequest {
|
||||
this := BadRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewBadRequestWithDefaults instantiates a new BadRequest 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 NewBadRequestWithDefaults() *BadRequest {
|
||||
this := BadRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCode returns the Code field value if set, zero value otherwise.
|
||||
func (o *BadRequest) GetCode() (res BadRequestGetCodeRetType) {
|
||||
res, _ = o.GetCodeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCodeOk returns a tuple with the Code field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *BadRequest) GetCodeOk() (ret BadRequestGetCodeRetType, ok bool) {
|
||||
return getBadRequestGetCodeAttributeTypeOk(o.Code)
|
||||
}
|
||||
|
||||
// HasCode returns a boolean if a field has been set.
|
||||
func (o *BadRequest) HasCode() bool {
|
||||
_, ok := o.GetCodeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCode gets a reference to the given string and assigns it to the Code field.
|
||||
func (o *BadRequest) SetCode(v BadRequestGetCodeRetType) {
|
||||
setBadRequestGetCodeAttributeType(&o.Code, v)
|
||||
}
|
||||
|
||||
// GetMessage returns the Message field value if set, zero value otherwise.
|
||||
func (o *BadRequest) GetMessage() (res BadRequestGetMessageRetType) {
|
||||
res, _ = o.GetMessageOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *BadRequest) GetMessageOk() (ret BadRequestGetMessageRetType, ok bool) {
|
||||
return getBadRequestGetMessageAttributeTypeOk(o.Message)
|
||||
}
|
||||
|
||||
// HasMessage returns a boolean if a field has been set.
|
||||
func (o *BadRequest) HasMessage() bool {
|
||||
_, ok := o.GetMessageOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetMessage gets a reference to the given string and assigns it to the Message field.
|
||||
func (o *BadRequest) SetMessage(v BadRequestGetMessageRetType) {
|
||||
setBadRequestGetMessageAttributeType(&o.Message, v)
|
||||
}
|
||||
|
||||
func (o BadRequest) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getBadRequestGetCodeAttributeTypeOk(o.Code); ok {
|
||||
toSerialize["Code"] = val
|
||||
}
|
||||
if val, ok := getBadRequestGetMessageAttributeTypeOk(o.Message); ok {
|
||||
toSerialize["Message"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableBadRequest struct {
|
||||
value *BadRequest
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableBadRequest) Get() *BadRequest {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableBadRequest) Set(val *BadRequest) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableBadRequest) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableBadRequest) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableBadRequest(val *BadRequest) *NullableBadRequest {
|
||||
return &NullableBadRequest{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableBadRequest) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableBadRequest) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_bad_request_test.go
Normal file
11
pkg/edgebeta/model_bad_request_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
221
pkg/edgebeta/model_create_instance_payload.go
Normal file
221
pkg/edgebeta/model_create_instance_payload.go
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the CreateInstancePayload type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &CreateInstancePayload{}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateInstancePayloadGetDescriptionAttributeType = *string
|
||||
|
||||
func getCreateInstancePayloadGetDescriptionAttributeTypeOk(arg CreateInstancePayloadGetDescriptionAttributeType) (ret CreateInstancePayloadGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateInstancePayloadGetDescriptionAttributeType(arg *CreateInstancePayloadGetDescriptionAttributeType, val CreateInstancePayloadGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateInstancePayloadGetDescriptionArgType = string
|
||||
type CreateInstancePayloadGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for displayName
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateInstancePayloadGetDisplayNameAttributeType = *string
|
||||
|
||||
func getCreateInstancePayloadGetDisplayNameAttributeTypeOk(arg CreateInstancePayloadGetDisplayNameAttributeType) (ret CreateInstancePayloadGetDisplayNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateInstancePayloadGetDisplayNameAttributeType(arg *CreateInstancePayloadGetDisplayNameAttributeType, val CreateInstancePayloadGetDisplayNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateInstancePayloadGetDisplayNameArgType = string
|
||||
type CreateInstancePayloadGetDisplayNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for planId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type CreateInstancePayloadGetPlanIdAttributeType = *string
|
||||
|
||||
func getCreateInstancePayloadGetPlanIdAttributeTypeOk(arg CreateInstancePayloadGetPlanIdAttributeType) (ret CreateInstancePayloadGetPlanIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setCreateInstancePayloadGetPlanIdAttributeType(arg *CreateInstancePayloadGetPlanIdAttributeType, val CreateInstancePayloadGetPlanIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type CreateInstancePayloadGetPlanIdArgType = string
|
||||
type CreateInstancePayloadGetPlanIdRetType = string
|
||||
|
||||
// CreateInstancePayload struct for CreateInstancePayload
|
||||
type CreateInstancePayload struct {
|
||||
// A user chosen description to distinguish multiple instances.
|
||||
Description CreateInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// The displayed name to distinguish multiple instances.
|
||||
// REQUIRED
|
||||
DisplayName CreateInstancePayloadGetDisplayNameAttributeType `json:"displayName" required:"true"`
|
||||
// Service Plan configures the size of the Instance.
|
||||
// REQUIRED
|
||||
PlanId CreateInstancePayloadGetPlanIdAttributeType `json:"planId" required:"true"`
|
||||
}
|
||||
|
||||
type _CreateInstancePayload CreateInstancePayload
|
||||
|
||||
// NewCreateInstancePayload instantiates a new CreateInstancePayload 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 NewCreateInstancePayload(displayName CreateInstancePayloadGetDisplayNameArgType, planId CreateInstancePayloadGetPlanIdArgType) *CreateInstancePayload {
|
||||
this := CreateInstancePayload{}
|
||||
setCreateInstancePayloadGetDisplayNameAttributeType(&this.DisplayName, displayName)
|
||||
setCreateInstancePayloadGetPlanIdAttributeType(&this.PlanId, planId)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewCreateInstancePayloadWithDefaults instantiates a new CreateInstancePayload 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 NewCreateInstancePayloadWithDefaults() *CreateInstancePayload {
|
||||
this := CreateInstancePayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *CreateInstancePayload) GetDescription() (res CreateInstancePayloadGetDescriptionRetType) {
|
||||
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 *CreateInstancePayload) GetDescriptionOk() (ret CreateInstancePayloadGetDescriptionRetType, ok bool) {
|
||||
return getCreateInstancePayloadGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *CreateInstancePayload) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *CreateInstancePayload) SetDescription(v CreateInstancePayloadGetDescriptionRetType) {
|
||||
setCreateInstancePayloadGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetDisplayName returns the DisplayName field value
|
||||
func (o *CreateInstancePayload) GetDisplayName() (ret CreateInstancePayloadGetDisplayNameRetType) {
|
||||
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 *CreateInstancePayload) GetDisplayNameOk() (ret CreateInstancePayloadGetDisplayNameRetType, ok bool) {
|
||||
return getCreateInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName)
|
||||
}
|
||||
|
||||
// SetDisplayName sets field value
|
||||
func (o *CreateInstancePayload) SetDisplayName(v CreateInstancePayloadGetDisplayNameRetType) {
|
||||
setCreateInstancePayloadGetDisplayNameAttributeType(&o.DisplayName, v)
|
||||
}
|
||||
|
||||
// GetPlanId returns the PlanId field value
|
||||
func (o *CreateInstancePayload) GetPlanId() (ret CreateInstancePayloadGetPlanIdRetType) {
|
||||
ret, _ = o.GetPlanIdOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetPlanIdOk returns a tuple with the PlanId field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *CreateInstancePayload) GetPlanIdOk() (ret CreateInstancePayloadGetPlanIdRetType, ok bool) {
|
||||
return getCreateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId)
|
||||
}
|
||||
|
||||
// SetPlanId sets field value
|
||||
func (o *CreateInstancePayload) SetPlanId(v CreateInstancePayloadGetPlanIdRetType) {
|
||||
setCreateInstancePayloadGetPlanIdAttributeType(&o.PlanId, v)
|
||||
}
|
||||
|
||||
func (o CreateInstancePayload) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getCreateInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getCreateInstancePayloadGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
|
||||
toSerialize["DisplayName"] = val
|
||||
}
|
||||
if val, ok := getCreateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok {
|
||||
toSerialize["PlanId"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableCreateInstancePayload struct {
|
||||
value *CreateInstancePayload
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableCreateInstancePayload) Get() *CreateInstancePayload {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableCreateInstancePayload) Set(val *CreateInstancePayload) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableCreateInstancePayload) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableCreateInstancePayload) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableCreateInstancePayload(val *CreateInstancePayload) *NullableCreateInstancePayload {
|
||||
return &NullableCreateInstancePayload{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableCreateInstancePayload) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableCreateInstancePayload) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_create_instance_payload_test.go
Normal file
11
pkg/edgebeta/model_create_instance_payload_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
509
pkg/edgebeta/model_instance.go
Normal file
509
pkg/edgebeta/model_instance.go
Normal file
|
|
@ -0,0 +1,509 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
// checks if the Instance type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Instance{}
|
||||
|
||||
/*
|
||||
types and functions for created
|
||||
*/
|
||||
|
||||
// isDateTime
|
||||
type InstanceGetCreatedAttributeType = *time.Time
|
||||
type InstanceGetCreatedArgType = time.Time
|
||||
type InstanceGetCreatedRetType = time.Time
|
||||
|
||||
func getInstanceGetCreatedAttributeTypeOk(arg InstanceGetCreatedAttributeType) (ret InstanceGetCreatedRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetCreatedAttributeType(arg *InstanceGetCreatedAttributeType, val InstanceGetCreatedRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type InstanceGetDescriptionAttributeType = *string
|
||||
|
||||
func getInstanceGetDescriptionAttributeTypeOk(arg InstanceGetDescriptionAttributeType) (ret InstanceGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetDescriptionAttributeType(arg *InstanceGetDescriptionAttributeType, val InstanceGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type InstanceGetDescriptionArgType = string
|
||||
type InstanceGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for displayName
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type InstanceGetDisplayNameAttributeType = *string
|
||||
|
||||
func getInstanceGetDisplayNameAttributeTypeOk(arg InstanceGetDisplayNameAttributeType) (ret InstanceGetDisplayNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetDisplayNameAttributeType(arg *InstanceGetDisplayNameAttributeType, val InstanceGetDisplayNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type InstanceGetDisplayNameArgType = string
|
||||
type InstanceGetDisplayNameRetType = string
|
||||
|
||||
/*
|
||||
types and functions for frontendUrl
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type InstanceGetFrontendUrlAttributeType = *string
|
||||
|
||||
func getInstanceGetFrontendUrlAttributeTypeOk(arg InstanceGetFrontendUrlAttributeType) (ret InstanceGetFrontendUrlRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetFrontendUrlAttributeType(arg *InstanceGetFrontendUrlAttributeType, val InstanceGetFrontendUrlRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type InstanceGetFrontendUrlArgType = string
|
||||
type InstanceGetFrontendUrlRetType = string
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type InstanceGetIdAttributeType = *string
|
||||
|
||||
func getInstanceGetIdAttributeTypeOk(arg InstanceGetIdAttributeType) (ret InstanceGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetIdAttributeType(arg *InstanceGetIdAttributeType, val InstanceGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type InstanceGetIdArgType = string
|
||||
type InstanceGetIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for planId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type InstanceGetPlanIdAttributeType = *string
|
||||
|
||||
func getInstanceGetPlanIdAttributeTypeOk(arg InstanceGetPlanIdAttributeType) (ret InstanceGetPlanIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetPlanIdAttributeType(arg *InstanceGetPlanIdAttributeType, val InstanceGetPlanIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type InstanceGetPlanIdArgType = string
|
||||
type InstanceGetPlanIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for status
|
||||
*/
|
||||
|
||||
// isEnum
|
||||
|
||||
// InstanceStatus The current status of the instance.
|
||||
// value type for enums
|
||||
type InstanceStatus string
|
||||
|
||||
// List of Status
|
||||
const (
|
||||
INSTANCESTATUS_ERROR InstanceStatus = "error"
|
||||
INSTANCESTATUS_RECONCILING InstanceStatus = "reconciling"
|
||||
INSTANCESTATUS_ACTIVE InstanceStatus = "active"
|
||||
INSTANCESTATUS_DELETING InstanceStatus = "deleting"
|
||||
)
|
||||
|
||||
// All allowed values of Instance enum
|
||||
var AllowedInstanceStatusEnumValues = []InstanceStatus{
|
||||
"error",
|
||||
"reconciling",
|
||||
"active",
|
||||
"deleting",
|
||||
}
|
||||
|
||||
func (v *InstanceStatus) 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 InstanceStatus
|
||||
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 := InstanceStatus(value)
|
||||
for _, existing := range AllowedInstanceStatusEnumValues {
|
||||
if existing == enumTypeValue {
|
||||
*v = enumTypeValue
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("%+v is not a valid Instance", value)
|
||||
}
|
||||
|
||||
// NewInstanceStatusFromValue returns a pointer to a valid InstanceStatus
|
||||
// for the value passed as argument, or an error if the value passed is not allowed by the enum
|
||||
func NewInstanceStatusFromValue(v InstanceStatus) (*InstanceStatus, error) {
|
||||
ev := InstanceStatus(v)
|
||||
if ev.IsValid() {
|
||||
return &ev, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("invalid value '%v' for InstanceStatus: valid values are %v", v, AllowedInstanceStatusEnumValues)
|
||||
}
|
||||
}
|
||||
|
||||
// IsValid return true if the value is valid for the enum, false otherwise
|
||||
func (v InstanceStatus) IsValid() bool {
|
||||
for _, existing := range AllowedInstanceStatusEnumValues {
|
||||
if existing == v {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Ptr returns reference to StatusStatus value
|
||||
func (v InstanceStatus) Ptr() *InstanceStatus {
|
||||
return &v
|
||||
}
|
||||
|
||||
type NullableInstanceStatus struct {
|
||||
value *InstanceStatus
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableInstanceStatus) Get() *InstanceStatus {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableInstanceStatus) Set(val *InstanceStatus) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableInstanceStatus) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableInstanceStatus) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableInstanceStatus(val *InstanceStatus) *NullableInstanceStatus {
|
||||
return &NullableInstanceStatus{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableInstanceStatus) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableInstanceStatus) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
type InstanceGetStatusAttributeType = *InstanceStatus
|
||||
type InstanceGetStatusArgType = InstanceStatus
|
||||
type InstanceGetStatusRetType = InstanceStatus
|
||||
|
||||
func getInstanceGetStatusAttributeTypeOk(arg InstanceGetStatusAttributeType) (ret InstanceGetStatusRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceGetStatusAttributeType(arg *InstanceGetStatusAttributeType, val InstanceGetStatusRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// Instance struct for Instance
|
||||
type Instance struct {
|
||||
// The date and time the creation of the instance was triggered.
|
||||
// REQUIRED
|
||||
Created InstanceGetCreatedAttributeType `json:"created" required:"true"`
|
||||
// A user chosen description to distinguish multiple instances.
|
||||
Description InstanceGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// The displayed name of the instance.
|
||||
// REQUIRED
|
||||
DisplayName InstanceGetDisplayNameAttributeType `json:"displayName" required:"true"`
|
||||
// URL to the Management UI of the Instance.
|
||||
// REQUIRED
|
||||
FrontendUrl InstanceGetFrontendUrlAttributeType `json:"frontendUrl" required:"true"`
|
||||
// A auto generated unique id which identifies the instance.
|
||||
// REQUIRED
|
||||
Id InstanceGetIdAttributeType `json:"id" required:"true"`
|
||||
// Service Plan configures the size of the Instance.
|
||||
// REQUIRED
|
||||
PlanId InstanceGetPlanIdAttributeType `json:"planId" required:"true"`
|
||||
// The current status of the instance.
|
||||
// REQUIRED
|
||||
Status InstanceGetStatusAttributeType `json:"status" required:"true"`
|
||||
}
|
||||
|
||||
type _Instance Instance
|
||||
|
||||
// NewInstance instantiates a new Instance 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 NewInstance(created InstanceGetCreatedArgType, displayName InstanceGetDisplayNameArgType, frontendUrl InstanceGetFrontendUrlArgType, id InstanceGetIdArgType, planId InstanceGetPlanIdArgType, status InstanceGetStatusArgType) *Instance {
|
||||
this := Instance{}
|
||||
setInstanceGetCreatedAttributeType(&this.Created, created)
|
||||
setInstanceGetDisplayNameAttributeType(&this.DisplayName, displayName)
|
||||
setInstanceGetFrontendUrlAttributeType(&this.FrontendUrl, frontendUrl)
|
||||
setInstanceGetIdAttributeType(&this.Id, id)
|
||||
setInstanceGetPlanIdAttributeType(&this.PlanId, planId)
|
||||
setInstanceGetStatusAttributeType(&this.Status, status)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewInstanceWithDefaults instantiates a new Instance 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 NewInstanceWithDefaults() *Instance {
|
||||
this := Instance{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCreated returns the Created field value
|
||||
func (o *Instance) GetCreated() (ret InstanceGetCreatedRetType) {
|
||||
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 *Instance) GetCreatedOk() (ret InstanceGetCreatedRetType, ok bool) {
|
||||
return getInstanceGetCreatedAttributeTypeOk(o.Created)
|
||||
}
|
||||
|
||||
// SetCreated sets field value
|
||||
func (o *Instance) SetCreated(v InstanceGetCreatedRetType) {
|
||||
setInstanceGetCreatedAttributeType(&o.Created, v)
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *Instance) GetDescription() (res InstanceGetDescriptionRetType) {
|
||||
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 *Instance) GetDescriptionOk() (ret InstanceGetDescriptionRetType, ok bool) {
|
||||
return getInstanceGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *Instance) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *Instance) SetDescription(v InstanceGetDescriptionRetType) {
|
||||
setInstanceGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetDisplayName returns the DisplayName field value
|
||||
func (o *Instance) GetDisplayName() (ret InstanceGetDisplayNameRetType) {
|
||||
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 *Instance) GetDisplayNameOk() (ret InstanceGetDisplayNameRetType, ok bool) {
|
||||
return getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName)
|
||||
}
|
||||
|
||||
// SetDisplayName sets field value
|
||||
func (o *Instance) SetDisplayName(v InstanceGetDisplayNameRetType) {
|
||||
setInstanceGetDisplayNameAttributeType(&o.DisplayName, v)
|
||||
}
|
||||
|
||||
// GetFrontendUrl returns the FrontendUrl field value
|
||||
func (o *Instance) GetFrontendUrl() (ret InstanceGetFrontendUrlRetType) {
|
||||
ret, _ = o.GetFrontendUrlOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetFrontendUrlOk returns a tuple with the FrontendUrl field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Instance) GetFrontendUrlOk() (ret InstanceGetFrontendUrlRetType, ok bool) {
|
||||
return getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl)
|
||||
}
|
||||
|
||||
// SetFrontendUrl sets field value
|
||||
func (o *Instance) SetFrontendUrl(v InstanceGetFrontendUrlRetType) {
|
||||
setInstanceGetFrontendUrlAttributeType(&o.FrontendUrl, v)
|
||||
}
|
||||
|
||||
// GetId returns the Id field value
|
||||
func (o *Instance) GetId() (ret InstanceGetIdRetType) {
|
||||
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 *Instance) GetIdOk() (ret InstanceGetIdRetType, ok bool) {
|
||||
return getInstanceGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// SetId sets field value
|
||||
func (o *Instance) SetId(v InstanceGetIdRetType) {
|
||||
setInstanceGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetPlanId returns the PlanId field value
|
||||
func (o *Instance) GetPlanId() (ret InstanceGetPlanIdRetType) {
|
||||
ret, _ = o.GetPlanIdOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetPlanIdOk returns a tuple with the PlanId field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Instance) GetPlanIdOk() (ret InstanceGetPlanIdRetType, ok bool) {
|
||||
return getInstanceGetPlanIdAttributeTypeOk(o.PlanId)
|
||||
}
|
||||
|
||||
// SetPlanId sets field value
|
||||
func (o *Instance) SetPlanId(v InstanceGetPlanIdRetType) {
|
||||
setInstanceGetPlanIdAttributeType(&o.PlanId, v)
|
||||
}
|
||||
|
||||
// GetStatus returns the Status field value
|
||||
func (o *Instance) GetStatus() (ret InstanceGetStatusRetType) {
|
||||
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 *Instance) GetStatusOk() (ret InstanceGetStatusRetType, ok bool) {
|
||||
return getInstanceGetStatusAttributeTypeOk(o.Status)
|
||||
}
|
||||
|
||||
// SetStatus sets field value
|
||||
func (o *Instance) SetStatus(v InstanceGetStatusRetType) {
|
||||
setInstanceGetStatusAttributeType(&o.Status, v)
|
||||
}
|
||||
|
||||
func (o Instance) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getInstanceGetCreatedAttributeTypeOk(o.Created); ok {
|
||||
toSerialize["Created"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetDisplayNameAttributeTypeOk(o.DisplayName); ok {
|
||||
toSerialize["DisplayName"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetFrontendUrlAttributeTypeOk(o.FrontendUrl); ok {
|
||||
toSerialize["FrontendUrl"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetPlanIdAttributeTypeOk(o.PlanId); ok {
|
||||
toSerialize["PlanId"] = val
|
||||
}
|
||||
if val, ok := getInstanceGetStatusAttributeTypeOk(o.Status); ok {
|
||||
toSerialize["Status"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableInstance struct {
|
||||
value *Instance
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableInstance) Get() *Instance {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableInstance) Set(val *Instance) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableInstance) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableInstance) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableInstance(val *Instance) *NullableInstance {
|
||||
return &NullableInstance{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableInstance) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableInstance) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
125
pkg/edgebeta/model_instance_list.go
Normal file
125
pkg/edgebeta/model_instance_list.go
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the InstanceList type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &InstanceList{}
|
||||
|
||||
/*
|
||||
types and functions for instances
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type InstanceListGetInstancesAttributeType = *[]Instance
|
||||
type InstanceListGetInstancesArgType = []Instance
|
||||
type InstanceListGetInstancesRetType = []Instance
|
||||
|
||||
func getInstanceListGetInstancesAttributeTypeOk(arg InstanceListGetInstancesAttributeType) (ret InstanceListGetInstancesRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setInstanceListGetInstancesAttributeType(arg *InstanceListGetInstancesAttributeType, val InstanceListGetInstancesRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// InstanceList struct for InstanceList
|
||||
type InstanceList struct {
|
||||
// REQUIRED
|
||||
Instances InstanceListGetInstancesAttributeType `json:"instances" required:"true"`
|
||||
}
|
||||
|
||||
type _InstanceList InstanceList
|
||||
|
||||
// NewInstanceList instantiates a new InstanceList 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 NewInstanceList(instances InstanceListGetInstancesArgType) *InstanceList {
|
||||
this := InstanceList{}
|
||||
setInstanceListGetInstancesAttributeType(&this.Instances, instances)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewInstanceListWithDefaults instantiates a new InstanceList 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 NewInstanceListWithDefaults() *InstanceList {
|
||||
this := InstanceList{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetInstances returns the Instances field value
|
||||
func (o *InstanceList) GetInstances() (ret InstanceListGetInstancesRetType) {
|
||||
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 *InstanceList) GetInstancesOk() (ret InstanceListGetInstancesRetType, ok bool) {
|
||||
return getInstanceListGetInstancesAttributeTypeOk(o.Instances)
|
||||
}
|
||||
|
||||
// SetInstances sets field value
|
||||
func (o *InstanceList) SetInstances(v InstanceListGetInstancesRetType) {
|
||||
setInstanceListGetInstancesAttributeType(&o.Instances, v)
|
||||
}
|
||||
|
||||
func (o InstanceList) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getInstanceListGetInstancesAttributeTypeOk(o.Instances); ok {
|
||||
toSerialize["Instances"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableInstanceList struct {
|
||||
value *InstanceList
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableInstanceList) Get() *InstanceList {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableInstanceList) Set(val *InstanceList) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableInstanceList) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableInstanceList) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableInstanceList(val *InstanceList) *NullableInstanceList {
|
||||
return &NullableInstanceList{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableInstanceList) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableInstanceList) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_instance_list_test.go
Normal file
11
pkg/edgebeta/model_instance_list_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
72
pkg/edgebeta/model_instance_test.go
Normal file
72
pkg/edgebeta/model_instance_test.go
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
// isEnum
|
||||
|
||||
func TestInstanceStatus_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(`"error"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 2`,
|
||||
args: args{
|
||||
src: []byte(`"reconciling"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 3`,
|
||||
args: args{
|
||||
src: []byte(`"active"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: `success - possible enum value no. 4`,
|
||||
args: args{
|
||||
src: []byte(`"deleting"`),
|
||||
},
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "fail",
|
||||
args: args{
|
||||
src: []byte("\"FOOBAR\""),
|
||||
},
|
||||
wantErr: true,
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
v := InstanceStatus("")
|
||||
if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
|
||||
t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
126
pkg/edgebeta/model_kubeconfig.go
Normal file
126
pkg/edgebeta/model_kubeconfig.go
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Kubeconfig type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Kubeconfig{}
|
||||
|
||||
/*
|
||||
types and functions for kubeconfig
|
||||
*/
|
||||
|
||||
// isFreeform
|
||||
type KubeconfigGetKubeconfigAttributeType = *map[string]interface{}
|
||||
type KubeconfigGetKubeconfigArgType = map[string]interface{}
|
||||
type KubeconfigGetKubeconfigRetType = map[string]interface{}
|
||||
|
||||
func getKubeconfigGetKubeconfigAttributeTypeOk(arg KubeconfigGetKubeconfigAttributeType) (ret KubeconfigGetKubeconfigRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setKubeconfigGetKubeconfigAttributeType(arg *KubeconfigGetKubeconfigAttributeType, val KubeconfigGetKubeconfigRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// Kubeconfig struct for Kubeconfig
|
||||
type Kubeconfig struct {
|
||||
// The kubeconfig for the instance.
|
||||
// REQUIRED
|
||||
Kubeconfig KubeconfigGetKubeconfigAttributeType `json:"kubeconfig" required:"true"`
|
||||
}
|
||||
|
||||
type _Kubeconfig Kubeconfig
|
||||
|
||||
// NewKubeconfig instantiates a new Kubeconfig 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 NewKubeconfig(kubeconfig KubeconfigGetKubeconfigArgType) *Kubeconfig {
|
||||
this := Kubeconfig{}
|
||||
setKubeconfigGetKubeconfigAttributeType(&this.Kubeconfig, kubeconfig)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewKubeconfigWithDefaults instantiates a new Kubeconfig 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 NewKubeconfigWithDefaults() *Kubeconfig {
|
||||
this := Kubeconfig{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetKubeconfig returns the Kubeconfig field value
|
||||
func (o *Kubeconfig) GetKubeconfig() (ret KubeconfigGetKubeconfigRetType) {
|
||||
ret, _ = o.GetKubeconfigOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetKubeconfigOk returns a tuple with the Kubeconfig field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Kubeconfig) GetKubeconfigOk() (ret KubeconfigGetKubeconfigRetType, ok bool) {
|
||||
return getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig)
|
||||
}
|
||||
|
||||
// SetKubeconfig sets field value
|
||||
func (o *Kubeconfig) SetKubeconfig(v KubeconfigGetKubeconfigRetType) {
|
||||
setKubeconfigGetKubeconfigAttributeType(&o.Kubeconfig, v)
|
||||
}
|
||||
|
||||
func (o Kubeconfig) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getKubeconfigGetKubeconfigAttributeTypeOk(o.Kubeconfig); ok {
|
||||
toSerialize["Kubeconfig"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableKubeconfig struct {
|
||||
value *Kubeconfig
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableKubeconfig) Get() *Kubeconfig {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableKubeconfig) Set(val *Kubeconfig) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableKubeconfig) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableKubeconfig) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableKubeconfig(val *Kubeconfig) *NullableKubeconfig {
|
||||
return &NullableKubeconfig{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableKubeconfig) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableKubeconfig) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_kubeconfig_test.go
Normal file
11
pkg/edgebeta/model_kubeconfig_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
276
pkg/edgebeta/model_plan.go
Normal file
276
pkg/edgebeta/model_plan.go
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Plan type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Plan{}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type PlanGetDescriptionAttributeType = *string
|
||||
|
||||
func getPlanGetDescriptionAttributeTypeOk(arg PlanGetDescriptionAttributeType) (ret PlanGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPlanGetDescriptionAttributeType(arg *PlanGetDescriptionAttributeType, val PlanGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type PlanGetDescriptionArgType = string
|
||||
type PlanGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for id
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type PlanGetIdAttributeType = *string
|
||||
|
||||
func getPlanGetIdAttributeTypeOk(arg PlanGetIdAttributeType) (ret PlanGetIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPlanGetIdAttributeType(arg *PlanGetIdAttributeType, val PlanGetIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type PlanGetIdArgType = string
|
||||
type PlanGetIdRetType = string
|
||||
|
||||
/*
|
||||
types and functions for maxEdgeHosts
|
||||
*/
|
||||
|
||||
// isInteger
|
||||
type PlanGetMaxEdgeHostsAttributeType = *int64
|
||||
type PlanGetMaxEdgeHostsArgType = int64
|
||||
type PlanGetMaxEdgeHostsRetType = int64
|
||||
|
||||
func getPlanGetMaxEdgeHostsAttributeTypeOk(arg PlanGetMaxEdgeHostsAttributeType) (ret PlanGetMaxEdgeHostsRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPlanGetMaxEdgeHostsAttributeType(arg *PlanGetMaxEdgeHostsAttributeType, val PlanGetMaxEdgeHostsRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
/*
|
||||
types and functions for name
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type PlanGetNameAttributeType = *string
|
||||
|
||||
func getPlanGetNameAttributeTypeOk(arg PlanGetNameAttributeType) (ret PlanGetNameRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPlanGetNameAttributeType(arg *PlanGetNameAttributeType, val PlanGetNameRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type PlanGetNameArgType = string
|
||||
type PlanGetNameRetType = string
|
||||
|
||||
// Plan struct for Plan
|
||||
type Plan struct {
|
||||
// Description
|
||||
Description PlanGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// Service Plan Identifier
|
||||
Id PlanGetIdAttributeType `json:"id,omitempty"`
|
||||
// Maximum number of EdgeHosts
|
||||
// Can be cast to int32 without loss of precision.
|
||||
MaxEdgeHosts PlanGetMaxEdgeHostsAttributeType `json:"maxEdgeHosts,omitempty"`
|
||||
// Service Plan Name
|
||||
Name PlanGetNameAttributeType `json:"name,omitempty"`
|
||||
}
|
||||
|
||||
// NewPlan instantiates a new Plan 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 NewPlan() *Plan {
|
||||
this := Plan{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewPlanWithDefaults instantiates a new Plan 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 NewPlanWithDefaults() *Plan {
|
||||
this := Plan{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *Plan) GetDescription() (res PlanGetDescriptionRetType) {
|
||||
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 *Plan) GetDescriptionOk() (ret PlanGetDescriptionRetType, ok bool) {
|
||||
return getPlanGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *Plan) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *Plan) SetDescription(v PlanGetDescriptionRetType) {
|
||||
setPlanGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise.
|
||||
func (o *Plan) GetId() (res PlanGetIdRetType) {
|
||||
res, _ = o.GetIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Plan) GetIdOk() (ret PlanGetIdRetType, ok bool) {
|
||||
return getPlanGetIdAttributeTypeOk(o.Id)
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *Plan) HasId() bool {
|
||||
_, ok := o.GetIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given string and assigns it to the Id field.
|
||||
func (o *Plan) SetId(v PlanGetIdRetType) {
|
||||
setPlanGetIdAttributeType(&o.Id, v)
|
||||
}
|
||||
|
||||
// GetMaxEdgeHosts returns the MaxEdgeHosts field value if set, zero value otherwise.
|
||||
func (o *Plan) GetMaxEdgeHosts() (res PlanGetMaxEdgeHostsRetType) {
|
||||
res, _ = o.GetMaxEdgeHostsOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMaxEdgeHostsOk returns a tuple with the MaxEdgeHosts field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Plan) GetMaxEdgeHostsOk() (ret PlanGetMaxEdgeHostsRetType, ok bool) {
|
||||
return getPlanGetMaxEdgeHostsAttributeTypeOk(o.MaxEdgeHosts)
|
||||
}
|
||||
|
||||
// HasMaxEdgeHosts returns a boolean if a field has been set.
|
||||
func (o *Plan) HasMaxEdgeHosts() bool {
|
||||
_, ok := o.GetMaxEdgeHostsOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetMaxEdgeHosts gets a reference to the given int64 and assigns it to the MaxEdgeHosts field.
|
||||
func (o *Plan) SetMaxEdgeHosts(v PlanGetMaxEdgeHostsRetType) {
|
||||
setPlanGetMaxEdgeHostsAttributeType(&o.MaxEdgeHosts, v)
|
||||
}
|
||||
|
||||
// GetName returns the Name field value if set, zero value otherwise.
|
||||
func (o *Plan) GetName() (res PlanGetNameRetType) {
|
||||
res, _ = o.GetNameOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Plan) GetNameOk() (ret PlanGetNameRetType, ok bool) {
|
||||
return getPlanGetNameAttributeTypeOk(o.Name)
|
||||
}
|
||||
|
||||
// HasName returns a boolean if a field has been set.
|
||||
func (o *Plan) HasName() bool {
|
||||
_, ok := o.GetNameOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetName gets a reference to the given string and assigns it to the Name field.
|
||||
func (o *Plan) SetName(v PlanGetNameRetType) {
|
||||
setPlanGetNameAttributeType(&o.Name, v)
|
||||
}
|
||||
|
||||
func (o Plan) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getPlanGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getPlanGetIdAttributeTypeOk(o.Id); ok {
|
||||
toSerialize["Id"] = val
|
||||
}
|
||||
if val, ok := getPlanGetMaxEdgeHostsAttributeTypeOk(o.MaxEdgeHosts); ok {
|
||||
toSerialize["MaxEdgeHosts"] = val
|
||||
}
|
||||
if val, ok := getPlanGetNameAttributeTypeOk(o.Name); ok {
|
||||
toSerialize["Name"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullablePlan struct {
|
||||
value *Plan
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullablePlan) Get() *Plan {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullablePlan) Set(val *Plan) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullablePlan) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullablePlan) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullablePlan(val *Plan) *NullablePlan {
|
||||
return &NullablePlan{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullablePlan) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullablePlan) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
127
pkg/edgebeta/model_plan_list.go
Normal file
127
pkg/edgebeta/model_plan_list.go
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the PlanList type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &PlanList{}
|
||||
|
||||
/*
|
||||
types and functions for validPlans
|
||||
*/
|
||||
|
||||
// isArray
|
||||
type PlanListGetValidPlansAttributeType = *[]Plan
|
||||
type PlanListGetValidPlansArgType = []Plan
|
||||
type PlanListGetValidPlansRetType = []Plan
|
||||
|
||||
func getPlanListGetValidPlansAttributeTypeOk(arg PlanListGetValidPlansAttributeType) (ret PlanListGetValidPlansRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setPlanListGetValidPlansAttributeType(arg *PlanListGetValidPlansAttributeType, val PlanListGetValidPlansRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
// PlanList struct for PlanList
|
||||
type PlanList struct {
|
||||
ValidPlans PlanListGetValidPlansAttributeType `json:"validPlans,omitempty"`
|
||||
}
|
||||
|
||||
// NewPlanList instantiates a new PlanList 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 NewPlanList() *PlanList {
|
||||
this := PlanList{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewPlanListWithDefaults instantiates a new PlanList 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 NewPlanListWithDefaults() *PlanList {
|
||||
this := PlanList{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetValidPlans returns the ValidPlans field value if set, zero value otherwise.
|
||||
func (o *PlanList) GetValidPlans() (res PlanListGetValidPlansRetType) {
|
||||
res, _ = o.GetValidPlansOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetValidPlansOk returns a tuple with the ValidPlans field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *PlanList) GetValidPlansOk() (ret PlanListGetValidPlansRetType, ok bool) {
|
||||
return getPlanListGetValidPlansAttributeTypeOk(o.ValidPlans)
|
||||
}
|
||||
|
||||
// HasValidPlans returns a boolean if a field has been set.
|
||||
func (o *PlanList) HasValidPlans() bool {
|
||||
_, ok := o.GetValidPlansOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetValidPlans gets a reference to the given []Plan and assigns it to the ValidPlans field.
|
||||
func (o *PlanList) SetValidPlans(v PlanListGetValidPlansRetType) {
|
||||
setPlanListGetValidPlansAttributeType(&o.ValidPlans, v)
|
||||
}
|
||||
|
||||
func (o PlanList) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getPlanListGetValidPlansAttributeTypeOk(o.ValidPlans); ok {
|
||||
toSerialize["ValidPlans"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullablePlanList struct {
|
||||
value *PlanList
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullablePlanList) Get() *PlanList {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullablePlanList) Set(val *PlanList) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullablePlanList) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullablePlanList) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullablePlanList(val *PlanList) *NullablePlanList {
|
||||
return &NullablePlanList{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullablePlanList) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullablePlanList) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_plan_list_test.go
Normal file
11
pkg/edgebeta/model_plan_list_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
11
pkg/edgebeta/model_plan_test.go
Normal file
11
pkg/edgebeta/model_plan_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
127
pkg/edgebeta/model_token.go
Normal file
127
pkg/edgebeta/model_token.go
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the Token type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &Token{}
|
||||
|
||||
/*
|
||||
types and functions for token
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type TokenGetTokenAttributeType = *string
|
||||
|
||||
func getTokenGetTokenAttributeTypeOk(arg TokenGetTokenAttributeType) (ret TokenGetTokenRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setTokenGetTokenAttributeType(arg *TokenGetTokenAttributeType, val TokenGetTokenRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type TokenGetTokenArgType = string
|
||||
type TokenGetTokenRetType = string
|
||||
|
||||
// Token struct for Token
|
||||
type Token struct {
|
||||
// The token for the instance.
|
||||
// REQUIRED
|
||||
Token TokenGetTokenAttributeType `json:"token" required:"true"`
|
||||
}
|
||||
|
||||
type _Token Token
|
||||
|
||||
// NewToken instantiates a new Token object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewToken(token TokenGetTokenArgType) *Token {
|
||||
this := Token{}
|
||||
setTokenGetTokenAttributeType(&this.Token, token)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewTokenWithDefaults instantiates a new Token object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewTokenWithDefaults() *Token {
|
||||
this := Token{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetToken returns the Token field value
|
||||
func (o *Token) GetToken() (ret TokenGetTokenRetType) {
|
||||
ret, _ = o.GetTokenOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetTokenOk returns a tuple with the Token field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *Token) GetTokenOk() (ret TokenGetTokenRetType, ok bool) {
|
||||
return getTokenGetTokenAttributeTypeOk(o.Token)
|
||||
}
|
||||
|
||||
// SetToken sets field value
|
||||
func (o *Token) SetToken(v TokenGetTokenRetType) {
|
||||
setTokenGetTokenAttributeType(&o.Token, v)
|
||||
}
|
||||
|
||||
func (o Token) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getTokenGetTokenAttributeTypeOk(o.Token); ok {
|
||||
toSerialize["Token"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableToken struct {
|
||||
value *Token
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableToken) Get() *Token {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableToken) Set(val *Token) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableToken) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableToken) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableToken(val *Token) *NullableToken {
|
||||
return &NullableToken{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableToken) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableToken) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_token_test.go
Normal file
11
pkg/edgebeta/model_token_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
176
pkg/edgebeta/model_unauthorized_request.go
Normal file
176
pkg/edgebeta/model_unauthorized_request.go
Normal file
|
|
@ -0,0 +1,176 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the UnauthorizedRequest type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &UnauthorizedRequest{}
|
||||
|
||||
/*
|
||||
types and functions for code
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UnauthorizedRequestGetCodeAttributeType = *string
|
||||
|
||||
func getUnauthorizedRequestGetCodeAttributeTypeOk(arg UnauthorizedRequestGetCodeAttributeType) (ret UnauthorizedRequestGetCodeRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUnauthorizedRequestGetCodeAttributeType(arg *UnauthorizedRequestGetCodeAttributeType, val UnauthorizedRequestGetCodeRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UnauthorizedRequestGetCodeArgType = string
|
||||
type UnauthorizedRequestGetCodeRetType = string
|
||||
|
||||
/*
|
||||
types and functions for message
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UnauthorizedRequestGetMessageAttributeType = *string
|
||||
|
||||
func getUnauthorizedRequestGetMessageAttributeTypeOk(arg UnauthorizedRequestGetMessageAttributeType) (ret UnauthorizedRequestGetMessageRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUnauthorizedRequestGetMessageAttributeType(arg *UnauthorizedRequestGetMessageAttributeType, val UnauthorizedRequestGetMessageRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UnauthorizedRequestGetMessageArgType = string
|
||||
type UnauthorizedRequestGetMessageRetType = string
|
||||
|
||||
// UnauthorizedRequest struct for UnauthorizedRequest
|
||||
type UnauthorizedRequest struct {
|
||||
Code UnauthorizedRequestGetCodeAttributeType `json:"code,omitempty"`
|
||||
Message UnauthorizedRequestGetMessageAttributeType `json:"message,omitempty"`
|
||||
}
|
||||
|
||||
// NewUnauthorizedRequest instantiates a new UnauthorizedRequest 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 NewUnauthorizedRequest() *UnauthorizedRequest {
|
||||
this := UnauthorizedRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewUnauthorizedRequestWithDefaults instantiates a new UnauthorizedRequest 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 NewUnauthorizedRequestWithDefaults() *UnauthorizedRequest {
|
||||
this := UnauthorizedRequest{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetCode returns the Code field value if set, zero value otherwise.
|
||||
func (o *UnauthorizedRequest) GetCode() (res UnauthorizedRequestGetCodeRetType) {
|
||||
res, _ = o.GetCodeOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetCodeOk returns a tuple with the Code field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *UnauthorizedRequest) GetCodeOk() (ret UnauthorizedRequestGetCodeRetType, ok bool) {
|
||||
return getUnauthorizedRequestGetCodeAttributeTypeOk(o.Code)
|
||||
}
|
||||
|
||||
// HasCode returns a boolean if a field has been set.
|
||||
func (o *UnauthorizedRequest) HasCode() bool {
|
||||
_, ok := o.GetCodeOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetCode gets a reference to the given string and assigns it to the Code field.
|
||||
func (o *UnauthorizedRequest) SetCode(v UnauthorizedRequestGetCodeRetType) {
|
||||
setUnauthorizedRequestGetCodeAttributeType(&o.Code, v)
|
||||
}
|
||||
|
||||
// GetMessage returns the Message field value if set, zero value otherwise.
|
||||
func (o *UnauthorizedRequest) GetMessage() (res UnauthorizedRequestGetMessageRetType) {
|
||||
res, _ = o.GetMessageOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetMessageOk returns a tuple with the Message field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *UnauthorizedRequest) GetMessageOk() (ret UnauthorizedRequestGetMessageRetType, ok bool) {
|
||||
return getUnauthorizedRequestGetMessageAttributeTypeOk(o.Message)
|
||||
}
|
||||
|
||||
// HasMessage returns a boolean if a field has been set.
|
||||
func (o *UnauthorizedRequest) HasMessage() bool {
|
||||
_, ok := o.GetMessageOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetMessage gets a reference to the given string and assigns it to the Message field.
|
||||
func (o *UnauthorizedRequest) SetMessage(v UnauthorizedRequestGetMessageRetType) {
|
||||
setUnauthorizedRequestGetMessageAttributeType(&o.Message, v)
|
||||
}
|
||||
|
||||
func (o UnauthorizedRequest) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getUnauthorizedRequestGetCodeAttributeTypeOk(o.Code); ok {
|
||||
toSerialize["Code"] = val
|
||||
}
|
||||
if val, ok := getUnauthorizedRequestGetMessageAttributeTypeOk(o.Message); ok {
|
||||
toSerialize["Message"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableUnauthorizedRequest struct {
|
||||
value *UnauthorizedRequest
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableUnauthorizedRequest) Get() *UnauthorizedRequest {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableUnauthorizedRequest) Set(val *UnauthorizedRequest) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableUnauthorizedRequest) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableUnauthorizedRequest) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableUnauthorizedRequest(val *UnauthorizedRequest) *NullableUnauthorizedRequest {
|
||||
return &NullableUnauthorizedRequest{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableUnauthorizedRequest) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableUnauthorizedRequest) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_unauthorized_request_test.go
Normal file
11
pkg/edgebeta/model_unauthorized_request_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
178
pkg/edgebeta/model_update_instance_by_name_payload.go
Normal file
178
pkg/edgebeta/model_update_instance_by_name_payload.go
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the UpdateInstanceByNamePayload type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &UpdateInstanceByNamePayload{}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UpdateInstanceByNamePayloadGetDescriptionAttributeType = *string
|
||||
|
||||
func getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(arg UpdateInstanceByNamePayloadGetDescriptionAttributeType) (ret UpdateInstanceByNamePayloadGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUpdateInstanceByNamePayloadGetDescriptionAttributeType(arg *UpdateInstanceByNamePayloadGetDescriptionAttributeType, val UpdateInstanceByNamePayloadGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UpdateInstanceByNamePayloadGetDescriptionArgType = string
|
||||
type UpdateInstanceByNamePayloadGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for planId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UpdateInstanceByNamePayloadGetPlanIdAttributeType = *string
|
||||
|
||||
func getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(arg UpdateInstanceByNamePayloadGetPlanIdAttributeType) (ret UpdateInstanceByNamePayloadGetPlanIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUpdateInstanceByNamePayloadGetPlanIdAttributeType(arg *UpdateInstanceByNamePayloadGetPlanIdAttributeType, val UpdateInstanceByNamePayloadGetPlanIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UpdateInstanceByNamePayloadGetPlanIdArgType = string
|
||||
type UpdateInstanceByNamePayloadGetPlanIdRetType = string
|
||||
|
||||
// UpdateInstanceByNamePayload struct for UpdateInstanceByNamePayload
|
||||
type UpdateInstanceByNamePayload struct {
|
||||
// A user chosen description to distinguish multiple instances.
|
||||
Description UpdateInstanceByNamePayloadGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// Service Plan configures the size of the Instance.
|
||||
PlanId UpdateInstanceByNamePayloadGetPlanIdAttributeType `json:"planId,omitempty"`
|
||||
}
|
||||
|
||||
// NewUpdateInstanceByNamePayload instantiates a new UpdateInstanceByNamePayload 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 NewUpdateInstanceByNamePayload() *UpdateInstanceByNamePayload {
|
||||
this := UpdateInstanceByNamePayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewUpdateInstanceByNamePayloadWithDefaults instantiates a new UpdateInstanceByNamePayload 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 NewUpdateInstanceByNamePayloadWithDefaults() *UpdateInstanceByNamePayload {
|
||||
this := UpdateInstanceByNamePayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *UpdateInstanceByNamePayload) GetDescription() (res UpdateInstanceByNamePayloadGetDescriptionRetType) {
|
||||
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 *UpdateInstanceByNamePayload) GetDescriptionOk() (ret UpdateInstanceByNamePayloadGetDescriptionRetType, ok bool) {
|
||||
return getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *UpdateInstanceByNamePayload) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *UpdateInstanceByNamePayload) SetDescription(v UpdateInstanceByNamePayloadGetDescriptionRetType) {
|
||||
setUpdateInstanceByNamePayloadGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetPlanId returns the PlanId field value if set, zero value otherwise.
|
||||
func (o *UpdateInstanceByNamePayload) GetPlanId() (res UpdateInstanceByNamePayloadGetPlanIdRetType) {
|
||||
res, _ = o.GetPlanIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *UpdateInstanceByNamePayload) GetPlanIdOk() (ret UpdateInstanceByNamePayloadGetPlanIdRetType, ok bool) {
|
||||
return getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(o.PlanId)
|
||||
}
|
||||
|
||||
// HasPlanId returns a boolean if a field has been set.
|
||||
func (o *UpdateInstanceByNamePayload) HasPlanId() bool {
|
||||
_, ok := o.GetPlanIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetPlanId gets a reference to the given string and assigns it to the PlanId field.
|
||||
func (o *UpdateInstanceByNamePayload) SetPlanId(v UpdateInstanceByNamePayloadGetPlanIdRetType) {
|
||||
setUpdateInstanceByNamePayloadGetPlanIdAttributeType(&o.PlanId, v)
|
||||
}
|
||||
|
||||
func (o UpdateInstanceByNamePayload) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getUpdateInstanceByNamePayloadGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getUpdateInstanceByNamePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok {
|
||||
toSerialize["PlanId"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableUpdateInstanceByNamePayload struct {
|
||||
value *UpdateInstanceByNamePayload
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstanceByNamePayload) Get() *UpdateInstanceByNamePayload {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstanceByNamePayload) Set(val *UpdateInstanceByNamePayload) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstanceByNamePayload) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstanceByNamePayload) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableUpdateInstanceByNamePayload(val *UpdateInstanceByNamePayload) *NullableUpdateInstanceByNamePayload {
|
||||
return &NullableUpdateInstanceByNamePayload{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstanceByNamePayload) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstanceByNamePayload) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_update_instance_by_name_payload_test.go
Normal file
11
pkg/edgebeta/model_update_instance_by_name_payload_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
178
pkg/edgebeta/model_update_instance_payload.go
Normal file
178
pkg/edgebeta/model_update_instance_payload.go
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the UpdateInstancePayload type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &UpdateInstancePayload{}
|
||||
|
||||
/*
|
||||
types and functions for description
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UpdateInstancePayloadGetDescriptionAttributeType = *string
|
||||
|
||||
func getUpdateInstancePayloadGetDescriptionAttributeTypeOk(arg UpdateInstancePayloadGetDescriptionAttributeType) (ret UpdateInstancePayloadGetDescriptionRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUpdateInstancePayloadGetDescriptionAttributeType(arg *UpdateInstancePayloadGetDescriptionAttributeType, val UpdateInstancePayloadGetDescriptionRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UpdateInstancePayloadGetDescriptionArgType = string
|
||||
type UpdateInstancePayloadGetDescriptionRetType = string
|
||||
|
||||
/*
|
||||
types and functions for planId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UpdateInstancePayloadGetPlanIdAttributeType = *string
|
||||
|
||||
func getUpdateInstancePayloadGetPlanIdAttributeTypeOk(arg UpdateInstancePayloadGetPlanIdAttributeType) (ret UpdateInstancePayloadGetPlanIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUpdateInstancePayloadGetPlanIdAttributeType(arg *UpdateInstancePayloadGetPlanIdAttributeType, val UpdateInstancePayloadGetPlanIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UpdateInstancePayloadGetPlanIdArgType = string
|
||||
type UpdateInstancePayloadGetPlanIdRetType = string
|
||||
|
||||
// UpdateInstancePayload struct for UpdateInstancePayload
|
||||
type UpdateInstancePayload struct {
|
||||
// A user chosen description to distinguish multiple instances.
|
||||
Description UpdateInstancePayloadGetDescriptionAttributeType `json:"description,omitempty"`
|
||||
// Service Plan configures the size of the Instance.
|
||||
PlanId UpdateInstancePayloadGetPlanIdAttributeType `json:"planId,omitempty"`
|
||||
}
|
||||
|
||||
// NewUpdateInstancePayload instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayload() *UpdateInstancePayload {
|
||||
this := UpdateInstancePayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewUpdateInstancePayloadWithDefaults instantiates a new UpdateInstancePayload 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 NewUpdateInstancePayloadWithDefaults() *UpdateInstancePayload {
|
||||
this := UpdateInstancePayload{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetDescription returns the Description field value if set, zero value otherwise.
|
||||
func (o *UpdateInstancePayload) GetDescription() (res UpdateInstancePayloadGetDescriptionRetType) {
|
||||
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 *UpdateInstancePayload) GetDescriptionOk() (ret UpdateInstancePayloadGetDescriptionRetType, ok bool) {
|
||||
return getUpdateInstancePayloadGetDescriptionAttributeTypeOk(o.Description)
|
||||
}
|
||||
|
||||
// HasDescription returns a boolean if a field has been set.
|
||||
func (o *UpdateInstancePayload) HasDescription() bool {
|
||||
_, ok := o.GetDescriptionOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetDescription gets a reference to the given string and assigns it to the Description field.
|
||||
func (o *UpdateInstancePayload) SetDescription(v UpdateInstancePayloadGetDescriptionRetType) {
|
||||
setUpdateInstancePayloadGetDescriptionAttributeType(&o.Description, v)
|
||||
}
|
||||
|
||||
// GetPlanId returns the PlanId field value if set, zero value otherwise.
|
||||
func (o *UpdateInstancePayload) GetPlanId() (res UpdateInstancePayloadGetPlanIdRetType) {
|
||||
res, _ = o.GetPlanIdOk()
|
||||
return
|
||||
}
|
||||
|
||||
// GetPlanIdOk returns a tuple with the PlanId field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *UpdateInstancePayload) GetPlanIdOk() (ret UpdateInstancePayloadGetPlanIdRetType, ok bool) {
|
||||
return getUpdateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId)
|
||||
}
|
||||
|
||||
// HasPlanId returns a boolean if a field has been set.
|
||||
func (o *UpdateInstancePayload) HasPlanId() bool {
|
||||
_, ok := o.GetPlanIdOk()
|
||||
return ok
|
||||
}
|
||||
|
||||
// SetPlanId gets a reference to the given string and assigns it to the PlanId field.
|
||||
func (o *UpdateInstancePayload) SetPlanId(v UpdateInstancePayloadGetPlanIdRetType) {
|
||||
setUpdateInstancePayloadGetPlanIdAttributeType(&o.PlanId, v)
|
||||
}
|
||||
|
||||
func (o UpdateInstancePayload) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getUpdateInstancePayloadGetDescriptionAttributeTypeOk(o.Description); ok {
|
||||
toSerialize["Description"] = val
|
||||
}
|
||||
if val, ok := getUpdateInstancePayloadGetPlanIdAttributeTypeOk(o.PlanId); ok {
|
||||
toSerialize["PlanId"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableUpdateInstancePayload struct {
|
||||
value *UpdateInstancePayload
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstancePayload) Get() *UpdateInstancePayload {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstancePayload) Set(val *UpdateInstancePayload) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstancePayload) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstancePayload) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableUpdateInstancePayload(val *UpdateInstancePayload) *NullableUpdateInstancePayload {
|
||||
return &NullableUpdateInstancePayload{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableUpdateInstancePayload) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableUpdateInstancePayload) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_update_instance_payload_test.go
Normal file
11
pkg/edgebeta/model_update_instance_payload_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
172
pkg/edgebeta/model_user.go
Normal file
172
pkg/edgebeta/model_user.go
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// checks if the User type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &User{}
|
||||
|
||||
/*
|
||||
types and functions for email
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UserGetEmailAttributeType = *string
|
||||
|
||||
func getUserGetEmailAttributeTypeOk(arg UserGetEmailAttributeType) (ret UserGetEmailRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUserGetEmailAttributeType(arg *UserGetEmailAttributeType, val UserGetEmailRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UserGetEmailArgType = string
|
||||
type UserGetEmailRetType = string
|
||||
|
||||
/*
|
||||
types and functions for internalId
|
||||
*/
|
||||
|
||||
// isNotNullableString
|
||||
type UserGetInternalIdAttributeType = *string
|
||||
|
||||
func getUserGetInternalIdAttributeTypeOk(arg UserGetInternalIdAttributeType) (ret UserGetInternalIdRetType, ok bool) {
|
||||
if arg == nil {
|
||||
return ret, false
|
||||
}
|
||||
return *arg, true
|
||||
}
|
||||
|
||||
func setUserGetInternalIdAttributeType(arg *UserGetInternalIdAttributeType, val UserGetInternalIdRetType) {
|
||||
*arg = &val
|
||||
}
|
||||
|
||||
type UserGetInternalIdArgType = string
|
||||
type UserGetInternalIdRetType = string
|
||||
|
||||
// User struct for User
|
||||
type User struct {
|
||||
// The email of the user.
|
||||
// REQUIRED
|
||||
Email UserGetEmailAttributeType `json:"email" required:"true"`
|
||||
// The UUID of the user.
|
||||
// REQUIRED
|
||||
InternalId UserGetInternalIdAttributeType `json:"internalId" required:"true"`
|
||||
}
|
||||
|
||||
type _User User
|
||||
|
||||
// NewUser instantiates a new User 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 NewUser(email UserGetEmailArgType, internalId UserGetInternalIdArgType) *User {
|
||||
this := User{}
|
||||
setUserGetEmailAttributeType(&this.Email, email)
|
||||
setUserGetInternalIdAttributeType(&this.InternalId, internalId)
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewUserWithDefaults instantiates a new User 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 NewUserWithDefaults() *User {
|
||||
this := User{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetEmail returns the Email field value
|
||||
func (o *User) GetEmail() (ret UserGetEmailRetType) {
|
||||
ret, _ = o.GetEmailOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetEmailOk returns a tuple with the Email field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *User) GetEmailOk() (ret UserGetEmailRetType, ok bool) {
|
||||
return getUserGetEmailAttributeTypeOk(o.Email)
|
||||
}
|
||||
|
||||
// SetEmail sets field value
|
||||
func (o *User) SetEmail(v UserGetEmailRetType) {
|
||||
setUserGetEmailAttributeType(&o.Email, v)
|
||||
}
|
||||
|
||||
// GetInternalId returns the InternalId field value
|
||||
func (o *User) GetInternalId() (ret UserGetInternalIdRetType) {
|
||||
ret, _ = o.GetInternalIdOk()
|
||||
return ret
|
||||
}
|
||||
|
||||
// GetInternalIdOk returns a tuple with the InternalId field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *User) GetInternalIdOk() (ret UserGetInternalIdRetType, ok bool) {
|
||||
return getUserGetInternalIdAttributeTypeOk(o.InternalId)
|
||||
}
|
||||
|
||||
// SetInternalId sets field value
|
||||
func (o *User) SetInternalId(v UserGetInternalIdRetType) {
|
||||
setUserGetInternalIdAttributeType(&o.InternalId, v)
|
||||
}
|
||||
|
||||
func (o User) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
if val, ok := getUserGetEmailAttributeTypeOk(o.Email); ok {
|
||||
toSerialize["Email"] = val
|
||||
}
|
||||
if val, ok := getUserGetInternalIdAttributeTypeOk(o.InternalId); ok {
|
||||
toSerialize["InternalId"] = val
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
type NullableUser struct {
|
||||
value *User
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableUser) Get() *User {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableUser) Set(val *User) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableUser) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableUser) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableUser(val *User) *NullableUser {
|
||||
return &NullableUser{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableUser) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableUser) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
11
pkg/edgebeta/model_user_test.go
Normal file
11
pkg/edgebeta/model_user_test.go
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
385
pkg/edgebeta/utils.go
Normal file
385
pkg/edgebeta/utils.go
Normal file
|
|
@ -0,0 +1,385 @@
|
|||
/*
|
||||
STACKIT Edge Cloud API
|
||||
|
||||
This API provides endpoints for managing STACKIT Edge Cloud instances.
|
||||
|
||||
API version: 1beta1
|
||||
*/
|
||||
|
||||
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
|
||||
|
||||
package edgebeta
|
||||
|
||||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue